Commit 69b75cb3 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-26440 Missing connection id value in I_S.thread_pool_queues

It turns out, Field::set_notnull is required for a nullable I_S field.
Rework thread_pool_info.test to test request queueing in threadpool.
parent 4009e9b2
--thread-handling=pool-of-threads --loose-thread-pool-mode=generic --loose-thread-pool-groups=ON --loose-thread-pool-queues=ON --thread-pool-stats=ON --thread-pool-waits=ON
\ No newline at end of file
--thread-handling=pool-of-threads --loose-thread-pool-mode=generic --loose-thread-pool-groups=ON --loose-thread-pool-queues=ON --thread-pool-stats=ON --thread-pool-waits=ON --thread-pool-size=1 --thread-pool-max-threads=2 --thread-pool-dedicated-listener
......@@ -26,13 +26,6 @@ SUM(QUEUE_LENGTH)
SELECT SUM(IS_STALLED) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
SUM(IS_STALLED)
0
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
POSITION int(6) NO 0
PRIORITY int(1) NO 0
CONNECTION_ID bigint(19) unsigned YES NULL
QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
......@@ -56,9 +49,12 @@ FLUSH THREAD_POOL_STATS;
SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER)
1
SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) BETWEEN 2 AND 3 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) BETWEEN 2 AND 3
1
SELECT SUM(POLLS_BY_LISTENER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(POLLS_BY_LISTENER)
2
SELECT SUM(POLLS_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SUM(POLLS_BY_WORKER)
0
DESC INFORMATION_SCHEMA.THREAD_POOL_WAITS;
Field Type Null Key Default Extra
REASON varchar(16) NO
......@@ -87,3 +83,29 @@ SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
COUNT
1
FLUSH THREAD_POOL_WAITS;
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
POSITION int(6) NO 0
PRIORITY int(1) NO 0
CONNECTION_ID bigint(19) unsigned YES NULL
QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
# restart: with restart_parameters
connect con1, localhost, root,,test;
connection con1;
connect con2, localhost, root,,test;
connection con2;
connect extra_con,127.0.0.1,root,,test,$extra_port,;
connection con1;
SELECT SLEEP(1000);
connection extra_con;
connection con2;
DO 1;
connection extra_con;
KILL QUERY con1_id;
disconnect extra_con;
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection default;
......@@ -15,9 +15,6 @@ SELECT SUM(ACTIVE_THREADS) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
SELECT SUM(QUEUE_LENGTH) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
SELECT SUM(IS_STALLED) FROM INFORMATION_SCHEMA.THREAD_POOL_GROUPS;
# I_S.THREAD_POOL_QUEUES
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
#Todo - figure out how to populate queue with debug test
# I_S.THREAD_POOL_STATS
DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
......@@ -29,7 +26,8 @@ SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) > 0 FROM INFORMATION_SCHEMA.THREAD
--disable_ps_protocol
FLUSH THREAD_POOL_STATS;
SELECT SUM(DEQUEUES_BY_LISTENER+DEQUEUES_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SELECT SUM(POLLS_BY_LISTENER+POLLS_BY_WORKER) BETWEEN 2 AND 3 FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SELECT SUM(POLLS_BY_LISTENER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
SELECT SUM(POLLS_BY_WORKER) FROM INFORMATION_SCHEMA.THREAD_POOL_STATS;
--enable_ps_protocol
#I_S.THREAD_POOL_WAITS
......@@ -39,3 +37,56 @@ SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
SELECT SLEEP(0.01);
SELECT COUNT FROM INFORMATION_SCHEMA.THREAD_POOL_WAITS WHERE REASON='Sleep';
FLUSH THREAD_POOL_WAITS;
# I_S.THREAD_POOL_QUEUES
DESC INFORMATION_SCHEMA.THREAD_POOL_QUEUES;
let $extra_port=`select @@port+1`;
let $restart_parameters=--extra-port=$extra_port;
let $restart_noprint=1;
source include/restart_mysqld.inc;
connect (con1, localhost, root,,test);
connection con1;
let $con1_id=`SELECT CONNECTION_ID()`;
connect (con2, localhost, root,,test);
connection con2;
let $con2_id=`SELECT CONNECTION_ID()`;
connect(extra_con,127.0.0.1,root,,test,$extra_port,);
connection con1;
send SELECT SLEEP(1000);
connection extra_con;
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE='User sleep' AND ID=$con1_id;
--source include/wait_condition.inc
connection con2;
send DO 1;
connection extra_con;
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.THREAD_POOL_QUEUES
WHERE CONNECTION_ID IS NOT NULL;
--source include/wait_condition.inc
--replace_result $con1_id con1_id
eval KILL QUERY $con1_id;
disconnect extra_con;
connection con1;
error 0,ER_QUERY_INTERRUPTED;
reap;
disconnect con1;
connection con2;
reap;
disconnect con2;
connection default;
......@@ -131,7 +131,10 @@ static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*)
table->field[2]->store(prio, true);
/* CONNECTION_ID */
if (c->thd)
{
table->field[3]->set_notnull();
table->field[3]->store(c->thd->thread_id, true);
}
/* QUEUEING_TIME */
table->field[4]->store(now - c->enqueue_time, true);
......
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