Commit f533b2b4 authored by Nirbhay Choubey's avatar Nirbhay Choubey

Merge branch '5.5-galera' into 10.0-galera

parents c6a0cbda 472d6632
......@@ -11,6 +11,10 @@
# Don't write these queries to binlog
set SQL_LOG_BIN=0;
# Do not replicate updates to other galera nodes
--error 0,1193
set WSREP_ON=0;
# Turn off any debug crashes, allow the variable to be
# non existent in release builds
--error 0,1193
......
......@@ -101,4 +101,40 @@ t1 CREATE TABLE `t1` (
(PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
DROP TABLE t1, p1;
#
# MDEV-5146: Bulk loads into partitioned table not working
#
# Case 1: wsrep_load_data_splitting = ON & LOAD DATA with 20002
# entries.
SET GLOBAL wsrep_load_data_splitting = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
SELECT COUNT(*) = 20002 FROM t1;
COUNT(*) = 20002
1
wsrep_last_committed_diff
1
DROP TABLE t1;
# Case 2: wsrep_load_data_splitting = ON & LOAD DATA with 101 entries.
SET GLOBAL wsrep_load_data_splitting = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
SELECT COUNT(*) = 101 FROM t1;
COUNT(*) = 101
1
wsrep_last_committed_diff
1
DROP TABLE t1;
# Case 3: wsrep_load_data_splitting = OFF & LOAD DATA with 20002
# entries.
SET GLOBAL wsrep_load_data_splitting = OFF;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
SELECT COUNT(*) = 20002 FROM t1;
COUNT(*) = 20002
1
wsrep_last_committed_diff
1
DROP TABLE t1;
SET GLOBAL wsrep_load_data_splitting = 1;;
# End of test
......@@ -90,5 +90,118 @@ SHOW CREATE TABLE t1;
# Cleanup
DROP TABLE t1, p1;
--echo #
--echo # MDEV-5146: Bulk loads into partitioned table not working
--echo #
# Create 2 files with 20002 & 101 entries in each.
--perl
open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/mdev-5146-1.dat") or die;
foreach my $i (1..20002) {
print FILE "$i\n";
}
open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/mdev-5146-2.dat") or die;
foreach my $i (1..101) {
print FILE "$i\n";
}
EOF
--connection node_1
--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting`
--echo # Case 1: wsrep_load_data_splitting = ON & LOAD DATA with 20002
--echo # entries.
SET GLOBAL wsrep_load_data_splitting = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
# Record wsrep_last_committed as it was before LOAD DATA
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--disable_query_log
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-5146-1.dat' INTO TABLE t1;
--enable_query_log
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_2
SELECT COUNT(*) = 20002 FROM t1;
# LOAD-ing 20002 rows causes 3 commits to be registered
--disable_query_log
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 3 AS wsrep_last_committed_diff;
--enable_query_log
DROP TABLE t1;
--echo # Case 2: wsrep_load_data_splitting = ON & LOAD DATA with 101 entries.
--connection node_1
SET GLOBAL wsrep_load_data_splitting = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
# Record wsrep_last_committed as it was before LOAD DATA
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--disable_query_log
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-5146-2.dat' INTO TABLE t1;
--enable_query_log
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_2
SELECT COUNT(*) = 101 FROM t1;
# LOAD-ing 101 rows causes 1 commit to be registered
--disable_query_log
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
--enable_query_log
DROP TABLE t1;
--echo # Case 3: wsrep_load_data_splitting = OFF & LOAD DATA with 20002
--echo # entries.
--connection node_1
SET GLOBAL wsrep_load_data_splitting = OFF;
CREATE TABLE t1 (pk INT PRIMARY KEY)
ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
# Record wsrep_last_committed as it was before LOAD DATA
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--disable_query_log
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/mdev-5146-1.dat' INTO TABLE t1;
--enable_query_log
--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
--connection node_2
SELECT COUNT(*) = 20002 FROM t1;
# LOAD-ing 20002 rows causes 1 commit to be registered
--disable_query_log
--eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before + 1 AS wsrep_last_committed_diff;
--enable_query_log
DROP TABLE t1;
--connection node_1
# Restore the original value
--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig;
# Cleanup
remove_file '$MYSQLTEST_VARDIR/tmp/mdev-5146-1.dat';
remove_file '$MYSQLTEST_VARDIR/tmp/mdev-5146-2.dat';
--source include/galera_end.inc
--echo # End of test
......@@ -25,8 +25,8 @@ return "No my_print_defaults" unless $epath;
push @::global_suppressions,
(
qr(WSREP: Could not open saved state file for reading: ),
qr(WSREP: option --wsrep-casual-reads is deprecated),
qr(WSREP: --wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=0),
qr(WSREP: option --wsrep-causal-reads is deprecated),
qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0),
qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
);
......
......@@ -9676,10 +9676,10 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
}
if (global_system_variables.wsrep_causal_reads) {
WSREP_WARN("option --wsrep-casual-reads is deprecated");
WSREP_WARN("option --wsrep-causal-reads is deprecated");
if (!(global_system_variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ)) {
WSREP_WARN("--wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=%u. "
WSREP_WARN("--wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=%u. "
"WSREP_SYNC_WAIT_BEFORE_READ is on",
global_system_variables.wsrep_sync_wait);
global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
......
......@@ -7483,10 +7483,11 @@ no_commit:
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) && wsrep_load_data_splitting &&
if (wsrep_on(user_thd) &&
wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
!thd_test_options(
user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
......@@ -7514,10 +7515,11 @@ no_commit:
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) && wsrep_load_data_splitting &&
if (wsrep_on(user_thd) &&
wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
!thd_test_options(
user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
......@@ -7739,14 +7741,15 @@ report_error:
user_thd);
#ifdef WITH_WSREP
if (!error_result && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd) && !wsrep_consistency_check(user_thd) &&
(sql_command != SQLCOM_LOAD ||
thd_binlog_format(user_thd) == BINLOG_FORMAT_ROW)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
if (!error_result &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd) &&
!wsrep_consistency_check(user_thd))
{
if (wsrep_append_keys(user_thd, false, record, NULL))
{
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
}
}
......
......@@ -8055,10 +8055,11 @@ no_commit:
;
} else if (src_table == prebuilt->table) {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) && wsrep_load_data_splitting &&
if (wsrep_on(user_thd) &&
wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
!thd_test_options(
user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
......@@ -8086,10 +8087,11 @@ no_commit:
prebuilt->sql_stat_start = TRUE;
} else {
#ifdef WITH_WSREP
if (wsrep_on(user_thd) && wsrep_load_data_splitting &&
if (wsrep_on(user_thd) &&
wsrep_load_data_splitting &&
sql_command == SQLCOM_LOAD &&
!thd_test_options(
user_thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
!thd_test_options(user_thd,
OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
switch (wsrep_run_wsrep_commit(user_thd, wsrep_hton, 1))
{
......@@ -8320,14 +8322,15 @@ report_error:
user_thd);
#ifdef WITH_WSREP
if (!error_result && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd) && !wsrep_consistency_check(user_thd) &&
(sql_command != SQLCOM_LOAD ||
thd_binlog_format(user_thd) == BINLOG_FORMAT_ROW)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) {
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
if (!error_result &&
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd) &&
!wsrep_consistency_check(user_thd))
{
if (wsrep_append_keys(user_thd, false, record, NULL))
{
DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error;
}
}
......
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