[MDEV-28254] Wrong position for row_start, row_end after adding column to implicit versioned table Created: 2022-04-07  Updated: 2022-04-22  Resolved: 2022-04-22

Status: Closed
Project: MariaDB Server
Component/s: Replication, Scripts & Clients, Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: 10.3.35, 10.4.25, 10.5.16, 10.6.8, 10.7.4, 10.8.3

Type: Bug Priority: Major
Reporter: Andrea Ponzo (Inactive) Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-16355 Add option for mysqldump to read data... Closed

 Description   

After adding new column on a SYSTEM VERSIONED Table, the column positions for row_start and rows_end are not updated.

Here the use case:

CREATE TABLE `andreversion` (
  `id` bigint(20) unsigned NOT NULL,
   `spend` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 WITH SYSTEM VERSIONING;
Query OK, 0 rows affected (0.008 sec)
 
 
 
MariaDB [andre]> insert into andreversion values (77,'90.5');
Query OK, 1 row affected (0.000 sec)
 
BINLOG:
### INSERT INTO `andre`.`andreversion`
### SET
###   @1=77 /* LONGINT meta=0 nullable=0 is_null=0 */
###   @2=90.50 /* DECIMAL(10,2) meta=2562 nullable=0 is_null=0 */
###   @3=1649141510.442272 /* TIMESTAMP(6) meta=6 nullable=0 is_null=0 */
###   @4=2147483647.999999 /* TIMESTAMP(6) meta=6 nullable=0 is_null=0 */
 
 
 
MariaDB [andre]> set session system_versioning_alter_history=KEEP;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [andre]> alter table andreversion add column newcol int ;
Query OK, 0 rows affected (0.002 sec)
Records: 0  Duplicates: 0  Warnings: 0
 
 
MariaDB [andre]> insert into andreversion values (2,'20.5',8);
Query OK, 1 row affected (0.000 sec)
 
Binlog:
 
### INSERT INTO `andre`.`andreversion`
### SET
###   @1=2 /* LONGINT meta=0 nullable=0 is_null=0 */
###   @2=20.50 /* DECIMAL(10,2) meta=2562 nullable=0 is_null=0 */
###   @3=1649141654.094756 /* TIMESTAMP(6) meta=6 nullable=0 is_null=0 */
###   @4=2147483647.999999 /* TIMESTAMP(6) meta=6 nullable=0 is_null=0 */
###   @5=8 /* INT meta=0 nullable=1 is_null=0 */
 

When we are going to create a Replica server from logical dump

CREATE TABLE `andreversion` (
  `id` bigint(20) unsigned NOT NULL,
  `spend` decimal(10,2) NOT NULL,
  `newcol` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 WITH SYSTEM VERSIONING

performing new INSERT we are facing this error:

cannot be converted from type 'timestamp' to type 'int(11)'

Also checking the FRM file we can have the evidence that the order columns is different.

MASTER FRM: �id�spend�row_start�row_end�newcol
 
SLAVE FRM:  �id�spend�newcol�row_start�row_end



 Comments   
Comment by Aleksey Midenkov [ 2022-04-18 ]

Please review bb-10.3-midenok

Generated at Thu Feb 08 09:59:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.