我重新完整的复现了下:
1、做tpch1的数据加载:
tiup bench tpch -H 192.168.31.201 -P 4000 -U root -p123 -D tpch1 prepare --sf=1
2、修改默认Resource Group:
ALTER RESOURCE GROUP default QUERY_LIMIT=(EXEC_ELAPSED='100ms', ACTION=KILL, WATCH=EXACT DURATION='10m');
3、执行并发请求程序(程序见附件
main.go (1.8 KB)
):
go run main.go -host 192.168.31.201 -port 4000 -user root -password "123" -database tpch1
4、观察RUNAWAY_WATCHES并随机REMOVE掉一个,看是否可以REMOVE掉:
mysql> SELECT * FROM INFORMATION_SCHEMA.RUNAWAY_WATCHES ORDER BY id desc limit 10;
+-----+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| ID | RESOURCE_GROUP_NAME | START_TIME | END_TIME | WATCH | WATCH_TEXT | SOURCE | ACTION |
+-----+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| 470 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1997-08-13' | 192.168.31.201:4000 | Kill |
| 469 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1996-02-03' | 192.168.31.201:4000 | Kill |
| 468 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1996-08-03' | 192.168.31.201:4000 | Kill |
| 467 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1996-02-26' | 192.168.31.201:4000 | Kill |
| 466 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1995-07-19' | 192.168.31.201:4000 | Kill |
| 465 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1994-09-25' | 192.168.31.201:4000 | Kill |
| 464 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1994-09-18' | 192.168.31.201:4000 | Kill |
| 463 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1995-03-30' | 192.168.31.201:4000 | Kill |
| 462 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1994-11-20' | 192.168.31.201:4000 | Kill |
| 461 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1997-06-29' | 192.168.31.201:4000 | Kill |
+-----+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
10 rows in set (0.01 sec)
mysql> query watch remove 461;
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT * FROM INFORMATION_SCHEMA.RUNAWAY_WATCHES ORDER BY id desc limit 10;
+-----+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| ID | RESOURCE_GROUP_NAME | START_TIME | END_TIME | WATCH | WATCH_TEXT | SOURCE | ACTION |
+-----+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| 470 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1997-08-13' | 192.168.31.201:4000 | Kill |
| 469 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1996-02-03' | 192.168.31.201:4000 | Kill |
| 468 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1996-08-03' | 192.168.31.201:4000 | Kill |
| 467 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1996-02-26' | 192.168.31.201:4000 | Kill |
| 466 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1995-07-19' | 192.168.31.201:4000 | Kill |
| 465 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1994-09-25' | 192.168.31.201:4000 | Kill |
| 464 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1994-09-18' | 192.168.31.201:4000 | Kill |
| 463 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1995-03-30' | 192.168.31.201:4000 | Kill |
| 462 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1994-11-20' | 192.168.31.201:4000 | Kill |
| 460 | default | 2024-06-17 22:27:05 | 2024-06-17 22:37:05 | Exact | select count(*) from orders where o_orderdate = '1993-12-25' | 192.168.31.201:4000 | Kill |
+-----+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
10 rows in set (0.00 sec)
发现可以REMOVE,没有问题。
5、重新执行并发请求程序,让RUNAWAY_WATCHES的ID达到1000以上(可以执行十多秒再ctrl+c终止):
go run main.go -host 192.168.31.201 -port 4000 -user root -password "123" -database tpch1
6、重新REMOVE掉一个ID:
mysql> SELECT * FROM INFORMATION_SCHEMA.RUNAWAY_WATCHES ORDER BY id desc limit 10;
+------+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| ID | RESOURCE_GROUP_NAME | START_TIME | END_TIME | WATCH | WATCH_TEXT | SOURCE | ACTION |
+------+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| 1310 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1996-09-16' | 192.168.31.201:4000 | Kill |
| 1309 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1994-08-25' | 192.168.31.201:4000 | Kill |
| 1308 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1997-12-13' | 192.168.31.201:4000 | Kill |
| 1307 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1995-08-03' | 192.168.31.201:4000 | Kill |
| 1306 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1998-07-03' | 192.168.31.201:4000 | Kill |
| 1305 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1998-05-29' | 192.168.31.201:4000 | Kill |
| 1304 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1996-02-20' | 192.168.31.201:4000 | Kill |
| 1303 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1997-12-06' | 192.168.31.201:4000 | Kill |
| 1302 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1997-03-26' | 192.168.31.201:4000 | Kill |
| 1301 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1995-08-23' | 192.168.31.201:4000 | Kill |
+------+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
10 rows in set (0.01 sec)
mysql> query watch remove 1310;
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT * FROM INFORMATION_SCHEMA.RUNAWAY_WATCHES ORDER BY id desc limit 10;
+------+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| ID | RESOURCE_GROUP_NAME | START_TIME | END_TIME | WATCH | WATCH_TEXT | SOURCE | ACTION |
+------+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
| 1310 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1996-09-16' | 192.168.31.201:4000 | Kill |
| 1309 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1994-08-25' | 192.168.31.201:4000 | Kill |
| 1308 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1997-12-13' | 192.168.31.201:4000 | Kill |
| 1307 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1995-08-03' | 192.168.31.201:4000 | Kill |
| 1306 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1998-07-03' | 192.168.31.201:4000 | Kill |
| 1305 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1998-05-29' | 192.168.31.201:4000 | Kill |
| 1304 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1996-02-20' | 192.168.31.201:4000 | Kill |
| 1303 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1997-12-06' | 192.168.31.201:4000 | Kill |
| 1302 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1997-03-26' | 192.168.31.201:4000 | Kill |
| 1301 | default | 2024-06-17 22:29:07 | 2024-06-17 22:39:07 | Exact | select count(*) from orders where o_orderdate = '1995-08-23' | 192.168.31.201:4000 | Kill |
+------+---------------------+---------------------+---------------------+-------+---------------------------------------------------------------+---------------------+--------+
10 rows in set (0.01 sec)
可以发现1310执行了remove但未生效。