Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31297

Create table as select on system versioned tables do not work consistently on replication

Details

    Description

      How to repeat:

      CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i;
      

      mtr-testcase attached and logs from mtr:

      an@jan-HP-ZBook-15u-G5:~/work/mariadb/10.4/mysql-test$ ./mtr rpl.jan
      Logging: ./mtr  rpl.jan
      VS config: 
      vardir: /home/jan/work/mariadb/10.4/mysql-test/var
      Checking leftover processes...
      Removing old var directory...
      Creating var directory '/home/jan/work/mariadb/10.4/mysql-test/var'...
      Checking supported features...
      MariaDB Version 10.4.30-MariaDB-debug
       - SSL connections supported
       - binaries are debug compiled
       - binaries built with wsrep patch
      Collecting tests...
      Installing system database...
       
      ==============================================================================
       
      TEST                                      RESULT   TIME (ms) or COMMENT
      --------------------------------------------------------------------------
       
      worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
      include/rpl_init.inc [topology=1->2]
      include/rpl_connect.inc [creating master]
      include/rpl_connect.inc [creating slave]
      connection master;
      connection master;
      CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i;
      SHOW CREATE TABLE t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `i` int(1) NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
      SELECT * from t;
      i
      1
      connection slave;
      SHOW CREATE TABLE t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `i` int(1) NOT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
      SELECT * from t;
      i
      connection master;
      DROP TABLE IF EXISTS t;
      include/rpl_end.inc
       
      ############################## server_2 ##############################
       
      **** SHOW WARNINGS on server_2 ****
      SHOW WARNINGS;
      Level	Code	Message
       
      **** SELECT replication-related variables on server_2 ****
      SELECT NOW(), @@SERVER_ID;
      NOW()	@@SERVER_ID
      2023-05-17 13:26:00	2
       
      **** SHOW SLAVE STATUS on server_2 ****
      SHOW SLAVE STATUS;
      Slave_IO_State	Waiting for master to send event
      Master_Host	127.0.0.1
      Master_User	root
      Master_Port	16000
      Connect_Retry	1
      Master_Log_File	master-bin.000001
      Read_Master_Log_Pos	898
      Relay_Log_File	slave-relay-bin.000002
      Relay_Log_Pos	629
      Relay_Master_Log_File	master-bin.000001
      Slave_IO_Running	Yes
      Slave_SQL_Running	No
      Replicate_Do_DB	
      Replicate_Ignore_DB	
      Replicate_Do_Table	
      Replicate_Ignore_Table	
      Replicate_Wild_Do_Table	
      Replicate_Wild_Ignore_Table	
      Last_Errno	1677
      Last_Error	Column 0 of table 'test.t' cannot be converted from type 'timestamp' to type 'int(1)'
      Skip_Counter	0
      Exec_Master_Log_Pos	329
      Relay_Log_Space	1507
      Until_Condition	None
      Until_Log_File	
      Until_Log_Pos	0
      Master_SSL_Allowed	No
      Master_SSL_CA_File	
      Master_SSL_CA_Path	
      Master_SSL_Cert	
      Master_SSL_Cipher	
      Master_SSL_Key	
      Seconds_Behind_Master	NULL
      Master_SSL_Verify_Server_Cert	No
      Last_IO_Errno	0
      Last_IO_Error	
      Last_SQL_Errno	1677
      Last_SQL_Error	Column 0 of table 'test.t' cannot be converted from type 'timestamp' to type 'int(1)'
      Replicate_Ignore_Server_Ids	
      Master_Server_Id	1
      Master_SSL_Crl	
      Master_SSL_Crlpath	
      Using_Gtid	No
      Gtid_IO_Pos	
      Replicate_Do_Domain_Ids	
      Replicate_Ignore_Domain_Ids	
      Parallel_Mode	conservative
      SQL_Delay	0
      SQL_Remaining_Delay	NULL
      Slave_SQL_Running_State	
      Slave_DDL_Groups	1
      Slave_Non_Transactional_Groups	0
      Slave_Transactional_Groups	0
       
      **** SHOW MASTER STATUS on server_2 ****
      SHOW MASTER STATUS;
      File	slave-bin.000001
      Position	328
      Binlog_Do_DB	
      Binlog_Ignore_DB	
       
      **** SHOW SLAVE HOSTS on server_2 ****
      SHOW SLAVE HOSTS;
       
      **** SHOW PROCESSLIST on server_2 ****
      SHOW PROCESSLIST;
      Id	User	Host	db	Command	Time	State	Info	Progress
      1	system user		NULL	Daemon	NULL	InnoDB purge coordinator	NULL	0.000
      2	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
      4	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
      3	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
      5	system user		NULL	Daemon	NULL	InnoDB shutdown handler	NULL	0.000
      10	root	localhost:40740	test	Query	0	Init	SHOW PROCESSLIST	0.000
      11	root	localhost:40744	test	Sleep	0		NULL	0.000
      12	system user		NULL	Slave_IO	0	Waiting for master to send event	NULL	0.000
      14	root	localhost:40760	test	Sleep	0		NULL	0.000
       
      **** SHOW BINARY LOGS on server_2 ****
      SHOW BINARY LOGS;
      Log_name	File_size
      slave-bin.000001	328
       
      **** SHOW BINLOG EVENTS on server_2 ****
      binlog_name = 'slave-bin.000001'
      SHOW BINLOG EVENTS IN 'slave-bin.000001';
      Log_name	Pos	Event_type	Server_id	End_log_pos	Info
      slave-bin.000001	4	Format_desc	2	256	Server ver: 10.4.30-MariaDB-debug-log, Binlog ver: 4
      slave-bin.000001	256	Gtid_list	2	285	[]
      slave-bin.000001	285	Binlog_checkpoint	2	328	slave-bin.000001
       
      **** SHOW RELAYLOG EVENTS on server_2 ****
      relaylog_name = 'slave-relay-bin.000002'
      SHOW RELAYLOG EVENTS IN 'slave-relay-bin.000002';
      Log_name	Pos	Event_type	Server_id	End_log_pos	Info
      slave-relay-bin.000002	4	Format_desc	2	256	Server ver: 10.4.30-MariaDB-debug-log, Binlog ver: 4
      slave-relay-bin.000002	256	Rotate	1	0	master-bin.000001;pos=4
      slave-relay-bin.000002	304	Format_desc	1	256	Server ver: 10.4.30-MariaDB-debug-log, Binlog ver: 4
      slave-relay-bin.000002	556	Gtid_list	1	285	[]
      slave-relay-bin.000002	585	Binlog_checkpoint	1	329	master-bin.000001
      slave-relay-bin.000002	629	Gtid	1	371	BEGIN GTID 0-1-1
      slave-relay-bin.000002	671	Query	1	517	use `test`; CREATE TABLE `t` (
        `i` int(1) NOT NULL
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING
      slave-relay-bin.000002	817	Annotate_rows	1	608	CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i
      slave-relay-bin.000002	908	Table_map	1	656	table_id: 32 (test.t)
      slave-relay-bin.000002	956	Write_rows_v1	1	708	table_id: 32 flags: STMT_END_F
      slave-relay-bin.000002	1008	Xid	1	739	COMMIT /* xid=116 */
      slave-relay-bin.000002	1039	Gtid	1	781	GTID 0-1-2
      slave-relay-bin.000002	1081	Query	1	898	use `test`; DROP TABLE IF EXISTS `t` /* generated by server */
      connection server_1;
       
      ############################## server_1 ##############################
       
      **** SHOW WARNINGS on server_1 ****
      SHOW WARNINGS;
      Level	Code	Message
       
      **** SELECT replication-related variables on server_1 ****
      SELECT NOW(), @@SERVER_ID;
      NOW()	@@SERVER_ID
      2023-05-17 13:26:00	1
       
      **** SHOW SLAVE STATUS on server_1 ****
      SHOW SLAVE STATUS;
       
      **** SHOW MASTER STATUS on server_1 ****
      SHOW MASTER STATUS;
      File	master-bin.000001
      Position	898
      Binlog_Do_DB	
      Binlog_Ignore_DB	
       
      **** SHOW SLAVE HOSTS on server_1 ****
      SHOW SLAVE HOSTS;
      Server_id	2
      Host	127.0.0.1
      Port	16001
      Master_id	1
       
      **** SHOW PROCESSLIST on server_1 ****
      SHOW PROCESSLIST;
      Id	User	Host	db	Command	Time	State	Info	Progress
      2	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
      4	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
      1	system user		NULL	Daemon	NULL	InnoDB purge coordinator	NULL	0.000
      3	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
      5	system user		NULL	Daemon	NULL	InnoDB shutdown handler	NULL	0.000
      10	root	localhost	test	Sleep	0		NULL	0.000
      11	root	localhost:37200	test	Query	0	Init	SHOW PROCESSLIST	0.000
      12	root	localhost:37208	test	Sleep	0		NULL	0.000
      13	root	localhost:37218	NULL	Binlog Dump	0	Master has sent all binlog to slave; waiting for binlog to be updated	NULL	0.000
      14	root	localhost:37224	test	Sleep	0		NULL	0.000
       
      **** SHOW BINARY LOGS on server_1 ****
      SHOW BINARY LOGS;
      Log_name	File_size
      master-bin.000001	898
       
      **** SHOW BINLOG EVENTS on server_1 ****
      binlog_name = 'master-bin.000001'
      SHOW BINLOG EVENTS IN 'master-bin.000001';
      Log_name	Pos	Event_type	Server_id	End_log_pos	Info
      master-bin.000001	4	Format_desc	1	256	Server ver: 10.4.30-MariaDB-debug-log, Binlog ver: 4
      master-bin.000001	256	Gtid_list	1	285	[]
      master-bin.000001	285	Binlog_checkpoint	1	329	master-bin.000001
      master-bin.000001	329	Gtid	1	371	BEGIN GTID 0-1-1
      master-bin.000001	371	Query	1	517	use `test`; CREATE TABLE `t` (
        `i` int(1) NOT NULL
      ) ENGINE=InnoDB WITH SYSTEM VERSIONING
      master-bin.000001	517	Annotate_rows	1	608	CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i
      master-bin.000001	608	Table_map	1	656	table_id: 32 (test.t)
      master-bin.000001	656	Write_rows_v1	1	708	table_id: 32 flags: STMT_END_F
      master-bin.000001	708	Xid	1	739	COMMIT /* xid=116 */
      master-bin.000001	739	Gtid	1	781	GTID 0-1-2
      master-bin.000001	781	Query	1	898	use `test`; DROP TABLE IF EXISTS `t` /* generated by server */
       
      **** SHOW RELAYLOG EVENTS on server_1 ****
      relaylog_name = 'No such row'
      SHOW RELAYLOG EVENTS IN 'No such row';
      Log_name	Pos	Event_type	Server_id	End_log_pos	Info
      connection server_2;
      Wrong value for Last_SQL_Errno. Expected '0', got '1677'
      rpl.jan 'innodb,row'                     [ fail ]
              Test ended at 2023-05-17 13:26:01
       
      CURRENT_TEST: rpl.jan
      mysqltest: In included file "./include/check_slave_param.inc": 
      included from ./include/check_slave_no_error.inc at line 24:
      included from ./include/rpl_end.inc at line 74:
      included from /home/jan/work/mariadb/10.4/mysql-test/suite/rpl/t/jan.test at line 35:
      At line 31: Wrong value for slave parameter $slave_param
       
       - saving '/home/jan/work/mariadb/10.4/mysql-test/var/log/rpl.jan-innodb,row/' to '/home/jan/work/mariadb/10.4/mysql-test/var/log/rpl.jan-innodb,row/'
      --------------------------------------------------------------------------
      The servers were restarted 0 times
      Spent 0.000 of 5 seconds executing testcases
       
      Failure: Failed 1/1 tests, 0.00% were successful.
       
      Failing test(s): rpl.jan
      

      Attachments

        Activity

          Note that table is created on both master and slave but master has one row there whereas slave no rows (because write rows event failed).

          janlindstrom Jan Lindström added a comment - Note that table is created on both master and slave but master has one row there whereas slave no rows (because write rows event failed).
          Elkin Andrei Elkin added a comment -

          nikitamalyavin, howdy! Only if you have time and interests in this one - please look into. Otherwise bounce it back. Thank you!

          Elkin Andrei Elkin added a comment - nikitamalyavin , howdy! Only if you have time and interests in this one - please look into. Otherwise bounce it back. Thank you!

          The best person to refer to for system versioning is midenok.

          nikitamalyavin Nikita Malyavin added a comment - The best person to refer to for system versioning is midenok .

          Please review bb-10.5-midenok

          midenok Aleksey Midenkov added a comment - Please review bb-10.5-midenok

          Commit fee0a905137 looks good to me. Ok to push

          nikitamalyavin Nikita Malyavin added a comment - Commit fee0a905137 looks good to me. Ok to push

          People

            midenok Aleksey Midenkov
            janlindstrom Jan Lindström
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.