matrixorigin / matrixone

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

[Bug]: show snapshots has the mock snapshot record. #17270

Closed Ariznawlll closed 2 days ago

Ariznawlll commented 2 days ago

Is there an existing issue for the same bug?

Branch Name

main

Commit ID

cb3bf738b355215718c4b90d54ea8bcfd1c1c0ae

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

image

Expected Behavior

No response

Steps to Reproduce

drop database if exists db07;
create database db07;
use db07;
create table table01 (col1 int auto_increment, col2 enum ('a','b','c'));
insert into table01 values(1,'a');
insert into table01 values(2, 'b');
create table table02 (col1 int, col2 enum ('a','b','c'));
insert into table02 values(1,'a');
insert into table02 values(2, 'b');
drop database if exists db08;
create database db08;
use db08;
create table index01(col1 int,key key1(col1));
insert into index01 values (1);
insert into index01 values (2);
show create table db07.table02;

drop snapshot if exists sp14;
create snapshot sp14 for cluster;

use db07;
drop table table01;
alter table table02 add column newC int first;
show create table table02;
show create table table02 {snapshot = 'sp14'};
drop database db08;

drop snapshot if exists sp15;
create snapshot sp15 for cluster;

restore account sys database db07 from snapshot sp15;
restore account sys database db08 from snapshot sp15;    

show snapshots; -->出错位置,必现

Additional information

No response

YANGGMM commented 2 days ago
mysql> restore account sys database db08 from snapshot sp15;    
ERROR 1049 (HY000): invalid database db08
mysql> 
mysql> show snapshots;
+------------------------------------------------+----------------------------+----------------+--------------+---------------+------------+
| SNAPSHOT_NAME                                  | TIMESTAMP                  | SNAPSHOT_LEVEL | ACCOUNT_NAME | DATABASE_NAME | TABLE_NAME |
+------------------------------------------------+----------------------------+----------------+--------------+---------------+------------+
| sp15                                           | 2024-07-02 08:22:41.997792 | cluster        |              |               |            |
| 01907289-f472-78e5-9967-b67d4aee9fd3_sp15_mock | 2024-07-02 08:22:41.997792 | account        | sys          |               |            |
| sp14                                           | 2024-07-02 08:22:41.904073 | cluster        |              |               |            |
+------------------------------------------------+----------------------------+----------------+--------------+---------------+------------+
3 rows in set (0.00 sec)
Ariznawlll commented 2 days ago

testing

Ariznawlll commented 2 days ago

commit-id:580f61afcfd273b2e5b2326e432f125575a5b309

image

test done.