1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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.
This commit is contained in:
Monty
2020-03-25 16:29:23 +02:00
parent 12d59fabe2
commit 80544a5878
4 changed files with 20 additions and 14 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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