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

Test multi_update_innodb fails with InnoDB 5.7

Details

    Description

      Required code currently on bb-10.2-jan (please wait for email about status):

      main.multi_update_innodb 'xtradb'        [ fail ]
              Test ended at 2016-08-12 08:38:53
       
      CURRENT_TEST: main.multi_update_innodb
      mysqltest: At line 19: query 'UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2' failed with wrong errno 1032: 'Can't find record in 't1'', instead of 1706...
       
      The result from queries just before the failure was:
      #
      # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
      #            table is updated twice
      #
      CREATE TABLE t1(
      pk INT,
      a INT,
      b INT,
      PRIMARY KEY (pk)
      ) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (0,0,0);
      UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
      

      Attachments

        Issue Links

          Activity

            Ok the test file says it expects the statement to fail with an error

            INSERT INTO t1 VALUES (0,0,0);
            --error ER_MULTI_UPDATE_KEY_CONFLICT
            UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
            SELECT * FROM t1;
            

            It just must be a different error.
            ER_MULTI_UPDATE_KEY_CONFLICT is produced in unsafe_key_update(), but it doesn't produce the error in the tree.

            The reason is simple. Stopping at this line

                  bool primkey_clustered= (table1->file->primary_key_is_clustered() &&
                                           table1->s->primary_key != MAX_KEY);
            

            I have:

            (gdb) p table1->file->primary_key_is_clustered()
              $10 = false
            (gdb) p table1->s->primary_key
              $12 = 0
            

            $10 should be TRUE, not FALSE.

            psergei Sergei Petrunia added a comment - Ok the test file says it expects the statement to fail with an error INSERT INTO t1 VALUES (0,0,0); --error ER_MULTI_UPDATE_KEY_CONFLICT UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2; SELECT * FROM t1; It just must be a different error. ER_MULTI_UPDATE_KEY_CONFLICT is produced in unsafe_key_update(), but it doesn't produce the error in the tree. The reason is simple. Stopping at this line bool primkey_clustered= (table1->file->primary_key_is_clustered() && table1->s->primary_key != MAX_KEY); I have: (gdb) p table1->file->primary_key_is_clustered() $10 = false (gdb) p table1->s->primary_key $12 = 0 $10 should be TRUE, not FALSE.

            Stepping in, I find that it uses the default implementation:

              #0  handler::primary_key_is_clustered (this=0x7fff7c023b48) at /home/psergey/dev-git/10.2-fix-innodb/sql/handler.h:3548
            

            However there is a

            bool
            ha_innobase::primary_key_is_clustered() const
            /*=========================================*/
            {
            	return(true);
            }
            

            it's just not used.

            psergei Sergei Petrunia added a comment - Stepping in, I find that it uses the default implementation: #0 handler::primary_key_is_clustered (this=0x7fff7c023b48) at /home/psergey/dev-git/10.2-fix-innodb/sql/handler.h:3548 However there is a bool ha_innobase::primary_key_is_clustered() const /*=========================================*/ { return(true); } it's just not used.

            Fix pushed to bb-10.2-jan tree.

            psergei Sergei Petrunia added a comment - Fix pushed to bb-10.2-jan tree.

            People

              psergei Sergei Petrunia
              jplindst Jan Lindström (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.