[Commits] e9a7c9e28c8: MDEV-11167: InnoDB: Warning: using a partial-field key prefix in search, results in assertion failure or "Can't find record" error
revision-id: e9a7c9e28c8f28447a29c59585d08f88ce0772db (mariadb-10.1.35-40-ge9a7c9e28c8) parent(s): 62dbf4f18d47a1e26f5fd7a0d6683494fb203a44 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-11-02 17:54:35 +0100 message: MDEV-11167: InnoDB: Warning: using a partial-field key prefix in search, results in assertion failure or "Can't find record" error Fix ha_rnd_init() argument (we do not doing scan but use rnd_pos) --- mysql-test/r/partition_innodb.result | 26 ++++++++++++++++++++++++++ mysql-test/t/partition_innodb.test | 30 ++++++++++++++++++++++++++++++ sql/sql_update.cc | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index b322d63a7e1..e08ee24bb69 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -892,3 +892,29 @@ ERROR HY000: Table definition has changed, please retry transaction SELECT b FROM t1 WHERE b = 0; ERROR HY000: Table definition has changed, please retry transaction DROP TABLE t1; +# +# MDEV-11167: InnoDB: Warning: using a partial-field key prefix +# in search, results in assertion failure or "Can't find record" error +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2; +CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION; +INSERT INTO t1 VALUES (1),(2); +INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4); +Warnings: +Warning 1366 Incorrect integer value: 'three' for column 'b' at row 2 +UPDATE v SET a = NULL ORDER BY a, b; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'foo' +DROP view v; +DROP TABLE t1, t2; +SET @save_isp=@@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2; +INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66); +CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION; +UPDATE v SET f2 = NULL; +ERROR HY000: CHECK OPTION failed 'test.v' +SET GLOBAL innodb_stats_persistent= @save_isp; +DROP view v; +DROP TABLE t; diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 00af34f9d26..c6a94d17c04 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -998,3 +998,33 @@ SELECT b FROM t1 WHERE b = 0; SELECT b FROM t1 WHERE b = 0; --disconnect con1 DROP TABLE t1; + +--echo # +--echo # MDEV-11167: InnoDB: Warning: using a partial-field key prefix +--echo # in search, results in assertion failure or "Can't find record" error +--echo # + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2; +CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION; + +INSERT INTO t1 VALUES (1),(2); +INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4); +UPDATE v SET a = NULL ORDER BY a, b; + +DROP view v; +DROP TABLE t1, t2; + +SET @save_isp=@@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= ON; + +CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2; +INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66); +CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION; +--error ER_VIEW_CHECK_FAILED +UPDATE v SET f2 = NULL; + +SET GLOBAL innodb_stats_persistent= @save_isp; +DROP view v; +DROP TABLE t; + diff --git a/sql/sql_update.cc b/sql/sql_update.cc index db9f9013188..5df3f3db784 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2347,7 +2347,7 @@ int multi_update::do_updates() check_opt_it.rewind(); while(TABLE *tbl= check_opt_it++) { - if ((local_error= tbl->file->ha_rnd_init(1))) + if ((local_error= tbl->file->ha_rnd_init(0))) { err_table= tbl; goto err;
participants (1)
-
Oleksandr Byelkin