登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
轻量养虾,开箱即用!低 Token + 稳定算力,Gitee & 模力方舟联合出品的 PocketClaw 正式开售!点击了解详情~
代码拉取完成,页面将自动刷新
开源项目
>
数据库相关
>
数据库服务
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
443
Star
1.5K
Fork
1.8K
openGauss
/
openGauss-server
代码
Issues
982
Pull Requests
153
Wiki
统计
流水线
服务
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
开发画像分析
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
在synchronous_standby_names='*'时gs_probackup备份失败的问题
已验收
#I6A0GX
缺陷
Movead
创建于
2023-01-11 16:04
【标题描述】: 搭建主备,设置synchronous_standby_names='*'。在备机无法连接时,gs_probackup从主库备份失败。 【测试版本:】 2023-1-11 master分支 【预置条件】: 【操作步骤】(请填写详细的操作步骤): 使用gs_probackup工具执行全量备份 【预期输出】: 备份成功 【实际输出】: ``` lchch@lchch:~/h2/xxxx/data$ gs_probackup backup --instance testBackUp -b FULL --stream --temp-slot -h 127.0.0.1 --password=123qweQWE -B /home/lchch/bug/bk_dir INFO: Backup start, gs_probackup version: 2.4.2, instance: testBackUp, backup ID: ROB9MT, backup mode: FULL, wal mode: STREAM, remote: false, compress-algorithm: none, compress-level: 1 LOG: Backup destination is initialized LOG: This openGauss instance was initialized with data block checksums. Data block corruption will be detected LOG: Database backup start LOG: started streaming WAL at A/3F000000 (timeline 1) [2023-01-11 15:47:17]: check identify system success [2023-01-11 15:47:17]: send START_REPLICATION A/3F000000 success INFO: Cannot parse path "base" [2023-01-11 15:47:17]: keepalive message is received INFO: PGDATA size: 1151MB INFO: Start transferring data files [2023-01-11 15:47:17]: keepalive message is received LOG: Creating page header map "/home/lchch/bug/bk_dir/backups/testBackUp/ROB9MT/page_header_map" [2023-01-11 15:47:20]: keepalive message is received [2023-01-11 15:47:23]: keepalive message is received [2023-01-11 15:47:23]: keepalive message is received INFO: Data files are transferred, time elapsed: 6s [2023-01-11 15:47:26]: keepalive message is received .......大量重复log [2023-01-11 15:49:23]: keepalive message is received [2023-01-11 15:49:23]: keepalive message is received ERROR: query failed: wait 127.0.0.1:10020 timeout expired query was: SELECT pg_catalog.pg_create_restore_point($1) WARNING: backup in progress, stop backup ERROR: query failed: no connection to the server query was: SET client_min_messages = warning; ERROR: query failed: no connection to the server query was: SET datestyle = 'ISO, DMY'; WARNING: query failed: no connection to the server query was: SELECT pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()), current_timestamp(0)::timestamptz, pg_catalog.pg_stop_backup() as lsn ERROR: Failed to send pg_stop_backup query ERROR: pg_stop backup() failed WARNING: Backup ROB9MT is running, setting its status to ERROR lchch@lchch:~/h2/xxxx/data$ ``` 【原因分析】: 1.在设置synchronous_standby_names='*'的情况下,gs_probackup工具连接数据库的stream线程被数据库认为是一个同步备,需要去参与日志一致性确认。在备机停掉时,当前只有gs_probackup工具的stream线程被认为是活跃的同步备。 2.gs_probackup程序没有实时向数据库反馈自己收到的wal位点,因此gs_probackup工具的stream线程不具备同步备的反馈功能。 3.gs_probackup工具在备份结束时,需要向数据库发送select pg_create_restore_point()命令,这个命令会写wal日志,这个命令由于无法完成wal的同步等待,因此会hung。 4.这个命令2min超时后,备份失败。 【解决方案】: 如下代码可以使gs_probackup具备向数据库返回wal位点的功能,可以解决备份失败的问题, 但有一些需求问题,比如gs_probackup是否应该被认为是一个同步备。 ``` Author: movead <lchch1990@sina.cn> Date: Wed Jan 11 10:31:29 2023 +0800 fix #63106375 modify gs_probackup it will feedback wal lsn to master after write to wal file diff --git a/src/bin/pg_basebackup/receivelog.cpp b/src/bin/pg_basebackup/receivelog.cpp index c3accc749..6c315b7e9 100644 --- a/src/bin/pg_basebackup/receivelog.cpp +++ b/src/bin/pg_basebackup/receivelog.cpp @@ -494,7 +494,7 @@ static int DoWALWrite(const char* wal_buf, int len, XLogRecPtr& block_pos, const suspendHeartBeatTimer(); return DO_WAL_DATA_WRITE_ERROR; } - + lastFlushPosition = block_pos; /* Write was successful, advance our position */ bytes_written += bytes_to_write; bytes_left -= bytes_to_write; @@ -586,14 +586,12 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const * so that the master can remove WAL. */ - reportFlushPosition = true; ss_c = snprintf_s(slotcmd, MAXPGPATH, MAXPGPATH - 1, "SLOT \"%s\" ", replication_slot); securec_check_ss_c(ss_c, "", ""); } else { - reportFlushPosition = false; slotcmd[0] = 0; } - + reportFlushPosition = true; if (sysidentifier != NULL) { /* Validate system identifier and timeline hasn't changed */ res = PQexec(conn, "IDENTIFY_SYSTEM"); ```
【标题描述】: 搭建主备,设置synchronous_standby_names='*'。在备机无法连接时,gs_probackup从主库备份失败。 【测试版本:】 2023-1-11 master分支 【预置条件】: 【操作步骤】(请填写详细的操作步骤): 使用gs_probackup工具执行全量备份 【预期输出】: 备份成功 【实际输出】: ``` lchch@lchch:~/h2/xxxx/data$ gs_probackup backup --instance testBackUp -b FULL --stream --temp-slot -h 127.0.0.1 --password=123qweQWE -B /home/lchch/bug/bk_dir INFO: Backup start, gs_probackup version: 2.4.2, instance: testBackUp, backup ID: ROB9MT, backup mode: FULL, wal mode: STREAM, remote: false, compress-algorithm: none, compress-level: 1 LOG: Backup destination is initialized LOG: This openGauss instance was initialized with data block checksums. Data block corruption will be detected LOG: Database backup start LOG: started streaming WAL at A/3F000000 (timeline 1) [2023-01-11 15:47:17]: check identify system success [2023-01-11 15:47:17]: send START_REPLICATION A/3F000000 success INFO: Cannot parse path "base" [2023-01-11 15:47:17]: keepalive message is received INFO: PGDATA size: 1151MB INFO: Start transferring data files [2023-01-11 15:47:17]: keepalive message is received LOG: Creating page header map "/home/lchch/bug/bk_dir/backups/testBackUp/ROB9MT/page_header_map" [2023-01-11 15:47:20]: keepalive message is received [2023-01-11 15:47:23]: keepalive message is received [2023-01-11 15:47:23]: keepalive message is received INFO: Data files are transferred, time elapsed: 6s [2023-01-11 15:47:26]: keepalive message is received .......大量重复log [2023-01-11 15:49:23]: keepalive message is received [2023-01-11 15:49:23]: keepalive message is received ERROR: query failed: wait 127.0.0.1:10020 timeout expired query was: SELECT pg_catalog.pg_create_restore_point($1) WARNING: backup in progress, stop backup ERROR: query failed: no connection to the server query was: SET client_min_messages = warning; ERROR: query failed: no connection to the server query was: SET datestyle = 'ISO, DMY'; WARNING: query failed: no connection to the server query was: SELECT pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()), current_timestamp(0)::timestamptz, pg_catalog.pg_stop_backup() as lsn ERROR: Failed to send pg_stop_backup query ERROR: pg_stop backup() failed WARNING: Backup ROB9MT is running, setting its status to ERROR lchch@lchch:~/h2/xxxx/data$ ``` 【原因分析】: 1.在设置synchronous_standby_names='*'的情况下,gs_probackup工具连接数据库的stream线程被数据库认为是一个同步备,需要去参与日志一致性确认。在备机停掉时,当前只有gs_probackup工具的stream线程被认为是活跃的同步备。 2.gs_probackup程序没有实时向数据库反馈自己收到的wal位点,因此gs_probackup工具的stream线程不具备同步备的反馈功能。 3.gs_probackup工具在备份结束时,需要向数据库发送select pg_create_restore_point()命令,这个命令会写wal日志,这个命令由于无法完成wal的同步等待,因此会hung。 4.这个命令2min超时后,备份失败。 【解决方案】: 如下代码可以使gs_probackup具备向数据库返回wal位点的功能,可以解决备份失败的问题, 但有一些需求问题,比如gs_probackup是否应该被认为是一个同步备。 ``` Author: movead <lchch1990@sina.cn> Date: Wed Jan 11 10:31:29 2023 +0800 fix #63106375 modify gs_probackup it will feedback wal lsn to master after write to wal file diff --git a/src/bin/pg_basebackup/receivelog.cpp b/src/bin/pg_basebackup/receivelog.cpp index c3accc749..6c315b7e9 100644 --- a/src/bin/pg_basebackup/receivelog.cpp +++ b/src/bin/pg_basebackup/receivelog.cpp @@ -494,7 +494,7 @@ static int DoWALWrite(const char* wal_buf, int len, XLogRecPtr& block_pos, const suspendHeartBeatTimer(); return DO_WAL_DATA_WRITE_ERROR; } - + lastFlushPosition = block_pos; /* Write was successful, advance our position */ bytes_written += bytes_to_write; bytes_left -= bytes_to_write; @@ -586,14 +586,12 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const * so that the master can remove WAL. */ - reportFlushPosition = true; ss_c = snprintf_s(slotcmd, MAXPGPATH, MAXPGPATH - 1, "SLOT \"%s\" ", replication_slot); securec_check_ss_c(ss_c, "", ""); } else { - reportFlushPosition = false; slotcmd[0] = 0; } - + reportFlushPosition = true; if (sysidentifier != NULL) { /* Validate system identifier and timeline hasn't changed */ res = PQexec(conn, "IDENTIFY_SYSTEM"); ```
评论 (
6
)
登录
后才可以发表评论
状态
已验收
待办的
已确认
已答复
已取消
挂起
修复中
已完成
待回归
测试中
已验收
负责人
未设置
li_jianqiu
li_jianqiu
负责人
协作者
+负责人
+协作者
标签
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (
-
)
标签 (
-
)
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(4)
C++
1
https://gitee.com/opengauss/openGauss-server.git
git@gitee.com:opengauss/openGauss-server.git
opengauss
openGauss-server
openGauss-server
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册