summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2018-07-16 15:35:16 +0300
committerVladislav Vaintroub <wlad@mariadb.com>2018-09-10 19:30:06 +0200
commite43bc02e7b2752f0deb88cd1edc24d827e01dca9 (patch)
tree21859243568f737b6255e2dc9e9bed9695e17d13
parentff34436a2ecc30a177cb304fd1dce928d8709f45 (diff)
downloadmariadb-git-e43bc02e7b2752f0deb88cd1edc24d827e01dca9.tar.gz
MDEV-16741 Assertion `m_extra_cache' failed in ha_partition::late_extra_cache
multi_delete sets TABLE::no_cache=1 and should set it to 0 when DELETE is done.
-rw-r--r--mysql-test/suite/parts/r/update_and_cache.result7
-rw-r--r--mysql-test/suite/parts/t/update_and_cache.test12
-rw-r--r--sql/sql_delete.cc1
-rw-r--r--sql/sql_update.cc2
4 files changed, 21 insertions, 1 deletions
diff --git a/mysql-test/suite/parts/r/update_and_cache.result b/mysql-test/suite/parts/r/update_and_cache.result
new file mode 100644
index 00000000000..52f13e66702
--- /dev/null
+++ b/mysql-test/suite/parts/r/update_and_cache.result
@@ -0,0 +1,7 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, a INT);
+INSERT INTO t1 VALUES (1,10),(2,20);
+CREATE TABLE t2 (b INT) PARTITION BY KEY (b) PARTITIONS 2;
+INSERT INTO t2 VALUES (1),(2);
+DELETE t2 FROM t2 WHERE b BETWEEN 5 AND 9;
+UPDATE t2 JOIN t1 SET b = 5;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/parts/t/update_and_cache.test b/mysql-test/suite/parts/t/update_and_cache.test
new file mode 100644
index 00000000000..08ade807422
--- /dev/null
+++ b/mysql-test/suite/parts/t/update_and_cache.test
@@ -0,0 +1,12 @@
+--source include/have_partition.inc
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, a INT);
+INSERT INTO t1 VALUES (1,10),(2,20);
+
+CREATE TABLE t2 (b INT) PARTITION BY KEY (b) PARTITIONS 2;
+INSERT INTO t2 VALUES (1),(2);
+
+DELETE t2 FROM t2 WHERE b BETWEEN 5 AND 9;
+UPDATE t2 JOIN t1 SET b = 5;
+
+DROP TABLE t1, t2;
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 8aca415a9d0..cdd7350cb0c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -744,6 +744,7 @@ multi_delete::~multi_delete()
{
TABLE *table= table_being_deleted->table;
table->no_keyread=0;
+ table->no_cache= 0;
}
for (uint counter= 0; counter < num_of_tables; counter++)
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index e42f6a4ff76..fe007d5823d 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1868,7 +1868,7 @@ multi_update::~multi_update()
TABLE_LIST *table;
for (table= update_tables ; table; table= table->next_local)
{
- table->table->no_keyread= table->table->no_cache= 0;
+ table->table->no_keyread= 0;
if (ignore)
table->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
}