Skip to content

Commit

Permalink
Backport partition tests from 10.0-galera.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirbhay Choubey committed Aug 20, 2015
1 parent 98bebad commit ccd39b2
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL wsrep_load_data_splitting = TRUE;
SELECT COUNT(*) = 95000 FROM t1;
COUNT(*) = 95000
1
wsrep_last_committed_diff
1
SET GLOBAL wsrep_load_data_splitting = 1;;
DROP TABLE t1;
23 changes: 23 additions & 0 deletions mysql-test/suite/galera/r/partition.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# MDEV#4953 Galera: DELETE from a partitioned table is not replicated
#
USE test;
CREATE TABLE t1 (pk INT PRIMARY KEY, i INT) ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
INSERT INTO t1 VALUES (1,100), (2,200);
SELECT * FROM t1;
pk i
2 200
1 100
DELETE FROM t1;
SELECT * FROM t1;
pk i

# On node_1
SELECT * FROM t1;
pk i

# On node_2
SELECT * FROM t1;
pk i
DROP TABLE t1;
# End of test
38 changes: 38 additions & 0 deletions mysql-test/suite/galera/t/galera_var_load_data_splitting.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc

--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting`

# Create a file for LOAD DATA with 95K entries
--perl
open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_var_load_data_splitting.csv") or die;
foreach my $i (1..95000) {
print FILE "$i\n";
}
EOF

CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;

# Record wsrep_last_committed as it was before LOAD DATA
--connection node_2
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`

SET GLOBAL wsrep_load_data_splitting = TRUE;
--disable_query_log
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_var_load_data_splitting.csv' INTO TABLE t1;
--enable_query_log

--connection node_2
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`

SELECT COUNT(*) = 95000 FROM t1;

# LOAD-ing 95K rows causes 10 commits to be registered
--disable_query_log
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 10 AS wsrep_last_committed_diff;
--enable_query_log

--connection node_1
--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig;

DROP TABLE t1;
31 changes: 31 additions & 0 deletions mysql-test/suite/galera/t/partition.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_partition.inc

--echo #
--echo # MDEV#4953 Galera: DELETE from a partitioned table is not replicated
--echo #

USE test;
CREATE TABLE t1 (pk INT PRIMARY KEY, i INT) ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
INSERT INTO t1 VALUES (1,100), (2,200);
SELECT * FROM t1;

DELETE FROM t1;
SELECT * FROM t1;

--echo
--echo # On node_1
--connection node_1
SELECT * FROM t1;

--echo
--echo # On node_2
--connection node_2
SELECT * FROM t1;

# Cleanup
DROP TABLE t1;

--source include/galera_end.inc
--echo # End of test

0 comments on commit ccd39b2

Please sign in to comment.