为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
- 【TiDB 版本】:v4.0.4
- 【问题描述】:卡在了ddl上,目前队列中只有一个。
在TiDB日志中,创建不下来数据库。
[2020/09/21 11:38:54.505 +00:00] [INFO] [session.go:2130] ["CRUCIAL OPERATION"] [conn=719] [schemaVersion=258] [cur_db=] [sql="create database tt"] [user=root@10.204.11.89]
[2020/09/21 11:38:54.515 +00:00] [INFO] [ddl_worker.go:261] ["[ddl] add DDL jobs"] ["batch count"=1] [jobs="ID:226, Type:create schema, State:none, SchemaState:none, SchemaID:225, TableID:0, RowCount:0, ArgLen:1, start time: 2020-09-21 11:38:54.487 +0000 UTC, Err:<nil>, ErrCount:0, SnapshotVersion:0; "]
[2020/09/21 11:38:54.515 +00:00] [INFO] [ddl.go:477] ["[ddl] start DDL job"] [job="ID:226, Type:create schema, State:none, SchemaState:none, SchemaID:225, TableID:0, RowCount:0, ArgLen:1, start time: 2020-09-21 11:38:54.487 +0000 UTC, Err:<nil>, ErrCount:0, SnapshotVersion:0"] [query="create database tt"]
[2020/09/21 11:39:54.551 +00:00] [WARN] [expensivequery.go:168] [expensive_query] [cost_time=60.045631501s] [conn_id=719] [user=root] [txn_start_ts=0] [mem_max="0 Bytes (0 Bytes)"] [sql="create database tt"]
[2020/09/21 11:40:01.016 +00:00] [INFO] [client_batch.go:633] ["recycle idle connection"] [target=basic1-tikv-1.basic1-tikv-peer.test-namespace1.svc:20160]
目前在系统中只有一个jobs
MySQL [(none)]> admin show ddl jobs
-> ;
+--------+------------+------------+---------------+--------------+-----------+----------+-----------+---------------------+---------------------+-----------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | START_TIME | END_TIME | STATE |
+--------+------------+------------+---------------+--------------+-----------+----------+-----------+---------------------+---------------------+-----------+
| 226 | tt | | create schema | none | 225 | 0 | 0 | 2020-09-21 11:38:54 | NULL | none |
| 224 | tt | | create schema | none | 223 | 0 | 0 | 2020-09-21 11:24:15 | 2020-09-21 11:26:27 | cancelled |
| 222 | tpcc | | create schema | none | 221 | 0 | 0 | 2020-09-21 11:21:43 | 2020-09-21 11:22:17 | cancelled |
| 220 | warehouses | | create schema | none | 219 | 0 | 0 | 2020-09-21 11:16:14 | 2020-09-21 11:21:13 | cancelled |
| 218 | tpcc | | create schema | none | 217 | 0 | 0 | 2020-09-21 11:13:23 | 2020-09-21 11:21:11 | cancelled |
| 216 | tpcc | | create schema | none | 215 | 0 | 0 | 2020-09-21 11:12:18 | 2020-09-21 11:20:49 | cancelled |
| 214 | tpcc | | create schema | none | 213 | 0 | 0 | 2020-09-21 10:15:04 | 2020-09-21 11:20:41 | cancelled |
| 212 | tpcc | | create schema | none | 211 | 0 | 0 | 2020-09-21 10:12:32 | 2020-09-21 11:20:34 | cancelled |
| 210 | tpcc | | create schema | none | 209 | 0 | 0 | 2020-09-21 10:12:14 | 2020-09-21 11:20:12 | cancelled |
| 208 | sbtest | sbtest9 | add index | public | 111 | 173 | 10000000 | 2020-09-21 05:57:57 | 2020-09-21 07:06:57 | synced |
| 207 | sbtest | sbtest6 | add index | public | 111 | 191 | 10000000 | 2020-09-21 05:57:57 | 2020-09-21 07:02:38 | synced |
+--------+------------+------------+---------------+--------------+-----------+----------+-----------+---------------------+---------------------+-----------+
11 rows in set (0.02 sec)
MySQL [(none)]> admin show ddl \G;
*************************** 1. row ***************************
SCHEMA_VER: 258
OWNER_ID: 766dd74f-bf39-4677-ae50-834c1c03845c
OWNER_ADDRESS: basic1-tidb-1.basic1-tidb-peer.test-namespace1.svc:4000
RUNNING_JOBS: ID:226, Type:create schema, State:none, SchemaState:none, SchemaID:225, TableID:0, RowCount:0, ArgLen:0, start time: 2020-09-21 11:38:54.487 +0000 UTC, Err:<nil>, ErrCount:0, SnapshotVersion:0
SELF_ID: 766dd74f-bf39-4677-ae50-834c1c03845c
QUERY: create database tt
1 row in set (0.00 sec)
检查ddl jobs只有一个在创建的,卡不出卡在哪里了
MySQL [(none)]> admin show ddl jobs 10000 WHERE STATE not in ("cancelled","synced") ;
+--------+---------+------------+---------------+--------------+-----------+----------+-----------+---------------------+----------+-------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | START_TIME | END_TIME | STATE |
+--------+---------+------------+---------------+--------------+-----------+----------+-----------+---------------------+----------+-------+
| 226 | tt | | create schema | none | 225 | 0 | 0 | 2020-09-21 11:38:54 | NULL | none |
+--------+---------+------------+---------------+--------------+-----------+----------+-----------+---------------------+----------+-------+
1 row in set (0.04 sec)