Skip to content

Commit 0172887

Browse files
janlindstromsysprg
authored andcommitted
MDEV-34269 : 10.11.8 cluster becomes inconsistent when using composite primary key and partitioning
This is regression from commit 3228c08. Problem is that when table storage engine is determined there should be check is table partitioned and if it is then determine partition implementing storage engine. Reported bug is reproducible only with --log-bin so make sure tests changed by 3228c08 and new test are run with --log-bin and binlog disabled. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
1 parent e255837 commit 0172887

File tree

8 files changed

+114
-2
lines changed

8 files changed

+114
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[binlogoff]
2+
3+
[binlogon]
4+
log-bin

mysql-test/include/log_bin.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# include file for test files that can be run with and without log-bin
2+
# (see include/log_bin.combinations)
3+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
connection node_2;
2+
connection node_1;
3+
connection node_1;
4+
CREATE TABLE `t1` (
5+
`id` int(10) unsigned NOT NULL,
6+
`other_id` int(10) unsigned NOT NULL,
7+
PRIMARY KEY (`id`,`other_id`)
8+
) ENGINE=InnoDB
9+
PARTITION BY LIST (`id` MOD 2)
10+
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
11+
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
12+
INSERT INTO t1 VALUES (1, 0);
13+
CREATE TABLE t2 LIKE t1;
14+
START TRANSACTION;
15+
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
16+
DELETE FROM t1 WHERE id = 1;
17+
COMMIT;
18+
connection node_2;
19+
SELECT * from t1;
20+
id other_id
21+
SELECT * from t2;
22+
id other_id
23+
1 0
24+
DROP TABLE t1, t2;
25+
connection node_1;
26+
CREATE TABLE `t1` (
27+
`id` int(10) unsigned NOT NULL,
28+
`other_id` int(10) unsigned NOT NULL,
29+
PRIMARY KEY (`id`)
30+
) ENGINE=InnoDB
31+
PARTITION BY LIST (`id` MOD 2)
32+
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
33+
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
34+
INSERT INTO t1 VALUES (1, 0);
35+
CREATE TABLE t2 LIKE t1;
36+
START TRANSACTION;
37+
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
38+
DELETE FROM t1 WHERE id = 1;
39+
COMMIT;
40+
connection node_2;
41+
SELECT * from t1;
42+
id other_id
43+
SELECT * from t2;
44+
id other_id
45+
1 0
46+
DROP TABLE t1, t2;

mysql-test/suite/galera/t/galera_myisam_autocommit.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
--source include/galera_cluster.inc
22
--source include/have_innodb.inc
3+
--source include/log_bin.inc
34

45
#
56
# This tests simple autocommit replication of MyISAM tables.

mysql-test/suite/galera/t/galera_partition.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
--source include/have_partition.inc
33
--source include/big_test.inc
44
--source include/force_restart.inc
5+
--source include/log_bin.inc
56

67
--connection node_1
78

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
--source include/galera_cluster.inc
2+
--source include/have_partition.inc
3+
--source include/log_bin.inc
4+
5+
--connection node_1
6+
CREATE TABLE `t1` (
7+
`id` int(10) unsigned NOT NULL,
8+
`other_id` int(10) unsigned NOT NULL,
9+
PRIMARY KEY (`id`,`other_id`)
10+
) ENGINE=InnoDB
11+
PARTITION BY LIST (`id` MOD 2)
12+
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
13+
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
14+
15+
INSERT INTO t1 VALUES (1, 0);
16+
17+
CREATE TABLE t2 LIKE t1;
18+
19+
START TRANSACTION;
20+
21+
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
22+
DELETE FROM t1 WHERE id = 1;
23+
24+
COMMIT;
25+
26+
--connection node_2
27+
SELECT * from t1;
28+
SELECT * from t2;
29+
DROP TABLE t1, t2;
30+
31+
--connection node_1
32+
CREATE TABLE `t1` (
33+
`id` int(10) unsigned NOT NULL,
34+
`other_id` int(10) unsigned NOT NULL,
35+
PRIMARY KEY (`id`)
36+
) ENGINE=InnoDB
37+
PARTITION BY LIST (`id` MOD 2)
38+
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
39+
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
40+
41+
INSERT INTO t1 VALUES (1, 0);
42+
43+
CREATE TABLE t2 LIKE t1;
44+
45+
START TRANSACTION;
46+
47+
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
48+
DELETE FROM t1 WHERE id = 1;
49+
50+
COMMIT;
51+
52+
--connection node_2
53+
SELECT * from t1;
54+
SELECT * from t2;
55+
DROP TABLE t1, t2;

mysql-test/suite/galera/t/mdev-22063.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--source include/galera_cluster.inc
22
--source include/have_innodb.inc
3-
--source include/have_log_bin.inc
3+
--source include/log_bin.inc
44
--source include/have_sequence.inc
55
--source include/have_aria.inc
66

sql/sql_parse.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4747,7 +4747,9 @@ mysql_execute_command(THD *thd)
47474747
#ifdef WITH_WSREP
47484748
if (wsrep && !first_table->view)
47494749
{
4750-
bool is_innodb= (first_table->table->file->ht->db_type == DB_TYPE_INNODB);
4750+
const handlerton *hton = first_table->table->file->partition_ht() ?
4751+
first_table->table->file->partition_ht() : first_table->table->file->ht;
4752+
bool is_innodb= (hton->db_type == DB_TYPE_INNODB);
47514753

47524754
// For consistency check inserted table needs to be InnoDB
47534755
if (!is_innodb && thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK)

0 commit comments

Comments
 (0)