已关闭
[Bug]: D兼容库部分场景gs_dump后gs_restore失败 #8401
liyangx创建于  8月14日关闭于  8月29日
liyangx成员
8月14日 创建

一、测试类型

SQL功能

二、测试版本

7.0.0LTS

三、问题描述

修复测试时请查看shark模块下 parallel_schedule 是否正常打开相关用例

server 仓 shark 中 varbinary 用例暴露问题(修复后请放开 contrib/shark/parallel_schedule 中 varbinary 用例)

D兼容库中创建包含 bytea 列的表可以成功,且可正常插入 varbinary 类型数据;但使用 gs_dump 导出后,再通过 gs_restore 恢复到另一个 D兼容库时失败。
失败原因是 gs_dump 生成的建表语句中为 bytea 列增加了 COLLATE pg_catalog."binary",而该 collation 仅支持 B-format 数据库,导致 D兼容库恢复失败。

四、操作系统和硬件信息

不限

五、测试环境

企业版单机

六、被测功能

  • D兼容库 bytea 列的 gs_dump/gs_restore 恢复功能
  • D兼容库 identity 列的 gs_dump/gs_restore 恢复功能

七、预置条件

数据库实例已启动,端口示例为 14541。
具备创建数据库和执行 gs_dump/gs_restore 的权限。

八、操作步骤

  1. 创建源库和恢复库:
drop database if exists ly_d_src_fail;
drop database if exists ly_d_restore_fail;
create database ly_d_src_fail dbcompatibility 'D';
create database ly_d_restore_fail dbcompatibility 'D';
  1. 在源库创建 shark 扩展、建表并插入数据:
\c ly_d_src_fail
create extension shark;

create table t_bytea(id int, a bytea);
insert into t_bytea values (5, 'aa'::varbinary);

select id, a from t_bytea;
select id, a::varbinary::varchar from t_bytea;
  1. 在恢复库创建 shark 扩展:
\c ly_d_restore_fail
create extension shark;
  1. 执行导出和恢复:
gs_dump ly_d_src_fail -p 14541 -f /tmp/ly_d_src_fail.tar -F t
echo "dump rc=$?"

gs_restore -d ly_d_restore_fail -p 14541 /tmp/ly_d_src_fail.tar
echo "restore rc=$?"

九、预期输出

gs_dump 成功,gs_restore 也应成功,返回码为 0。
恢复库中 t_bytea 表应创建成功,数据应可正常查询。

select id, a from t_bytea;
select id, a::varbinary::varchar from t_bytea;

十、实际输出

gs_dump 成功,返回码为 0:
gs_restore 失败,返回码为 1:

十一、日志信息

WARNING: errors ignored on restore: 3
restore rc=1

---- ①成功
69367533ea13e310b2f521e7b2364209.png

---② 本issue 失败
(失败无 core 产生)
4cb3e2f52f621c89c4afc754aaad1656.png
dump重放失败日志

[tester2@openGauss58 sda]$ gs_dump ly_d_src_fail -p 14541 -f /tmp/ly_d_src_fail.tar -F t
gs_dump[port='14541'][ly_d_src_fail][2026-08-14 19:42:07]: Begin scanning database.
Progress: [                                                  ] 0% (0/38, cur_step/total_step). reading scProgress: [==================================================] 100% (38/38, cur_step/total_step). finish scanning database
gs_dump[port='14541'][ly_d_src_fail][2026-08-14 19:42:07]: Finish scanning database.
gs_dump[port='14541'][ly_d_src_fail][2026-08-14 19:42:07]: Start dumping objects
Progress: [                                                  ] 0% (0/6112, dumpObjNums/totalObjNums). dumProgress: [==================================================] 100% (6112/6112, dumpObjNums/totalObjNums). dump objects
gs_dump[port='14541'][ly_d_src_fail][2026-08-14 19:42:07]: Finish dumping objects
gs_dump[port='14541'][ly_d_src_fail][2026-08-14 19:42:07]: dump database ly_d_src_fail successfully
gs_dump[port='14541'][ly_d_src_fail][2026-08-14 19:42:07]: total time: 297  ms
[tester2@openGauss58 sda]$ echo "dump rc=$?"
dump rc=0
[tester2@openGauss58 sda]$ gs_restore -d ly_d_restore_fail -p 14541 /tmp/ly_d_src_fail.tar
start restore operation ...
Progress: [================                                  ] 33% (3/9, restored_entries/total_entries).Error while PROCESSING TOC:
Error from TOC entry 577; 1259 21583 TABLE t_bytea tester2
could not execute query: ERROR:  Un-support feature
DETAIL:  this collation only support in B-format database
    Command was: CREATE TABLE t_bytea (
    id integer,
    a bytea COLLATE pg_catalog."binary"
)
WITH (orientation=row, compression=no, coll...
could not execute query: ERROR:  relation "public.t_bytea" does not exist
    Command was: ALTER TABLE public.t_bytea OWNER TO tester2;



Error from TOC entry 6110; 0 21583 TABLE DATA t_bytea tester2
could not execute query: ERROR:  relation "public.t_bytea" does not exist
    Command was: COPY public.t_bytea (id, a) FROM stdin;

Progress: [==================================================] 100% (9/9, restored_entries/total_entries). restore entires
end restore operation ...
WARNING: errors ignored on restore: 3
restore operation successful
total time: 549  ms
[tester2@openGauss58 sda]$ echo "restore rc=$?"
restore rc=1
[tester2@openGauss58 sda]$

---③ server 仓 shark 用例: 执行期望差异
3f6f15ed-a357-49f7-b878-d13fcf3b80e5.png

十二、提单组织

内部开发

十三、测试代码

可见操作步骤

likedislike
Lliyangx成员
8月14日 添加了label:bug
opengauss_bot
opengauss_bot成员
8月14日 评论:

This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.

likedislike
opengauss_botopengauss_bot成员
8月14日 将 TestManager 设为负责人
opengauss_botopengauss_bot成员
8月14日 添加了label:sig/StorageEngine,sig/AI,sig/CM,sig/CloudNative,sig/SecurityTechnology,sig/SQLEngine
opengauss_bot
opengauss_bot成员
8月14日 评论:

Welcome To openGauss Community

Hey @liyangx , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: StorageEngine, AI, CM, CloudNative, SecurityTechnology, SQLEngine ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @Igali, @bihua111, @cailei19, @h_ray, @levy53071, @libiao2024, @lihaixiao, @mrzack, @wangfeihuo, @wuyuechuan, @xiong_xjun, @zhangfengzhi123, @zhangxubo, @zhangzq131, @zjh_hw .

likedislike
Lliyangx成员
8月14日 修改标题为 “[Bug]: D兼容库bytea列gs_dump后gs_restore失败”,原标题为“[Bug]: shark用例由于PR导致差异”
此处折叠了18条事件消息 查看更多
ywzq1161327784ywzq1161327784成员
8月24日 issue状态由 待办的 改变为 已完成
shijuzheng1997
shijuzheng1997成员
8月26日 评论:

20260826开发自验
图片.png

likedislike
shijuzheng1997shijuzheng1997成员
8月26日 issue状态由 已完成 改变为 待回归
sungang14
sungang14成员
8月29日 评论:

【回归人员】sungang14
【回归日期】2026.8.29
【回归版本】openGauss 7.0.0B019
【回归结论】通过
【回归步骤】
1、创建源库和恢复库:
drop database if exists ly_d_src_fail;
drop database if exists ly_d_restore_fail;
create database ly_d_src_fail dbcompatibility 'D';
create database ly_d_restore_fail dbcompatibility 'D';

2、在源库创建 shark 扩展、建表并插入数据:
\c ly_d_src_fail
create extension shark;

create table t_bytea(id int, a bytea);
insert into t_bytea values (5, 'aa'::varbinary);

select id, a from t_bytea;
select id, a::varbinary::varchar from t_bytea;

3、在恢复库创建 shark 扩展:
\c ly_d_restore_fail
create extension shark;

4、执行导出和恢复:
gs_dump ly_d_src_fail -p 14541 -f /tmp/ly_d_src_fail.tar -F t
echo "dump rc=$?"

gs_restore -d ly_d_restore_fail -p 14541 /tmp/ly_d_src_fail.tar
echo "restore rc=$?"
5、恢复库中查询
select id, a from t_bytea;
select id, a::varbinary::varchar from t_bytea;
image.png
image.png
image.png

likedislike
sungang14sungang14成员
8月29日 issue状态由 待回归 改变为 已验收
sungang14sungang14成员
8月29日 关闭了 issue