From 1e0f09cacbb05eec95078e10df1ea610736b9c1a Mon Sep 17 00:00:00 2001 From: sachin Date: Thu, 17 May 2018 14:40:55 +0530 Subject: MDEV-16239 Many test in rpl suite fails Fix rpl_skip_error test. We cant reset Slave_skipped_errors(even with FLUSH STATUS), So instead of absolute slave_skipped_errors we look for delta of slave_skipped_errors Fix rpl.rpl_binlog_errors and binlog_encryption.rpl_binlog_errors We create the $load_file and $load_file2 but we never remove them. Fix rpl_000011.test Instead of real value use delta value , Since flush status wont flush LONGLONG variable. Fix rpl_row_find_row_debug Instead of searching whole log_error_ file we will use search_pattern_in_file which runs pattern search only on latest test run , instead of full file. Fix rpl_ip_mix rpl_ip_mix2 We should call reset slave all because we also want to reset master_host otherwise show slave status wont be empty and making repeat N a failure. Fix rpl_rotate_logs First we have to remove master.info file (cleanup) and second we have to call reset slave all because if we do not call reset slave all then we wont read master.info file beacuse we already have master config in memory. And this makes start slave to pass , which shoud fail becuase its permision is 000 Fix circular_serverid0 test The reason is that ++dbug_rows_event_count == 2 in queue_event does not take --repeat into account. So I have reseted the dbug_rows_event_count in if body. --- sql/slave.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/slave.cc') diff --git a/sql/slave.cc b/sql/slave.cc index 165aa20b1ee..7a9882de507 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -6214,6 +6214,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) DBUG_ASSERT(debug_sync_service); DBUG_ASSERT(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); + dbug_rows_event_count = 0; };); #endif mysql_mutex_lock(&mi->data_lock); -- cgit v1.2.1 From 27664ef29d97be2973982aedcc0c8c90d18b20a4 Mon Sep 17 00:00:00 2001 From: Sachin Setiya Date: Thu, 26 Sep 2019 15:05:55 +0530 Subject: MDEV-20574 Position of events reported by mysqlbinlog is wrong with encrypted binlogs, SHOW BINLOG EVENTS reports the correct one. Analysis Mysqlbinlog output for encrypted binary log #Q> insert into tab1 values (3,'row 003') #190912 17:36:35 server id 10221 end_log_pos 980 CRC32 0x53bcb3d3 Table_map: `test`.`tab1` mapped to number 19 # at 940 #190912 17:36:35 server id 10221 end_log_pos 1026 CRC32 0xf2ae5136 Write_rows: table id 19 flags: STMT_END_F Here we can see Table_map_log_event ends at 980 but Next event starts at 940. And the reason for that is we do not send START_ENCRYPTION_EVENT to the slave Solution:- Send Start_encryption_log_event as Ignorable_log_event to slave(mysqlbinlog), So that mysqlbinlog can update its log_pos. Since Slave can request multiple FORMAT_DESCRIPTION_EVENT while master does not have so We only update slave master pos when master actually have the FORMAT_DESCRIPTION_EVENT. Similar logic should be applied for START_ENCRYPTION_EVENT. Also added the test case when new server reads the data from old server which does not send START_ENCRYPTION_EVENT to slave. Master Slave Upgrade Scenario. When Slave is updated first, Slave will have extra logic of handling START_ENCRYPTION_EVENT But master willnot be sending START_ENCRYPTION_EVENT. So there will be no issue. When Master is updated first, It will send START_ENCRYPTION_EVENT to slave , But slave will ignore this event in queue_event. --- sql/slave.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sql/slave.cc') diff --git a/sql/slave.cc b/sql/slave.cc index 88a80029bba..1bc21f8895b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -6317,7 +6317,18 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) mi->last_queued_gtid.seq_no == 1000) goto skip_relay_logging; }); + goto default_action; #endif + case START_ENCRYPTION_EVENT: + if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F) + { + /* + If the event was not requested by the slave (the slave did not ask for + it), i.e. has end_log_pos=0, we do not increment mi->master_log_pos + */ + inc_pos= uint4korr(buf+LOG_POS_OFFSET) ? event_len : 0; + break; + } /* fall through */ default: default_action: -- cgit v1.2.1