matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.78k stars 276 forks source link

[Bug]: show accounts; snapshot_size is 0 #19803

Open PHK-20 opened 2 days ago

PHK-20 commented 2 days ago

Is there an existing issue for the same bug?

Branch Name

717b5ca84

Commit ID

717b5ca84

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

实例创建快照后,创建了一个test表,往里面插入了1kw条数据,然后删除了一半数据,过了4、5小时,再恢复了快照 show accounts还是没有snapshot_size

show accounts
image
SELECT * FROM mo_snapshots WHERE `account_name` like '%0192e6ce-8a10-7a26-a6f5-1e6f6fa0e0b7%' LIMIT 100

快照:

image

Expected Behavior

show accounts; snapshot_size不为0

Steps to Reproduce

1、登录实例


mysql -h freetier-02.cn-hangzhou.cluster.cn-dev.matrixone.tech -P 6001 -u 0192e6ce-8a10-7a26-a6f5-1e6f6fa0e0b7:admin:accountadmin  -pPhk123456

2、随机插入数据
```sql
use test;
insert into metric select
"metric_name_" || (result % 22),
date_add('2024-08-01 00:00:00', interval cast(result / 1000 as int) SECOND),
  result,
  "node_" ||  (result % 10),
  "role_" || (result % 3),
  "account_" || (result % 100),
  "type_" || (result % 10)
from generate_series(1,10000000) g;

3、 打快照 4、 删除一半数据

delete from metric limit 5000000

4、 等4、5个小时gc 5、show accounts



### Additional information

_No response_
LeftHandCold commented 2 days ago

集群异常导致gc异常。 https://github.com/matrixorigin/MO-Cloud/issues/4363

LeftHandCold commented 1 day ago

等dev集群恢复gc

LeftHandCold commented 18 hours ago

已经恢复

LeftHandCold commented 14 hours ago

恢复后 snapshot size还是0。 原因是account的数据11月1日已经全部load 和 delete,后续没有更新,但是最老的快照是11月05日的,这时候不更新account的data是不会有任何数据被GC的,所以snapshot size为0,我drop table后snapshot size就可以对上了。

image