Commit 2cae58f8 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause.

m_file[0] not always is a good sample.
parent 73aa31fb
...@@ -1888,4 +1888,22 @@ ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ...@@ -1888,4 +1888,22 @@ ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0); SELECT * FROM t1 PARTITION (p0);
i i
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1;
#
# MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause.
#
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=InnoDB PARTITION BY KEY(b) PARTITIONS 4;
INSERT INTO t1 VALUES (3,0),(8,2),(7,8),(3,4),(2,4),(0,7),(4,3),(3,6);
FLUSH TABLES;
UPDATE t1 PARTITION (p3,p1) SET a = 2 WHERE a = 3;
SELECT * FROM t1;
a b
2 0
7 8
2 4
2 4
0 7
4 3
8 2
2 6
DROP TABLE t1, t2; DROP TABLE t1, t2;
...@@ -874,6 +874,18 @@ SELECT * FROM t1 PARTITION (p0); ...@@ -874,6 +874,18 @@ SELECT * FROM t1 PARTITION (p0);
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
SELECT * FROM t1 PARTITION (p0); SELECT * FROM t1 PARTITION (p0);
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1;
--echo #
--echo # MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause.
--echo #
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=InnoDB PARTITION BY KEY(b) PARTITIONS 4;
INSERT INTO t1 VALUES (3,0),(8,2),(7,8),(3,4),(2,4),(0,7),(4,3),(3,6);
FLUSH TABLES;
UPDATE t1 PARTITION (p3,p1) SET a = 2 WHERE a = 3;
SELECT * FROM t1;
# Cleanup # Cleanup
DROP TABLE t1, t2; DROP TABLE t1, t2;
...@@ -5580,8 +5580,9 @@ extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2) ...@@ -5580,8 +5580,9 @@ extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2)
{ {
return res; return res;
} }
if ((res= file->m_file[0]->cmp_ref(ref1 + PARTITION_BYTES_IN_POS + file->m_rec_length, if ((res= file->get_open_file_sample()->cmp_ref(ref1 +
ref2 + PARTITION_BYTES_IN_POS + file->m_rec_length))) PARTITION_BYTES_IN_POS + file->m_rec_length,
ref2 + PARTITION_BYTES_IN_POS + file->m_rec_length)))
{ {
return res; return res;
} }
...@@ -9577,7 +9578,7 @@ uint8 ha_partition::table_cache_type() ...@@ -9577,7 +9578,7 @@ uint8 ha_partition::table_cache_type()
{ {
DBUG_ENTER("ha_partition::table_cache_type"); DBUG_ENTER("ha_partition::table_cache_type");
DBUG_RETURN(m_file[0]->table_cache_type()); DBUG_RETURN(get_open_file_sample()->table_cache_type());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment