[MDEV-10547] Test multi_update_innodb fails with InnoDB 5.7 Created: 2016-08-12  Updated: 2016-09-02  Resolved: 2016-08-12

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Jan Lindström (Inactive) Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-10024 Fix test failures on InnoDB 5.7 in Ma... Closed

 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;



 Comments   
Comment by Sergei Petrunia [ 2016-08-12 ]

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.

Comment by Sergei Petrunia [ 2016-08-12 ]

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.

Comment by Sergei Petrunia [ 2016-08-12 ]

Fix pushed to bb-10.2-jan tree.

Generated at Thu Feb 08 07:43:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.