Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  rpl_table_map_name_overflow.test  Sprache: unbekannt

 
Spracherkennung für: .test vermutete Sprache: SQL {SQL[76] VDM[76] ABAP[66]} [Methode: maximale Elemente, drei Dimensionen]

#
#   This test verifies that a replica rejects a Table_map event whose
# database or table name is longer than an identifier can be, when the SQL
# thread reads the event from the relay log and constructs it.
#
#   A replica copies each name into a NAME_LEN+1 byte buffer with strmov(),
# which stops only at a terminating null, so without the bound a 255 byte
# name overruns that buffer as the SQL thread applies the event. The event's
# constructor rejects the oversized name before that copy, so the SQL thread
# stops with ER_SLAVE_RELAY_LOG_READ_FAILURE instead.
#
#   Note rpl_table_map_name_overflow-master.opt sets binlog_checksum=NONE on
# the master to simplify creating a corrupted event to send to the slave.
#
# References:
#   * MDEV-40644: Slave SQL Thread Overflow on Malformed Table_map_log_event
#

--source include/have_debug.inc
# A Table_map event is only produced in row format.
--source include/have_binlog_format_row.inc
--source include/master-slave.inc

--connection slave
call mtr.add_suppression("Error in Log_event::read_log_event.*Found invalid event");
call mtr.add_suppression("Relay log read failure");

--echo #
--echo # Initialize test data
--echo #
--connection master
create table t1 (a int);
insert into t1 values (1);
--source include/save_master_gtid.inc

--connection slave
--source include/sync_with_master_gtid.inc

# Use slave_pos so we can easily reset the relay log after it receives a
# corrupted event
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--source include/start_slave.inc

--connection master
set @saved_dbug= @@global.debug_dbug;

--echo #
--echo # Test Case: a Table_map event naming a table with an oversized name
--echo #
--connection master
set @@global.debug_dbug= "+d,binlog_sender_oversized_table_name";

# The dump thread reads the global setting when the replica reconnects, so
# restart the replica to open a fresh dump thread that carries the injection.
--connection slave
--source include/stop_slave.inc
--source include/start_slave.inc

--connection master
insert into t1 values (2);

--echo # Waiting for the SQL thread to reject the oversized Table_map event
--connection slave
--let $slave_sql_errno= 1594
--source include/wait_for_slave_sql_error.inc

# The injection grows the table name to 255 bytes and leaves the database
# name "test" at its four bytes. The constructor rejects the oversized name,
# so read_log_event() reports the event as invalid.
--echo # Ensure the SQL thread rejected the oversized Table_map event
--let $assert_text= The SQL thread reported the oversized Table_map event as invalid
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
--let $assert_select= Found invalid event in binary log
--let $assert_count= 1
--source include/assert_grep.inc

# The constructor rejects the event before do_apply_event() copies the name,
# so the SQL thread stops without applying the row the event carried.
--echo # Ensure the rejected event delivered nothing to the replica
--let $slave_row_count= query_get_value(SELECT COUNT(*) AS c FROM t1, c, 1)
--let $assert_text= The replica has not applied the insert the event carried
--let $assert_cond= $slave_row_count = 1
--source include/assert.inc

--connection master
set @@global.debug_dbug= @saved_dbug;

--echo #
--echo # Ensure the replica holds the row once it refetches the relay log
--echo #
--connection slave
--source include/stop_slave_io.inc
--source include/start_slave.inc

--connection master
--source include/save_master_gtid.inc

--connection slave
--source include/sync_with_master_gtid.inc
--let $diff_tables=master:t1,slave:t1
--source include/diff_tables.inc

--echo #
--echo # Ensure replication works after the rejected event
--echo #
--connection master
insert into t1 values (3);
--source include/save_master_gtid.inc

--connection slave
--source include/sync_with_master_gtid.inc
--let $diff_tables=master:t1,slave:t1
--source include/diff_tables.inc

--echo #
--echo # Cleanup
--echo #
--connection master
drop table t1;
--source include/save_master_gtid.inc

--connection slave
--source include/sync_with_master_gtid.inc

--source include/rpl_end.inc
--echo # End of rpl_table_map_name_overflow.test

[Dauer der Verarbeitung: 0.16 Sekunden, vorverarbeitet 2026-10-10]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126438
#Domains=1897691