Skip to content

Commit 5e1eeb3

Browse files
george-reynyafacebook-github-bot
authored andcommitted
Update tests for integration with AC
Summary: MySQL side update for D36781117. It fixes the tests and also temporarily disables features that will be re-enabled once they are fixed on the thread pool side. 1. Change `admission_control_queue_timeout` to 0 when possible until the non-zero timeout is supported. 2. Remove tests for `admission_control_by_trx` which is disabled for now. This feature is not used in prod (and has never been). 3. Filter out `__system__` AC entity. 4. Remove tests that kill thread waiting for AC until the feature is supported. Reviewed By: shivamverma321 Differential Revision: D37299215 fbshipit-source-id: 04c10f5c85cff2bbb74af67a93640e71a8145a2e
1 parent 839325f commit 5e1eeb3

10 files changed

+57
-280
lines changed

mysql-test/suite/thread_pool/r/admission_control.result

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -104,71 +104,19 @@ Query on existing thread pool connection is also rejected.
104104
select * from t1;
105105
ERROR HY000: Maximum waiting queries 5 reached for database `test_db`
106106
set @@global.thread_pool_max_waiting_queries=6;
107-
Kill a thread that is waiting for admission.
108-
select count(*) from t1;
109-
kill ID;
110107
use test_db;
111108
unlock tables;
112109
Verify the waiting queries received wakeup signal.
113110
select count(*) from t1;
114111
count(*)
115112
15
116-
set @save_admission_control_by_trx = @@global.thread_pool_admission_control_by_trx;
117-
select @save_admission_control_by_trx;
118-
@save_admission_control_by_trx
119-
0
120-
set @@global.thread_pool_max_running_queries=5;
121-
set @@global.thread_pool_max_waiting_queries=10;
122-
# By default, open transaction has no effect on running queries
123-
select count(*) from t1;
124-
count(*)
125-
15
126-
# Test: open transactions will take slots in running queries,
127-
# and will not be blocked
128-
set @@global.thread_pool_admission_control_filter = 'BEGIN,COMMIT,ROLLBACK';
129-
select @@global.thread_pool_admission_control_filter;
130-
@@global.thread_pool_admission_control_filter
131-
BEGIN,COMMIT,ROLLBACK
132-
set @@global.thread_pool_admission_control_by_trx = true;
133-
SELECT @@global.thread_pool_admission_control_by_trx;
134-
@@global.thread_pool_admission_control_by_trx
135-
1
136-
Open transaction is able to continue running queries
137-
connection con_max_wait;
138-
New queries will be rejected (waiting queue is full)
139-
select * from t1;
140-
ERROR HY000: Maximum waiting queries 10 reached for database `test_db`
141-
New transactions will be rejected (waiting queue is full)
142-
begin;
143-
select * from t1;
144-
ERROR HY000: Maximum waiting queries 10 reached for database `test_db`
145-
aborted_queries will increase by 2
146-
Committing a transaction will free up the running query slots
147-
The waiting queries will be unblocked
148-
Check status variables
149-
include/assert.inc [DB Admission control waiting queries should be zero]
150-
include/assert.inc [DB Admission control running queries should be zero]
151-
include/assert.inc [DB Admission control aborted queries should be eight]
152-
select * from information_schema.tp_admission_control_entities where schema_name like 'test_db%' order by schema_name;
153-
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
154-
test_db 0 0 8 0 13 0
155-
test_db2 0 0 0 0 0 0
156-
set @@global.thread_pool_admission_control_by_trx = @save_admission_control_by_trx;
157-
select @@global.thread_pool_admission_control_by_trx;
158-
@@global.thread_pool_admission_control_by_trx
159-
0
160-
set @@global.thread_pool_admission_control_filter = '';
161-
select @@global.thread_pool_admission_control_filter;
162-
@@global.thread_pool_admission_control_filter
163-
164-
# End of open transaction test
165113
# Test admission_control_queue_timeout
166114
use test_db;
167115
set @@global.thread_pool_max_running_queries=1;
168116
set @@global.thread_pool_max_waiting_queries=5;
169117
set @save_admission_control_filter = @@global.thread_pool_admission_control_filter;
170118
set @save_admission_control_queue_timeout = @@global.thread_pool_admission_control_queue_timeout;
171-
set @@global.thread_pool_admission_control_queue_timeout = 100;
119+
set @@global.thread_pool_admission_control_queue_timeout = 0;
172120
set @@global.thread_pool_admission_control_filter = 'BEGIN,COMMIT,ROLLBACK';
173121
create table t2(a int primary key) engine=InnoDB;
174122
begin;
@@ -186,7 +134,7 @@ waiting_queries should be 0
186134
waiting_queries = 0
187135
select * from information_schema.tp_admission_control_entities where schema_name like 'test_db%' order by schema_name;
188136
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
189-
test_db 0 0 8 1 15 0
137+
test_db 0 0 6 1 15 0
190138
test_db2 0 0 0 0 0 0
191139
set @@global.thread_pool_admission_control_filter = 'ROLLBACK,INSERT';
192140
create table t3(a int primary key) engine=InnoDB;
@@ -196,7 +144,7 @@ begin;
196144
insert into t3 values (1)||||
197145
select * from information_schema.tp_admission_control_entities where schema_name like 'test_db%' order by schema_name;
198146
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
199-
test_db 0 1 8 1 17 0
147+
test_db 0 1 6 1 17 0
200148
test_db2 0 0 0 0 0 0
201149
SELECT should timeout
202150
select * from t3;
@@ -210,7 +158,7 @@ begin;
210158
insert into t3 values (1)||||
211159
select * from information_schema.tp_admission_control_entities where schema_name like 'test_db%' order by schema_name;
212160
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
213-
test_db 0 0 8 2 17 0
161+
test_db 0 0 6 2 17 0
214162
test_db2 0 0 0 0 0 0
215163
SELECT should succeed
216164
select * from t3;

mysql-test/suite/thread_pool/r/admission_control_hang.result

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ set @start_innodb_lock_wait_timeout = @@global.innodb_lock_wait_timeout;
77
set @@global.innodb_lock_wait_timeout = 10000;
88
set @start_admission_control_filter = @@global.thread_pool_admission_control_filter;
99
set @@global.thread_pool_admission_control_filter = 'COMMIT';
10+
set @start_admission_control_queue_timeout = @@global.thread_pool_admission_control_queue_timeout;
11+
set @@global.thread_pool_admission_control_queue_timeout = 0;
1012
create table t1 (a int) engine=innodb;
1113
insert into t1 values(1);
1214
begin;
@@ -15,6 +17,7 @@ update t1 set a=2 where a=1;
1517
update t1 set a=2 where a=1;
1618
update t1 set a=2 where a=1;
1719
update t1 set a=2 where a=1;
20+
Wait to confirm that all 4 queries are running.
1821
set @@global.thread_pool_admission_control_filter = 'USE';
1922
select @@global.thread_pool_admission_control_filter;
2023
@@global.thread_pool_admission_control_filter
@@ -75,8 +78,7 @@ select @@global.thread_pool_admission_control_filter;
7578
@@global.thread_pool_admission_control_filter
7679

7780
select count(*) from t1;
78-
count(*)
79-
1
81+
ERROR HY000: Got timeout while waiting on admission control queue for database `test_db`
8082
set @@global.thread_pool_admission_control_by_trx = @save_admission_control_by_trx;
8183
select @@global.thread_pool_admission_control_by_trx;
8284
@@global.thread_pool_admission_control_by_trx
@@ -89,5 +91,6 @@ commit;
8991
set @@global.thread_pool_max_running_queries = @start_max_running_queries;
9092
set @@global.innodb_lock_wait_timeout = @start_innodb_lock_wait_timeout;
9193
set @@global.thread_pool_admission_control_filter = @start_admission_control_filter;
94+
set @@global.thread_pool_admission_control_queue_timeout = @start_admission_control_queue_timeout;
9295
drop database test_db;
9396
drop user test_user@localhost;

mysql-test/suite/thread_pool/r/admission_control_queue.result

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ select GET_LOCK('lock1', -1);
1818
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
1919
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
2020
test_db 0 1 0 0 1 0
21-
select * from information_schema.tp_admission_control_queue;
21+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
2222
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
2323
test_db 0 0 1 0 0
2424
select RELEASE_LOCK('lock1');
2525
RELEASE_LOCK('lock1')
2626
1
2727
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
2828
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
29-
select * from information_schema.tp_admission_control_queue;
29+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
3030
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
3131
GET_LOCK('lock1', -1)
3232
1
@@ -41,13 +41,13 @@ select GET_LOCK('lock1', -1);
4141
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
4242
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
4343
test_db 0 1 0 0 1 0
44-
select * from information_schema.tp_admission_control_queue;
44+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
4545
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
4646
test_db 1 0 1 0 0
4747
select RELEASE_LOCK('lock1');
4848
RELEASE_LOCK('lock1')
4949
1
50-
select * from information_schema.tp_admission_control_queue;
50+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
5151
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
5252
GET_LOCK('lock1', -1)
5353
1
@@ -62,15 +62,15 @@ select GET_LOCK('lock1', -1);
6262
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
6363
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
6464
test_db 0 1 0 0 1 0
65-
select * from information_schema.tp_admission_control_queue;
65+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
6666
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
6767
test_db 2 0 1 0 0
6868
select RELEASE_LOCK('lock1');
6969
RELEASE_LOCK('lock1')
7070
1
7171
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
7272
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
73-
select * from information_schema.tp_admission_control_queue;
73+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
7474
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
7575
GET_LOCK('lock1', -1)
7676
1
@@ -93,7 +93,7 @@ select GET_LOCK('lock1', -1);
9393
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
9494
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
9595
test_db 0 5 0 0 5 0
96-
select * from information_schema.tp_admission_control_queue;
96+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
9797
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
9898
test_db 0 0 5 0 0
9999
# Set up 5 waiting queries each for queue 1 and 2
@@ -111,7 +111,7 @@ select GET_LOCK('lock2', -1);
111111
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
112112
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
113113
test_db 10 5 0 0 15 0
114-
select * from information_schema.tp_admission_control_queue;
114+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
115115
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
116116
test_db 0 0 5 0 0
117117
test_db 1 5 0 0 0
@@ -123,7 +123,7 @@ RELEASE_LOCK('lock1')
123123
select * from information_schema.tp_admission_control_entities where waiting_queries + running_queries + aborted_queries + timeout_queries != 0 and schema_name like 'test%';
124124
SCHEMA_NAME WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES CONNECTIONS REJECTED_CONNECTIONS
125125
test_db 5 5 0 0 10 0
126-
select * from information_schema.tp_admission_control_queue;
126+
select * from information_schema.tp_admission_control_queue where schema_name like 'test%';
127127
SCHEMA_NAME QUEUE_ID WAITING_QUERIES RUNNING_QUERIES ABORTED_QUERIES TIMEOUT_QUERIES
128128
test_db 1 3 2 0 0
129129
test_db 2 2 3 0 0

mysql-test/suite/thread_pool/r/admission_control_yield.result

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set @save_admission_control_yield_freq = @@thread_pool_admission_control_yield_f
1010
set global thread_pool_max_running_queries = 1;
1111
set global thread_pool_max_waiting_queries = 2000;
1212
set global thread_pool_admission_control_filter = 'SET';
13-
set thread_pool_admission_control_queue_timeout = 5000;
13+
set thread_pool_admission_control_queue_timeout = 0;
1414
#
1515
# Test admission_control_wait_events = SLEEP
1616
#
@@ -86,9 +86,6 @@ set global thread_pool_admission_control_wait_events = 'YIELD';
8686
set global thread_pool_admission_control_yield_freq = 1;
8787
select * from t2 a, t2 b, t2 c, t2 d, t2 e, t2 f, t2 g, t2 h limit 10000000000, 1;;
8888
Timeout in wait_condition.inc for select count(*) = 1 from information_schema.processlist where state = 'Sending data'
89-
select 1;
90-
1
91-
1
9289
drop table t1;
9390
drop table t2;
9491
ERROR 70100: Query execution was interrupted

mysql-test/suite/thread_pool/r/admission_control_yield_debug.result

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set @save_max_waiting_queries = @@thread_pool_max_waiting_queries;
88
set @save_admission_control_wait_events = @@thread_pool_admission_control_wait_events;
99
set global thread_pool_max_running_queries = 1;
1010
set global thread_pool_max_waiting_queries = 2000;
11-
set thread_pool_admission_control_queue_timeout = 100;
11+
set thread_pool_admission_control_queue_timeout = 0;
1212
#
1313
# Test admission_control_wait_events = NET_IO
1414
# We need debug sync to simulate slow clients
@@ -20,9 +20,6 @@ select 1;
2020
ERROR HY000: Got timeout while waiting on admission control queue for database `test_db`
2121
set global thread_pool_admission_control_wait_events = 'NET_IO';
2222
SELECT REPEAT('X', @@max_allowed_packet);;
23-
select 1;
24-
1
25-
1
2623
set global thread_pool_max_running_queries = @save_max_running_queries;
2724
set global thread_pool_max_waiting_queries = @save_max_waiting_queries;
2825
set global thread_pool_admission_control_wait_events = @save_admission_control_wait_events;

0 commit comments

Comments
 (0)