From 5371d0d06b14d31b44f5c203fca05546fa004e56 Mon Sep 17 00:00:00 2001 From: movead Date: Sat, 28 Jan 2023 14:24:26 +0800 Subject: [PATCH 1/2] modify gs_probackup it will feedback wal lsn to master after write to wal file --- src/bin/pg_basebackup/receivelog.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_basebackup/receivelog.cpp b/src/bin/pg_basebackup/receivelog.cpp index 36a8d3f2cd..945bd2250d 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"); -- Gitee From fde67e6c8bd7fd274f2813bba0bfdc4fbad7ded2 Mon Sep 17 00:00:00 2001 From: movead Date: Mon, 13 Feb 2023 12:01:29 +0800 Subject: [PATCH 2/2] change var lastFlushPosition set location --- src/bin/pg_basebackup/receivelog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_basebackup/receivelog.cpp b/src/bin/pg_basebackup/receivelog.cpp index 945bd2250d..2f970bff87 100644 --- a/src/bin/pg_basebackup/receivelog.cpp +++ b/src/bin/pg_basebackup/receivelog.cpp @@ -494,12 +494,12 @@ 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; XLByteAdvance(block_pos, bytes_to_write); xlogoff += bytes_to_write; + lastFlushPosition = block_pos; /* Did we reach the end of a WAL segment? */ if (block_pos % XLogSegSize == 0) { -- Gitee