Commit 8c44fd63 authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-8239 : Idle threads post-execution end up in closing tables state

Set thd's state to 'committed' only after it has done closing tables
(called indirectly by relay_group_info::cleanup_context()).
parent 6d5b723b
...@@ -25,7 +25,7 @@ COUNT(*) = 1 ...@@ -25,7 +25,7 @@ COUNT(*) = 1
SELECT COUNT(*) = 1 FROM t2; SELECT COUNT(*) = 1 FROM t2;
COUNT(*) = 1 COUNT(*) = 1
1 1
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'closing tables'; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%';
COUNT(*) = 2 COUNT(*) = 2
1 1
SET GLOBAL wsrep_slave_threads = 1;; SET GLOBAL wsrep_slave_threads = 1;;
......
...@@ -8,7 +8,7 @@ COUNT(*) = 20000 ...@@ -8,7 +8,7 @@ COUNT(*) = 20000
SELECT COUNT(DISTINCT f1) = 20000 FROM t1; SELECT COUNT(DISTINCT f1) = 20000 FROM t1;
COUNT(DISTINCT f1) = 20000 COUNT(DISTINCT f1) = 20000
1 1
SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'closing tables'; SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
COUNT(*) = 4 COUNT(*) = 4
1 1
DROP TABLE t1; DROP TABLE t1;
......
...@@ -44,7 +44,7 @@ UNLOCK TABLES; ...@@ -44,7 +44,7 @@ UNLOCK TABLES;
--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig; --eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig;
SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) = 1 FROM t2; SELECT COUNT(*) = 1 FROM t2;
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'closing tables'; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -41,7 +41,7 @@ while ($count) ...@@ -41,7 +41,7 @@ while ($count)
SELECT COUNT(*) = 20000 FROM t1; SELECT COUNT(*) = 20000 FROM t1;
SELECT COUNT(DISTINCT f1) = 20000 FROM t1; SELECT COUNT(DISTINCT f1) = 20000 FROM t1;
SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'closing tables'; SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
--disable_query_log --disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
......
...@@ -6,7 +6,7 @@ UPDATE t1 SET f1 = f1 + 100;; ...@@ -6,7 +6,7 @@ UPDATE t1 SET f1 = f1 + 100;;
SELECT f1 = 111 FROM t1; SELECT f1 = 111 FROM t1;
f1 = 111 f1 = 111
1 1
SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'closing tables'; SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
COUNT(*) IN (1, 2) COUNT(*) IN (1, 2)
1 1
SET GLOBAL wsrep_slave_threads = 1;; SET GLOBAL wsrep_slave_threads = 1;;
......
...@@ -31,7 +31,7 @@ SET GLOBAL wsrep_slave_threads = 2; ...@@ -31,7 +31,7 @@ SET GLOBAL wsrep_slave_threads = 2;
--connection node_3 --connection node_3
SELECT f1 = 111 FROM t1; SELECT f1 = 111 FROM t1;
SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'closing tables'; SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%';
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
......
...@@ -295,14 +295,6 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd, ...@@ -295,14 +295,6 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd,
wsrep_cb_status_t const rcode(trans_commit(thd) ? wsrep_cb_status_t const rcode(trans_commit(thd) ?
WSREP_CB_FAILURE : WSREP_CB_SUCCESS); WSREP_CB_FAILURE : WSREP_CB_SUCCESS);
#ifdef WSREP_PROC_INFO
snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
"committed %lld", (long long)wsrep_thd_trx_seqno(thd));
thd_proc_info(thd, thd->wsrep_info);
#else
thd_proc_info(thd, "committed");
#endif /* WSREP_PROC_INFO */
if (WSREP_CB_SUCCESS == rcode) if (WSREP_CB_SUCCESS == rcode)
{ {
thd->wsrep_rgi->cleanup_context(thd, false); thd->wsrep_rgi->cleanup_context(thd, false);
...@@ -312,6 +304,14 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd, ...@@ -312,6 +304,14 @@ static wsrep_cb_status_t wsrep_commit(THD* const thd,
// TODO: mark snapshot with global_seqno. // TODO: mark snapshot with global_seqno.
} }
#ifdef WSREP_PROC_INFO
snprintf(thd->wsrep_info, sizeof(thd->wsrep_info) - 1,
"committed %lld", (long long) wsrep_thd_trx_seqno(thd));
thd_proc_info(thd, thd->wsrep_info);
#else
thd_proc_info(thd, "committed");
#endif /* WSREP_PROC_INFO */
return rcode; return rcode;
} }
......
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