diff options
author | Alexey Yurchenko <ayurchen@galeracluster.com> | 2016-04-02 21:51:26 -0300 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-08-21 16:17:07 -0400 |
commit | 90d92d2b49eb54ea3c8d17e7db2525f20e475e94 (patch) | |
tree | 9c9318f8c08b324ecbb759e0a3bfbf3e79265127 | |
parent | a00f4b29b5a50c46641fa522c2b3235fe72ae697 (diff) | |
download | mariadb-git-90d92d2b49eb54ea3c8d17e7db2525f20e475e94.tar.gz |
MW-258 - RSU DDL should not rely on the global wsrep_desync variable value and should always try to desync on its own.
-rw-r--r-- | mysql-test/suite/galera/r/MW-258.result | 42 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/MW-258.test | 43 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 47 |
3 files changed, 104 insertions, 28 deletions
diff --git a/mysql-test/suite/galera/r/MW-258.result b/mysql-test/suite/galera/r/MW-258.result new file mode 100644 index 00000000000..28b1e4049ab --- /dev/null +++ b/mysql-test/suite/galera/r/MW-258.result @@ -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; diff --git a/mysql-test/suite/galera/t/MW-258.test b/mysql-test/suite/galera/t/MW-258.test new file mode 100644 index 00000000000..7745ef5ea9f --- /dev/null +++ b/mysql-test/suite/galera/t/MW-258.test @@ -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; diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index e392aef32eb..17e3577a6eb 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -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; } |