表结构未变动闪回失败报表结构改变

【 使用环境 】测试环境
【 OB or 其他组件 】
【 使用版本 】4.2.1.10
obclient(root@ldf)[test]> select version();
±------------------------------+
| version() |
±------------------------------+
| 5.7.25-OceanBase_CE-v4.2.1.10 |
±------------------------------+
1 row in set (0.001 sec)

obclient(root@ldf)[test]> select * from untab;
±-----±-----+
| c1 | c2 |
±-----±-----+
| 100 | a |
| 200 | b |
| 300 | c |
±-----±-----+
3 rows in set (0.001 sec)

obclient(root@ldf)[test]> select time_to_usec(CURRENT_TIMESTAMP()),CURRENT_TIMESTAMP();
±----------------------------------±--------------------+
| time_to_usec(CURRENT_TIMESTAMP()) | CURRENT_TIMESTAMP() |
±----------------------------------±--------------------+
| 1750840043000000 | 2025-06-25 16:27:23 |
±----------------------------------±--------------------+
1 row in set (0.000 sec)

obclient(root@ldf)[test]> delete from untab;
Query OK, 3 rows affected (0.003 sec)

obclient(root@ldf)[test]> select time_to_usec(CURRENT_TIMESTAMP()),CURRENT_TIMESTAMP();
±----------------------------------±--------------------+
| time_to_usec(CURRENT_TIMESTAMP()) | CURRENT_TIMESTAMP() |
±----------------------------------±--------------------+
| 1750840052000000 | 2025-06-25 16:27:32 |
±----------------------------------±--------------------+
1 row in set (0.000 sec)

obclient(root@ldf)[test]> select * from untab as of snapshot 1750840043000000;
ERROR 1412 (HY000): Unable to read data – Table definition has changed

这个闪回失败,说是表结构改变,表结构没动过。这个是社区版这个版本的bug吗

2 个赞

提供一下操作的这个时间的observer.log的日志信息
查一下这个 看看是否有ddl的变更操作
select o.tenant_id, o.gmt_create, o.database_id, d.database_name, o.table_id, t.table_name, o.operation_type, o.ddl_stmt_str
from oceanbase.__all_ddl_operation o left join oceanbase.__all_database d on (o.database_id=d.database_id)
left join oceanbase.__all_table t on (o.table_id=t.table_id)
where o.ddl_stmt_str != ‘’ and t.table_name = ‘t1’
order by o.gmt_create ;

2 个赞

插眼

问题有解决吗?

老师 我又复现了一把,日志在附件。
ob.tar.gz (18.7 MB)

obclient(root@ldf)[test]> select * from untab;
Empty set (0.000 sec)

obclient(root@ldf)[test]> select time_to_usec(CURRENT_TIMESTAMP()),CURRENT_TIMESTAMP();
±----------------------------------±--------------------+
| time_to_usec(CURRENT_TIMESTAMP()) | CURRENT_TIMESTAMP() |
±----------------------------------±--------------------+
| 1750902283000000 | 2025-06-26 09:44:43 |
±----------------------------------±--------------------+
1 row in set (0.001 sec)

obclient(root@ldf)[test]> insert into untab values(100,‘aa’);
Query OK, 1 row affected (0.005 sec)

obclient(root@ldf)[test]> insert into untab values(200,‘bb’);
Query OK, 1 row affected (0.001 sec)

obclient(root@ldf)[test]> select time_to_usec(CURRENT_TIMESTAMP()),CURRENT_TIMESTAMP();
±----------------------------------±--------------------+
| time_to_usec(CURRENT_TIMESTAMP()) | CURRENT_TIMESTAMP() |
±----------------------------------±--------------------+
| 1750902304000000 | 2025-06-26 09:45:04 |
±----------------------------------±--------------------+
1 row in set (0.000 sec)

obclient(root@ldf)[test]> select * from untab as of snapshot 1750902283000000;
ERROR 1412 (HY000): Unable to read data – Table definition has changed

#####DDL查询
obclient(root@ldf)[oceanbase]> select o.tenant_id, o.gmt_create, o.database_id, d.database_name, o.table_id, t.table_name, o.operation_type, o.ddl_stmt_str
→ from oceanbase.__all_ddl_operation o left join oceanbase.__all_database d on (o.database_id=d.database_id)
→ left join oceanbase.__all_table t on (o.table_id=t.table_id)
→ where o.ddl_stmt_str != ‘’ and t.table_name = ‘untab’
→ order by o.gmt_create ;
±----------±---------------------------±------------±--------------±---------±-----------±---------------±------------------------------------------+
| tenant_id | gmt_create | database_id | database_name | table_id | table_name | operation_type | ddl_stmt_str |
±----------±---------------------------±------------±--------------±---------±-----------±---------------±------------------------------------------+
| 0 | 2025-06-25 15:15:00.536201 | 500001 | test | 500056 | untab | 4 | create table untab(c1 int,c2 varchar(10)) |
±----------±---------------------------±------------±--------------±---------±-----------±---------------±------------------------------------------+
1 row in set (0.002 sec)

1 个赞

show parameters like ‘%undo_retention%’ 查一下配置项

SHOW VARIABLES LIKE ‘%recyclebin%’; 这个变量查一下

obclient(root@ldf)[test]> show parameters like ‘%undo%’;
±------±---------±--------------±---------±---------------±----------±------±-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±--------±-------±--------±------------------+
| zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level |
±------±---------±--------------±---------±---------------±----------±------±-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±--------±-------±--------±------------------+
| zone1 | observer | 192.168.96.12 | 2882 | undo_retention | NULL | 600 | the low threshold value of undo retention. The system retains undo for at least the time specified in this config when active txn protection is banned. Range: [0, 4294967295] | TENANT | TENANT | DEFAULT | DYNAMIC_EFFECTIVE |
±------±---------±--------------±---------±---------------±----------±------±-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±--------±-------±--------±------------------+
1 row in set (0.004 sec)

obclient(root@ldf)[test]> show variables like ‘%recyclebin%’;
±--------------±------+
| Variable_name | Value |
±--------------±------+
| recyclebin | OFF |
±--------------±------+
1 row in set (0.003 sec)

同样的操作在3.2.3上就可以正常返回,是这个版本的bug吗

看着你转化的时间有问题 时间转化有点和oracle模式不一样 你看看

SELECT time_to_usec(CURRENT_TIMESTAMP()) * 1000

你的时间少了 乘以 1000呢

1 个赞

https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000218071

可以参考这个的

ok。
3.x是微妙,到4变成纳秒了。

闪回查询多数据库版本-V3.2.3-OceanBase 数据库文档-分布式数据库使用文档

1 个赞

我再试一下

具体以4.x的为主 时间转化有点问题 我们也试了一下 这样是没有问题

1 个赞