diff options
author | Monty <monty@mariadb.org> | 2020-03-25 16:29:23 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-03-25 16:30:53 +0200 |
commit | 80544a5878ac1ce456140914e53701b7611fc721 (patch) | |
tree | eb6109b54e8ab1f4eae2104349ec41fc68a3af35 | |
parent | 12d59fabe268fe47fdc7952d69f97e5989afd305 (diff) | |
download | mariadb-git-80544a5878ac1ce456140914e53701b7611fc721.tar.gz |
Fixed rpl.rpl_mariadb_slave_capability.result file
The cause was an uninitalized variable on the slave when reading a dummy
event that can only be generated by the test.
Fixed by ensuring that flag2 is always initialized.
Fixed also some indentation issues and improved comments.
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result | 8 | ||||
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/log_event_client.cc | 8 | ||||
-rw-r--r-- | sql/log_event_server.cc | 16 |
4 files changed, 20 insertions, 14 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result index 6b0a27f2134..d384422f88a 100644 --- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result +++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result @@ -40,12 +40,12 @@ a 1 include/show_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000005 # Query # # set foreign_key_checks=1, check_constraint_checks=1; BEGIN +slave-relay-bin.000005 # Query # # BEGIN slave-relay-bin.000005 # Annotate_rows # # DELETE FROM t1 slave-relay-bin.000005 # Table_map # # table_id: # (test.t1) slave-relay-bin.000005 # Delete_rows_v1 # # table_id: # flags: STMT_END_F slave-relay-bin.000005 # Query # # COMMIT -slave-relay-bin.000005 # Query # # set foreign_key_checks=1, check_constraint_checks=1; BEGIN +slave-relay-bin.000005 # Query # # BEGIN slave-relay-bin.000005 # Annotate_rows # # INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1) slave-relay-bin.000005 # Table_map # # table_id: # (test.t1) slave-relay-bin.000005 # Write_rows_v1 # # table_id: # flags: STMT_END_F @@ -70,7 +70,7 @@ a 2 include/show_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000007 # Query # # set foreign_key_checks=1, check_constraint_checks=1; BEGIN +slave-relay-bin.000007 # Query # # BEGIN slave-relay-bin.000007 # Annotate_rows # # INSERT INTO t1 VALUES(2) slave-relay-bin.000007 # Table_map # # table_id: # (test.t1) slave-relay-bin.000007 # Write_rows_v1 # # table_id: # flags: STMT_END_F @@ -137,7 +137,7 @@ a 3 include/show_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-relay-bin.000008 # Query # # set foreign_key_checks=1, check_constraint_checks=1; BEGIN +slave-relay-bin.000008 # Query # # BEGIN slave-relay-bin.000008 # Annotate_rows # # UPDATE t1 SET a = 3 slave-relay-bin.000008 # Table_map # # table_id: # (test.t1) slave-relay-bin.000008 # Update_rows_v1 # # table_id: # flags: STMT_END_F diff --git a/sql/log_event.cc b/sql/log_event.cc index d9537839f6c..1b273b19c33 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1435,7 +1435,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len, Log_event_type event_type) :Log_event(buf, description_event), data_buf(0), query(NullS), db(NullS), catalog_len(0), status_vars_len(0), - flags2_inited(0), sql_mode_inited(0), charset_inited(0), + flags2_inited(0), sql_mode_inited(0), charset_inited(0), flags2(0), auto_increment_increment(1), auto_increment_offset(1), time_zone_len(0), lc_time_names_number(0), charset_database_number(0), table_map_for_update(0), master_data_written(0) diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 5686148ceb3..c53a2b53769 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -1868,9 +1868,10 @@ bool Query_log_event::print_query_header(IO_CACHE* file, } /* - If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to - print (remember we don't produce mixed relay logs so there cannot be - 5.0 events before that one so there is nothing to reset). + If flags2_inited==0, this is an event from 3.23 or 4.0 or a dummy + event from the mtr test suite; nothing to print (remember we don't + produce mixed relay logs so there cannot be 5.0 events before that + one so there is nothing to reset). */ if (likely(flags2_inited)) /* likely as this will mainly read 5.0 logs */ { @@ -3761,6 +3762,7 @@ st_print_event_info::st_print_event_info() delimiter[0]= ';'; delimiter[1]= 0; flags2_inited= 0; + flags2= 0; sql_mode_inited= 0; row_events= 0; sql_mode= 0; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 663be5b647d..feb8fd643b7 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -1367,7 +1367,8 @@ Query_log_event::Query_log_event() Creates an event for binlogging The value for `errcode' should be supplied by caller. */ -Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length, bool using_trans, +Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, + size_t query_length, bool using_trans, bool direct, bool suppress_use, int errcode) :Log_event(thd_arg, @@ -1380,7 +1381,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, size_t que thread_id(thd_arg->thread_id), /* save the original thread id; we already know the server id */ slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id), - flags2_inited(1), sql_mode_inited(1), charset_inited(1), + flags2_inited(1), sql_mode_inited(1), charset_inited(1), flags2(0), sql_mode(thd_arg->variables.sql_mode), auto_increment_increment(thd_arg->variables.auto_increment_increment), auto_increment_offset(thd_arg->variables.auto_increment_offset), @@ -1685,15 +1686,18 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, { thd->slave_expected_error= expected_error; if (flags2_inited) + { /* - all bits of thd->variables.option_bits which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG - must take their value from flags2. + all bits of thd->variables.option_bits which are 1 in + OPTIONS_WRITTEN_TO_BIN_LOG must take their value from + flags2. */ thd->variables.option_bits= flags2|(thd->variables.option_bits & ~OPTIONS_WRITTEN_TO_BIN_LOG); + } /* else, we are in a 3.23/4.0 binlog; we previously received a - Rotate_log_event which reset thd->variables.option_bits and sql_mode etc, so - nothing to do. + Rotate_log_event which reset thd->variables.option_bits and + sql_mode etc, so nothing to do. */ /* We do not replicate MODE_NO_DIR_IN_CREATE. That is, if the master is a |