我正在使用MariaDB 10.2。我有一个具有约6000万行的表。最初是我在尝试运行:
insert into signals select * from signals_tmp where signal_num = 21;
MariaDB冻结了。从那时起,我尝试重新启动mysqld和我的笔记本电脑,所以我不知道它初次冻结时的确切状态。现在,当我尝试执行此操作时:
select count(*) from signals where signal_num = 20
它冻结了,所以我在MySQL中按了Ctrl + C。然后运行以下命令:
MariaDB [phd]> show open tables where In_use = 1;
+----------+---------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+---------+--------+-------------+
| phd | signals | 1 | 0 |
+----------+---------+--------+-------------+
1 row in set (0.00 sec)
MariaDB [phd]> show processlist;
+----+-------------+-----------------+------+---------+------+--------------------------+----------------------------------------------------+----------+
| Id | User | Host | db | Command | Time | State
| Info | Progress |
+----+-------------+-----------------+------+---------+------+--------------------------+----------------------------------------------------+----------+
| 1 | system user | | NULL | Daemon | NULL | InnoDB purge coordinator | NULL | 0.000 |
| 2 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 3 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 4 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 5 | system user | | NULL | Daemon | NULL | InnoDB shutdown handler | NULL | 0.000 |
| 8 | root | localhost:50473 | phd | Killed | 402 | Sending data
| select count(*) from signals where signal_num = 20 | 0.000 |
| 10 | root | localhost:50477 | phd | Query | 0 | init
| show processlist | 0.000 |
| 11 | root | localhost:50489 | NULL | Query | 48 | Filling schema table | SHOW STATUS | 0.000
|
+----+-------------+-----------------+------+---------+------+--------------------------+----------------------------------------------------+----------+
8 rows in set (0.00 sec)
当我尝试创建刷新表时,它挂在那里而没有CPU使用率(即看起来好像什么都没做?)。
根据评论,[编辑],这是统计结果。
MariaDB [(none)]> select distinct COMMENT from information_schema.statistics where TABLE_SCHEMA='phd' and table_schema='signals';
Empty set (0.00 sec)
知道我的数据库发生了什么事吗?
最佳答案
可能您有一个需要关闭的未结交易。
BEGIN;
...
(program still running, but not COMMIT yet)
否则,
SHOW PROCESSLIST
应该显示了一些内容。所以...寻找可能处于这种状态的客户;杀了他们。
关于mysql - 无法在MariaDB 10.2中解锁表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49575859/