因按需回放redo阶段执行部分DDL报错的问题

问题现象

按需回放redo阶段,执行部分DDL报错,报错信息如下:

openGauss=# create database tpcc1;
ERROR:  only support INSERT/UPDATE/DELETE/SELECT/SET/SHOW/CALL, and ALTER/CREATE/DROP on Table/Index/View/Procedure/Schema, and ALTER on Database during SS on-demand recovery, command 752

定位方法

查询ondemand_recovery_status视图,确认当前节点处于按需回放状态,对应in_ondemand_recovery字段查询为trueondemand_recovery_status字段状态为ONDEMAND_RECOVERY_REDO

openGauss=# select * from ondemand_recovery_status();
-[ RECORD 1 ]---------------+-----------------------
primary_checkpoint_redo_lsn | 0/0
realtime_build_replayed_lsn | B/24C39FA0
hashmap_used_blocks         | 9928223
hashmap_total_blocks        | 70640909
trxn_queue_blocks           | 0
seg_queue_blocks            | 0
in_ondemand_recovery        | t
ondemand_recovery_status    | ONDEMAND_RECOVERY_REDO
realtime_build_status       | DISABLED
recovery_pause_status       | NOT PAUSE
record_item_num             | 57001
record_item_mbytes          | 648

问题根因

主节点当前处于按需回放状态,支持有限的DDL(详见特性增强),此现象符合预期。

解决方案

等待按需回放redo阶段结束,之后执行SQL无限制。按需回放redo阶段进度,可以通过查询ondemand_recovery_status视图中的hashmap_used_blocks字段判断。当hashmap_used_blocks的值为0时,会进行全量checkpoint,之后退出按需回放,in_ondemand_recovery字段为falseondemand_recovery_status字段为normal

意见反馈
编组 3备份
    openGauss 2024-12-23 00:51:56
    取消