Server IP : 104.21.38.3 / Your IP : 172.70.93.16 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/extra/rpl_tests/ |
Upload File : |
# Testcase for BUG#6287 "Slave skips auto_increment values in Replication with InnoDB" # The bug was that if on master, INSERT IGNORE ignored some # rows, and the table was InnoDB with auto_inc column, then on slave # some rows received an auto_inc bigger than on master. # Slave needs to be started with --innodb to store table in InnoDB. # Same test for MyISAM (which had no bug). --connection master eval CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned, unique (b) ) ENGINE=$engine_type; eval CREATE TABLE t2 ( a int unsigned, # to force INSERT SELECT to have a certain order b int unsigned ) ENGINE=$engine_type; INSERT INTO t1 VALUES (NULL, 1); INSERT INTO t1 VALUES (NULL, 2); INSERT INTO t1 VALUES (NULL, 3); INSERT INTO t1 VALUES (NULL, 4); # An alternation of values which will conflict in t1 and will not. INSERT INTO t2 VALUES (1, 1); INSERT INTO t2 VALUES (2, 2); INSERT INTO t2 VALUES (3, 5); INSERT INTO t2 VALUES (4, 3); INSERT INTO t2 VALUES (5, 4); INSERT INTO t2 VALUES (6, 6); --disable_warnings ONCE INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a; --let $assert_cond= COUNT(*) = 6 FROM t1 --let $assert_text= Count of elements in t1 should be 6. --source include/assert.inc # Compare master and slave --source include/sync_slave_sql_with_master.inc --let $diff_tables= master:test.t1 , slave:test.t1 --source include/diff_tables.inc # BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR # An insert ignore that does not update anything must be written to the binary log in SBR # and MIXED modes. We check this property by counting occurrences in t1 before and after # the insert and comparing the binlog positions. The count should be the same in both points # and the statement should be in the binary log. --connection master --let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1) --let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1) --let $statement_file=INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a --disable_warnings ONCE --eval $statement_file --let $assert_cond= COUNT(*) = 6 FROM t1 --let $assert_text= Count of elements in t1 should be 6. --source include/assert.inc # force outstanding executed transactions to be flushed to binlog for ndb --save_master_pos if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`) { --let $binlog_position_cmp= = --let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) { --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 3, 1\', Info, 1]\' LIKE \'%$statement_file\' --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } --source include/assert.inc # An insert duplicate that does not update anything must be written to the binary # log in SBR and MIXED modes. We check this property by summing a before and after # the update and comparing the binlog positions. The sum should be the same at both # points and the statement should be in the binary log. --disable_warnings DROP TABLE t1; DROP TABLE t2; --enable_warnings eval CREATE TABLE t1 ( a INT UNSIGNED NOT NULL PRIMARY KEY ) ENGINE=$engine_type; eval CREATE TABLE t2 ( a INT UNSIGNED ) ENGINE=$engine_type; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); # force outstanding executed transactions to be flushed to binlog for ndb --save_master_pos --let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1) --let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1) --let $statement_file=INSERT INTO t1 SELECT t2.a FROM t2 ORDER BY t2.a ON DUPLICATE KEY UPDATE t1.a= t1.a --disable_warnings ONCE --eval $statement_file --let $assert_cond= SUM(a) = 1 FROM t1 --let $assert_text= Sum of elements in t1 should be 1. --source include/assert.inc # force outstanding executed transactions to be flushed to binlog for ndb --save_master_pos if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`) { --let $binlog_position_cmp= = --let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) { --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\' --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } --source include/assert.inc # Clean up --connection master drop table t1, t2; --source include/sync_slave_sql_with_master.inc