Server IP : 104.21.38.3 / Your IP : 104.23.175.197 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/rpl/t/ |
Upload File : |
# ===== Purpose ===== # # 1) The purpose of this test is to check if the GTIDs, and the data dumped # by mysqldump are consistent. Especially the case when the server has # GTIDs enabled, and there are transactions running in the background, # during the dump. # 2) We've to also make sure that the dump file can be restored on a # GTID aware server. # # ===== Implementation ===== # # Consists of 2 steps # # - Step 1 - # 1) Create a test table 't', in database 'db' # 2) Create a stored procedure, which will be called just before mysqldump # is executed. This will help us to mimick a scenario in which there are # transactions going on in the background, while mysqldump is dumping # the databases. # 3) Call the procedure, then start mysqldump just after that # # - Step 2 - # 5) Now restore the dump file to the replica # 6) Execute some statements on the source # 7) Sync source, and replica # 8) The replica's GTID_EXECUTED must be equal to the source's one # # ===== Requirements ===== # # 1) The dump captured by mysqldump with --single-transaction and # set-gtid-purged=ON must contain the exact set of transaction GTIDs # that were extracted. # 2) The dump file can be restored without any issue # 3) The replication is working fine # 4) The replica's GTID_EXECUTED must be equal to the source's one # when replication catches up. # # ===== References ===== # # Bug#33630199 : mysqldump make a non-consistent backup with # --single-transaction option --source include/have_binlog_format_row.inc --source include/have_gtid.inc --let $rpl_gtid_utils= 1 --let $rpl_skip_start_slave= 1 --source include/master-slave.inc # Step 1 # Running mysqldump, and inserting data into the tables at the same time # File, which is going to be used by mysqldump let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/bug33630199_dump.sql; # Create test db CREATE DATABASE db; USE db; # Create test table CREATE TABLE t(num INT, num2 INT); # Create the stored procedure. # We need to keep on sending insert statements to the server, # while on the other session, mysqldump is dumping the data. DELIMITER $; CREATE PROCEDURE insertParallely() BEGIN DECLARE counter INT DEFAULT 1; WHILE counter <= 1000 DO INSERT INTO db.t VALUES(counter, 1); SET counter = counter + 1; END WHILE; END$ DELIMITER ;$ # Start sending insert statements --send CALL insertParallely(); --let $rpl_connection_name= server_1 --source include/rpl_connection.inc # Dump on fast machines could be empty. # Make sure that somethings inserted. --let $wait_condition= SELECT COUNT(*) > 10 FROM db.t --source include/wait_condition.inc --exec $MYSQL_DUMP --compact --single-transaction --set-gtid-purged=ON -ER --databases db > $mysqldumpfile --source include/rpl_connection_master.inc --reap # End of Step 1 # Step 2 # Restoring the dump file, and syncing source-replica --source include/rpl_connection_slave.inc --exec $MYSQL_SLAVE --force < $mysqldumpfile --remove_file $mysqldumpfile --source include/start_slave.inc --source include/rpl_connection_master.inc # Make sure that replication is working. # Execute an UPDATE that updates all the table data. # If some data is missing from the dump but not from the GTID set, # replication errors will occur. UPDATE db.t SET num2=2 WHERE num2=1; --let $source_gtid_executed=`SELECT @@GLOBAL.gtid_executed` --source include/sync_slave_sql_with_master.inc --source include/rpl_connection_slave.inc # Count the rows in 't' with num2=2 on replica, must be 1000 --let $row_count = `SELECT 1000 = (SELECT COUNT(*) FROM db.t WHERE num2=2)` --let $assert_text= The row count with num2=2 must be 1000 on replica --let $assert_cond= $row_count --source include/assert.inc # GTID_EXECUTED must be equal for both source and replica. --let $is_equal= `SELECT GTID_IS_EQUAL('$source_gtid_executed', @@GLOBAL.gtid_executed)` --let $assert_text= The replica's GTID_EXECUTED must be equal to the source's one --let $assert_cond= $is_equal --source include/assert.inc --source include/rpl_connection_master.inc DROP DATABASE db; --source include/rpl_end.inc # End of Step 2