Open DanielZhangQD opened 2 months ago
select reldatabase_id, rel_id, relname from mo_catalog.mo_tables where reldatabase="cloud_device" and relname like "%real_time%";
+----------------+---------+-----------------------------+
| reldatabase_id | rel_id | relname |
+----------------+---------+-----------------------------+
| 412255 | 1105947 | real_time_position |
| 412255 | 449608 | real_time_position2 |
| 412255 | 449610 | real_time_position_20240808 |
| 412255 | 412296 | real_time_position3 |
+----------------+---------+-----------------------------+
4 rows in set (0.08 sec)
2024-08-14 16:58:50.270 | {"level":"ERROR","time":"2024/08/14 08:58:50.270400 +0000","caller":"disttae/stats.go:479","msg":"cannot get table by ID {412255 412296}"}
2024-08-14 16:58:41.248 | {"level":"ERROR","time":"2024/08/14 08:58:41.248247 +0000","caller":"disttae/stats.go:479","msg":"cannot get table by ID {412255 412296}"}
2024-08-14 16:58:26.233 | {"level":"ERROR","time":"2024/08/14 08:58:26.233910 +0000","caller":"disttae/stats.go:479","msg":"cannot get table by ID {412255 449608}"}
2024-08-14 16:58:26.233 | {"level":"ERROR","time":"2024/08/14 08:58:26.233910 +0000","caller":"disttae/stats.go:479","msg":"cannot get table by ID {412255 412296}"}
存在这样的错误,使得无法获取 stats,rows 就为 0 了。
其实 real_time_position2,real_time_position3
这两张表的 mo_table_size
和 mo_table_rows
都遇到了这个问题,为啥 size 不为零呢?因为 table size = origin table size + index table size
,显示出的 size 都是 index 的 size,其本表的 size 返回的依然是 0. mo_table_rows
没有这个修改,只统计本表的 rows,所以就是 0.
问题找到了,alter table rename 升级处理有问题。导致在 cc.tables.data
中找不到rename 过的 table.
也许不是升级的问题,也可能是早期存在的一个 bug 被 fix 了或者 ignore 了,任何早于这个时间段的 rename 都会出问题。
step to repro:
0. switch to v1.1.1, create table, insert rows, alter table rename. checkpoint.
1. switch to v1.2.0, mo_table_rows ==> 0
也许在不同的中间版本中也需要 insert 一些数据和落盘。
在做 tombstone 相关
Is there an existing issue for the same bug?
Branch Name
1.2-dev
Commit ID
v1.2.2-b44e7327a-2024-07-15
Other Environment Information
Actual Behavior
Expected Behavior
mo_table_rows
returns the same result withselect count(*)
Steps to Reproduce
Additional information
No response