mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MW-269 Fix outstanding issues with wsrep_max_ws_rows
This patch includes two fixes: 1) Rollback when wsrep_max_ws_rows is exceeded would not switch back to previous autocommit mode; and 2) Internal rows counter would not be reset on implicit commits.
This commit is contained in:
committed by
Nirbhay Choubey
parent
e373f60fd1
commit
5197fcf6b4
@@ -29,7 +29,7 @@ WSREP_DRUPAL_282555_WORKAROUND OFF
|
|||||||
WSREP_FORCED_BINLOG_FORMAT NONE
|
WSREP_FORCED_BINLOG_FORMAT NONE
|
||||||
WSREP_LOAD_DATA_SPLITTING ON
|
WSREP_LOAD_DATA_SPLITTING ON
|
||||||
WSREP_LOG_CONFLICTS OFF
|
WSREP_LOG_CONFLICTS OFF
|
||||||
WSREP_MAX_WS_ROWS 131072
|
WSREP_MAX_WS_ROWS 0
|
||||||
WSREP_MAX_WS_SIZE 1073741824
|
WSREP_MAX_WS_SIZE 1073741824
|
||||||
WSREP_MYSQL_REPLICATION_BUNDLE 0
|
WSREP_MYSQL_REPLICATION_BUNDLE 0
|
||||||
WSREP_NOTIFY_CMD
|
WSREP_NOTIFY_CMD
|
||||||
|
@@ -89,5 +89,27 @@ DELETE FROM t1 WHERE f2 = 2;
|
|||||||
SELECT COUNT(*) = 0 FROM t1;
|
SELECT COUNT(*) = 0 FROM t1;
|
||||||
COUNT(*) = 0
|
COUNT(*) = 0
|
||||||
1
|
1
|
||||||
|
SET AUTOCOMMIT = ON;
|
||||||
|
SET GLOBAL wsrep_max_ws_rows = 1;
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
ERROR HY000: wsrep_max_ws_rows exceeded
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
SET AUTOCOMMIT = OFF;
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
ERROR HY000: wsrep_max_ws_rows exceeded
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
ERROR HY000: wsrep_max_ws_rows exceeded
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
ERROR HY000: wsrep_max_ws_rows exceeded
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE ten;
|
DROP TABLE ten;
|
||||||
|
@@ -110,6 +110,43 @@ DELETE FROM t1 WHERE f2 = 2;
|
|||||||
|
|
||||||
SELECT COUNT(*) = 0 FROM t1;
|
SELECT COUNT(*) = 0 FROM t1;
|
||||||
|
|
||||||
|
|
||||||
|
# Test that wsrep_max_ws_rows is reset when switching autocommit mode
|
||||||
|
|
||||||
|
SET AUTOCOMMIT = ON;
|
||||||
|
SET GLOBAL wsrep_max_ws_rows = 1;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
--error ER_ERROR_DURING_COMMIT
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
|
||||||
|
|
||||||
|
SET AUTOCOMMIT = OFF;
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
--error ER_ERROR_DURING_COMMIT
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
--error ER_ERROR_DURING_COMMIT
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
|
||||||
|
|
||||||
|
# Test that wsrep_max_ws_rows is reset on implicit commits
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
INSERT INTO t1 (f2) VALUES (1);
|
||||||
|
--error ER_ERROR_DURING_COMMIT
|
||||||
|
INSERT INTO t1 (f2) VALUES (2);
|
||||||
|
|
||||||
|
|
||||||
--disable_query_log
|
--disable_query_log
|
||||||
--eval SET GLOBAL wsrep_max_ws_rows = $wsrep_max_ws_rows_orig
|
--eval SET GLOBAL wsrep_max_ws_rows = $wsrep_max_ws_rows_orig
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
@@ -6104,7 +6104,7 @@ int handler::ha_write_row(uchar *buf)
|
|||||||
current_thd->wsrep_exec_mode != REPL_RECV &&
|
current_thd->wsrep_exec_mode != REPL_RECV &&
|
||||||
current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
|
current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
|
||||||
{
|
{
|
||||||
current_thd->transaction_rollback_request= TRUE;
|
trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
|
||||||
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
|
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
|
||||||
DBUG_RETURN(ER_ERROR_DURING_COMMIT);
|
DBUG_RETURN(ER_ERROR_DURING_COMMIT);
|
||||||
}
|
}
|
||||||
@@ -6148,7 +6148,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
|
|||||||
current_thd->wsrep_exec_mode != REPL_RECV &&
|
current_thd->wsrep_exec_mode != REPL_RECV &&
|
||||||
current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
|
current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
|
||||||
{
|
{
|
||||||
current_thd->transaction_rollback_request= TRUE;
|
trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
|
||||||
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
|
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
|
||||||
return ER_ERROR_DURING_COMMIT;
|
return ER_ERROR_DURING_COMMIT;
|
||||||
}
|
}
|
||||||
@@ -6186,7 +6186,7 @@ int handler::ha_delete_row(const uchar *buf)
|
|||||||
current_thd->wsrep_exec_mode != REPL_RECV &&
|
current_thd->wsrep_exec_mode != REPL_RECV &&
|
||||||
current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
|
current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
|
||||||
{
|
{
|
||||||
current_thd->transaction_rollback_request= TRUE;
|
trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
|
||||||
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
|
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
|
||||||
return ER_ERROR_DURING_COMMIT;
|
return ER_ERROR_DURING_COMMIT;
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,7 @@ void wsrep_cleanup_transaction(THD *thd)
|
|||||||
thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
|
thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED;
|
||||||
thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
|
thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED;
|
||||||
thd->wsrep_exec_mode= LOCAL_STATE;
|
thd->wsrep_exec_mode= LOCAL_STATE;
|
||||||
|
thd->wsrep_affected_rows= 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user