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

Wrong position for row_start, row_end after adding column to implicit versioned table

    XMLWordPrintable

    Details

      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
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              aponzo Andrea Ponzo
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.