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

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

            aponzo Andrea Ponzo (Inactive) created issue -
            midenok Aleksey Midenkov made changes -
            Field Original Value New Value
            Assignee Aleksey Midenkov [ midenok ]
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            Description Hello,
            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:


            {code:java}
            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 */


            {code}

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


            {code:java}
            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

            {code}

            performing new INSERT we are facing this error:


            {code:java}
            cannot be converted from type 'timestamp' to type 'int(11)'
            {code}


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



            {code:java}
            MASTER FRM: �id�spend�row_start�row_end�newcol
             
            SLAVE FRM: �id�spend�newcol�row_start�row_end
            {code}
            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:


            {code:java}
            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 */


            {code}

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


            {code:java}
            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

            {code}

            performing new INSERT we are facing this error:


            {code:java}
            cannot be converted from type 'timestamp' to type 'int(11)'
            {code}


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



            {code:java}
            MASTER FRM: �id�spend�row_start�row_end�newcol
             
            SLAVE FRM: �id�spend�newcol�row_start�row_end
            {code}
            midenok Aleksey Midenkov made changes -
            Component/s Replication [ 10100 ]
            Component/s Scripts & Clients [ 11002 ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.5 [ 23123 ]
            midenok Aleksey Midenkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            midenok Aleksey Midenkov made changes -
            Summary SYSTEM VERSIONED Table - Wrong position for row_start,row_end column on Binlog after adding new column Wrong position for row_start, row_end after adding column to implicit versioned table

            Please review bb-10.3-midenok

            midenok Aleksey Midenkov added a comment - Please review bb-10.3-midenok
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Nikita Malyavin [ nikitamalyavin ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            midenok Aleksey Midenkov made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            midenok Aleksey Midenkov made changes -
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.3.35 [ 27512 ]
            Fix Version/s 10.4.25 [ 27510 ]
            Fix Version/s 10.5.16 [ 27508 ]
            Fix Version/s 10.6.8 [ 27506 ]
            Fix Version/s 10.7.4 [ 27504 ]
            Fix Version/s 10.8.3 [ 27502 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]

            People

              midenok Aleksey Midenkov
              aponzo Andrea Ponzo (Inactive)
              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.