mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MW-258 - RSU DDL should not rely on the global wsrep_desync variable value and should always try to desync on its own.
This commit is contained in:
committed by
Nirbhay Choubey
parent
a00f4b29b5
commit
90d92d2b49
42
mysql-test/suite/galera/r/MW-258.result
Normal file
42
mysql-test/suite/galera/r/MW-258.result
Normal file
@@ -0,0 +1,42 @@
|
||||
CREATE TABLE t1 (f1 INTEGER);
|
||||
LOCK TABLE t1 WRITE;
|
||||
value prior to RSU:
|
||||
SHOW STATUS LIKE 'wsrep_desync_count';
|
||||
Variable_name Value
|
||||
wsrep_desync_count 0
|
||||
SHOW VARIABLES LIKE 'wsrep_desync';
|
||||
Variable_name Value
|
||||
wsrep_desync OFF
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET SESSION wsrep_osu_method = RSU;
|
||||
ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET SESSION wsrep_osu_method = RSU;
|
||||
ALTER TABLE t1 ADD COLUMN f3 INTEGER;;
|
||||
value during RSU:
|
||||
SHOW STATUS LIKE 'wsrep_desync_count';
|
||||
Variable_name Value
|
||||
wsrep_desync_count 2
|
||||
SHOW VARIABLES LIKE 'wsrep_desync';
|
||||
Variable_name Value
|
||||
wsrep_desync OFF
|
||||
SHOW PROCESSLIST;
|
||||
Id User Host db Command Time State Info Progress
|
||||
# system user # NULL Sleep # NULL NULL 0.000
|
||||
# system user # NULL Sleep # wsrep aborter idle NULL 0.000
|
||||
# root # test Sleep # NULL 0.000
|
||||
# root # test Query # init SHOW PROCESSLIST 0.000
|
||||
# root # test Query # Waiting for table metadata lock ALTER TABLE t1 ADD COLUMN f2 INTEGER 0.000
|
||||
# root # test Query # checking permissions ALTER TABLE t1 ADD COLUMN f3 INTEGER 0.000
|
||||
UNLOCK TABLES;
|
||||
value after RSU:
|
||||
SHOW STATUS LIKE 'wsrep_desync_count';
|
||||
Variable_name Value
|
||||
wsrep_desync_count 0
|
||||
SHOW VARIABLES LIKE 'wsrep_desync';
|
||||
Variable_name Value
|
||||
wsrep_desync OFF
|
||||
SET GLOBAL wsrep_desync=0;
|
||||
Warnings:
|
||||
Warning 1231 'wsrep_desync' is already OFF.
|
||||
DROP TABLE t1;
|
||||
43
mysql-test/suite/galera/t/MW-258.test
Normal file
43
mysql-test/suite/galera/t/MW-258.test
Normal file
@@ -0,0 +1,43 @@
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
--connection node_1
|
||||
CREATE TABLE t1 (f1 INTEGER);
|
||||
LOCK TABLE t1 WRITE;
|
||||
--echo value prior to RSU:
|
||||
SHOW STATUS LIKE 'wsrep_desync_count';
|
||||
SHOW VARIABLES LIKE 'wsrep_desync';
|
||||
|
||||
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
|
||||
--connection node_1a
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET SESSION wsrep_osu_method = RSU;
|
||||
--send ALTER TABLE t1 ADD COLUMN f2 INTEGER;
|
||||
|
||||
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
|
||||
--connection node_1b
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
SET SESSION wsrep_osu_method = RSU;
|
||||
--send ALTER TABLE t1 ADD COLUMN f3 INTEGER;
|
||||
|
||||
--sleep 5
|
||||
--connection node_1
|
||||
--echo value during RSU:
|
||||
SHOW STATUS LIKE 'wsrep_desync_count';
|
||||
SHOW VARIABLES LIKE 'wsrep_desync';
|
||||
--replace_column 1 # 3 # 6 #
|
||||
SHOW PROCESSLIST;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--connection node_1a
|
||||
--reap
|
||||
--connection node_1b
|
||||
--reap
|
||||
|
||||
--connection node_1
|
||||
--echo value after RSU:
|
||||
SHOW STATUS LIKE 'wsrep_desync_count';
|
||||
SHOW VARIABLES LIKE 'wsrep_desync';
|
||||
SET GLOBAL wsrep_desync=0;
|
||||
|
||||
DROP TABLE t1;
|
||||
@@ -1308,19 +1308,15 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
|
||||
WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
|
||||
thd->wsrep_exec_mode, thd->query() );
|
||||
|
||||
if (!wsrep_desync)
|
||||
ret = wsrep->desync(wsrep);
|
||||
if (ret != WSREP_OK)
|
||||
{
|
||||
ret = wsrep->desync(wsrep);
|
||||
if (ret != WSREP_OK)
|
||||
{
|
||||
WSREP_WARN("RSU desync failed %d for schema: %s, query: %s",
|
||||
ret, (thd->db ? thd->db : "(null)"), thd->query());
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0));
|
||||
return(ret);
|
||||
}
|
||||
WSREP_WARN("RSU desync failed %d for schema: %s, query: %s",
|
||||
ret, (thd->db ? thd->db : "(null)"), thd->query());
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0));
|
||||
return(ret);
|
||||
}
|
||||
else
|
||||
WSREP_DEBUG("RSU desync skipped: %d", wsrep_desync);
|
||||
|
||||
mysql_mutex_lock(&LOCK_wsrep_replaying);
|
||||
wsrep_replaying++;
|
||||
mysql_mutex_unlock(&LOCK_wsrep_replaying);
|
||||
@@ -1335,15 +1331,13 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
|
||||
wsrep_replaying--;
|
||||
mysql_mutex_unlock(&LOCK_wsrep_replaying);
|
||||
|
||||
if (!wsrep_desync)
|
||||
ret = wsrep->resync(wsrep);
|
||||
if (ret != WSREP_OK)
|
||||
{
|
||||
ret = wsrep->resync(wsrep);
|
||||
if (ret != WSREP_OK)
|
||||
{
|
||||
WSREP_WARN("resync failed %d for schema: %s, query: %s",
|
||||
ret, (thd->db ? thd->db : "(null)"), thd->query());
|
||||
}
|
||||
WSREP_WARN("resync failed %d for schema: %s, query: %s",
|
||||
ret, (thd->db ? thd->db : "(null)"), thd->query());
|
||||
}
|
||||
|
||||
my_error(ER_LOCK_DEADLOCK, MYF(0));
|
||||
return(1);
|
||||
}
|
||||
@@ -1379,18 +1373,15 @@ static void wsrep_RSU_end(THD *thd)
|
||||
(thd->db ? thd->db : "(null)"),
|
||||
thd->query());
|
||||
}
|
||||
if (!wsrep_desync)
|
||||
|
||||
ret = wsrep->resync(wsrep);
|
||||
if (ret != WSREP_OK)
|
||||
{
|
||||
ret = wsrep->resync(wsrep);
|
||||
if (ret != WSREP_OK)
|
||||
{
|
||||
WSREP_WARN("resync failed %d for schema: %s, query: %s", ret,
|
||||
(thd->db ? thd->db : "(null)"), thd->query());
|
||||
return;
|
||||
}
|
||||
WSREP_WARN("resync failed %d for schema: %s, query: %s", ret,
|
||||
(thd->db ? thd->db : "(null)"), thd->query());
|
||||
return;
|
||||
}
|
||||
else
|
||||
WSREP_DEBUG("RSU resync skipped: %d", wsrep_desync);
|
||||
|
||||
thd->variables.wsrep_on = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user