matrixorigin / matrixone

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

[Bug]: Unknown database test01 #19867

Open daviszhen opened 1 week ago

daviszhen commented 1 week ago

Is there an existing issue for the same bug?

Branch Name

main

Commit ID

latest

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

2024-11-07 04:42:08 ERROR Executor:269 - [/home/runner/work/matrixone/matrixone/head/test/distributed/cases/snapshot/cluster_level_snapshot_restore_view_to_nonsys.sql][row:397][restore account acc01 from snapshot sp06;] was executed failed, con[id=0, user=dump, ***
2024-11-07 04:42:08 ERROR Executor:271 - [EXPECT RESULT]:
null
2024-11-07 04:42:08 ERROR Executor:272 - [ACTUAL RESULT]:
Unknown database test01
2024-11-07 04:42:08 INFO  Executor:692 - select mo_ctl('cn','synccommit','') with sys user[dump] successfully.
2024-11-07 04:42:08 ERROR Executor:269 - [/home/runner/work/matrixone/matrixone/head/test/distributed/cases/snapshot/cluster_level_snapshot_restore_view_to_nonsys.sql][row:400][select * from test01.EmployeeSalaryRanking;] was executed failed, con[id=1, user=acc01:test_account, ***
2024-11-07 04:42:08 ERROR Executor:271 - [EXPECT RESULT]:
employeeid    employeename    salary    salaryrank
3    Charlie    90000.00    1
2    Bob    80000.00    2
5    Eva    75000.00    3
1    Alice    70000.00    4
4    David    65000.00    5
2024-11-07 04:42:08 ERROR Executor:272 - [ACTUAL RESULT]:
Unknown database test01
2024-11-07 04:42:08 ERROR Executor:269 - [/home/runner/work/matrixone/matrixone/head/test/distributed/cases/snapshot/cluster_level_snapshot_restore_view_to_nonsys.sql][row:401][drop database test01;] was executed failed, con[id=1, user=acc01:test_account, ***
2024-11-07 04:42:08 ERROR Executor:271 - [EXPECT RESULT]:
null
2024-11-07 04:42:08 ERROR Executor:272 - [ACTUAL RESULT]:
Can't drop database 'test01'; database doesn't exist
2024-11-07 04:42:08 INFO  Executor:692 - select mo_ctl('cn','synccommit','') with sys user[dump] successfully.
2024-11-07 04:42:08 INFO  Executor:692 - select mo_ctl('cn','synccommit','') with sys user[dump] successfully.
2024-11-07 04:42:08 INFO  Executor:692 - select mo_ctl('cn','synccommit','') with sys user[dump] successfully.

Expected Behavior

no failure

Steps to Reproduce

https://github.com/matrixorigin/matrixone/actions/runs/11716507722/job/32634687612?pr=19819

Additional information

No response

YANGGMM commented 1 week ago
image
YANGGMM commented 1 week ago

frontend/snapshot.go:667","msg":"[019304ee-052a-7d67-814e-bb995f30fd9f_sp06_mock] start to restore db: test01, restore timestamp: 1730954528007055169" frontend/snapshot.go:1380","msg":"[019304ee-052a-7d67-814e-bb995f30fd9f_sp06_mock] get create database test01 sql: select datname, dat_createsql from mo_catalog.mo_database {snapshot = '019304ee-052a-7d67-814e-bb995f30fd9f_sp06_mock'} where datname = 'test01' and account_id = 10110"

"frontend/snapshot.go:1388","msg":"error: Unknown database test01

image

根据时间戳show database的时候能得到database test01, 然后根据快照的时间戳去mo_database表里面去查database test01的create sql的时候没有查到,然后报这个错误了。

YANGGMM commented 1 week ago

@triump2020 麻烦看一下

triump2020 commented 6 days ago
企业微信截图_69b2377b-f5fb-4b28-a6f2-db502815c638

原因是: 同一个事务id , 同一个snapsshot ts 拿到的是不同的 partition state , 但是为啥没有从tbl.partitionState 缓存中拿,是根本原因.

daviszhen commented 20 hours ago

https://github.com/matrixorigin/matrixone/actions/runs/11829705669/job/32961978272?pr=20062