← Back to team overview

maria-developers team mailing list archive

Re: Doubt in bin logging for CREATE VIEW

 

Hi Sriram.

The good news ... nice catch, you earned your GSoC salary!

The mysql_register_view() has a dozen 
different ways to fail:

- RAM: my_error(ER_OUT_OF_RESOURCES, MYF(0));
- disk: sql_create_definition_file()
- name collision
- etc.

So the create view statement can
definitely fail on the master,
and should not replicate when that happens.

Note that warnings can also be set, so
investigate if that affects replication:

push_warning(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_WARN_VIEW_MERGE,
ER(ER_WARN_VIEW_MERGE));

The bad news ... I read over the create view source,
and there's tons of work that hasn't been finished yet
(just read the comments about union and restrict/
cascade for starters.)

Another future project!

Thanks, James.

--------------------------------------------
On Thu, 6/19/14, sriram patil <spsrirampatil@xxxxxxxxx> wrote:

 Subject: [Maria-developers] Doubt in bin logging for CREATE VIEW
 To: maria-developers@xxxxxxxxxxxxxxxxxxx
 Date: Thursday, June 19, 2014, 12:54 AM
 
 Hi All,
 I was checking the behavior of bin logging in
 various methods. I found out CREATE VIEW differs a little
 bit than others in bin logging.
 The query is written into bin log if query is
 executed successfully. If there is any error the query is
 not logged. This behavior is observed across all the
 commands.
 
 
 In case of CREATE VIEW (method: mysql_create_view
 file: sql/sql_view.cc), while the bin logging is skipped for
 most of the errors by jumping to "err" label, it
 is not skipped in following code snippet (line number:
 616)
 
 
 res= mysql_register_view(thd, view,
 mode);
 /*    View TABLE_SHARE must be
 removed from the table definition cache in order
 to    make ALTER VIEW work properly. Otherwise,
 we would not be able to detect
 
     meta-data changes after ALTER
 VIEW.*/
 if (!res)  tdc_remove_table(thd,
 TDC_RT_REMOVE_ALL, view->db, view->table_name,
 false);
 if (mysql_bin_log.is_open())
 
 {  // this is where the log is
 written}
 
 If an error occurs in mysql_register_view, e.g.
 ER_OUT_OF_RESOURCES, ER_TABLE_EXISTS_ERROR, etc. the query
 is still logged.
 
 
 Is there a specific reason why it is logged even
 though an error occurs? Or is it a bug?
 Thanks &
 Regards,Sriram
 -----Inline Attachment Follows-----
 
 _______________________________________________
 Mailing list: https://launchpad.net/~maria-developers
 Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
 Unsubscribe : https://launchpad.net/~maria-developers
 More help   : https://help.launchpad.net/ListHelp



Follow ups

References