matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Bug]: Cannot find tableID xxx in table mo_increment_columns

Open gouhongshen opened this issue 1 year ago • 8 comments

Is there an existing issue for the same bug?

  • [X] I have checked the existing issues.

Branch Name

main

Commit ID

872ebada6

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

https://grafana.cn-dev.matrixone.tech/explore?panes=%7B%22ZzV%22:%7B%22datasource%22:%22aee71632-e6c2-4299-906a-cc73bb62fd3b%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22iotdemo-debug%5C%22,%20app%3D%5C%22default-cn%5C%22%7D%20%7C%3D%20%60Cannot%20find%20tableID%201661008%20in%20table%20mo_increment_columns%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22aee71632-e6c2-4299-906a-cc73bb62fd3b%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%22now-3h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1

Expected Behavior

No response

Steps to Reproduce

百度case 的脚本,一直在dev debug cn 上跑,跑了一两天,插入了 3000W+ 数据,现在一直报 Cannot find tableID 1661008 in table mo_increment_columns 这个错误。

mysql> select relname, rel_id from mo_catalog.mo_tables where reldatabase = "iotdemo";
+----------------------------------------+---------+
| relname                                | rel_id  |
+----------------------------------------+---------+
| sensor_data_with_composite_primary_key | 1661008 |
+----------------------------------------+---------+
1 row in set (0.05 sec)

mysql> show create table sensor_data_with_composite_primary_key;
+----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table                                  | Create Table                                                                                                                                                                                                 |
+----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sensor_data_with_composite_primary_key | CREATE TABLE `sensor_data_with_composite_primary_key` (
`id` INT NOT NULL AUTO_INCREMENT,
`device_id` INT NOT NULL,
`timestamp` TIMESTAMP NOT NULL,
`value` FLOAT NOT NULL,
PRIMARY KEY (`device_id`,`id`)
) |
+----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.14 sec)


### Additional information

_No response_

gouhongshen avatar May 08 '24 14:05 gouhongshen

直接自增主键表,没有记录:

mysql> select col_name, table_id from mo_catalog.mo_increment_columns;
Empty set (0.04 sec)

新建含有自增主键的表,操作可以成功

mysql> create table incr_test(a int auto_increment, b int);
Query OK, 0 rows affected (0.14 sec)

mysql> insert into incr_test(b) values(1),(2),(3);
Query OK, 3 rows affected (0.04 sec)

mysql> select col_name, table_id from mo_catalog.mo_increment_columns;
+------------------+----------+
| col_name         | table_id |
+------------------+----------+
| a                |  1683165 |
| __mo_fake_pk_col |  1683165 |
+------------------+----------+
2 rows in set (0.04 sec)

gouhongshen avatar May 08 '24 15:05 gouhongshen

这个问题有复现流程吗? @gouhongshen

qingxinhome avatar May 09 '24 01:05 qingxinhome

这个问题有复现流程吗? @gouhongshen

正在用脚本复现,目前还没出现

gouhongshen avatar May 10 '24 08:05 gouhongshen

开了trace,等待复现

zhangxu19830126 avatar May 13 '24 12:05 zhangxu19830126

开了 trace,等待复现

zhangxu19830126 avatar May 14 '24 12:05 zhangxu19830126

开了 trace,等待复现

zhangxu19830126 avatar May 15 '24 10:05 zhangxu19830126

开了 trace,等待复现

zhangxu19830126 avatar May 16 '24 13:05 zhangxu19830126

复现:https://grafana.cn-dev.matrixone.tech/explore?panes=%7B%22NWi%22:%7B%22datasource%22:%22aee71632-e6c2-4299-906a-cc73bb62fd3b%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22iotdemo-debug%5C%22%7D%20%7C~%20%60Cannot%20find%20tableID%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22aee71632-e6c2-4299-906a-cc73bb62fd3b%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%22now-12h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1

gouhongshen avatar May 17 '24 02:05 gouhongshen

trace数据因为fatal没有上传,但是从trace看,是出问题的时候读数据没有读到数据。使用新开的相同snapshot的事务,可以读到数据

zhangxu19830126 avatar May 20 '24 13:05 zhangxu19830126

无进展

zhangxu19830126 avatar May 21 '24 13:05 zhangxu19830126

无进展

zhangxu19830126 avatar May 22 '24 13:05 zhangxu19830126

无进展

zhangxu19830126 avatar May 23 '24 12:05 zhangxu19830126

太久没有出现,先降级

gouhongshen avatar May 24 '24 01:05 gouhongshen

之前fix了一个和孤儿事务相关的问题,会导致dup,也会导致自增列对应的地方影响行数是0。有可能也会引起这个地方有问题。可能已经fix了,现在不确定。可以先关闭,后面main上再出现,在reopen

zhangxu19830126 avatar May 29 '24 12:05 zhangxu19830126

#16333

zhangxu19830126 avatar May 29 '24 12:05 zhangxu19830126