pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: harukat@sraoss.co.jp
Subject: BUG #15402: Hot standby server with archive_mode=on keeps initial WAL segments
Date: Wed, 26 Sep 2018 03:26:50 +0000
Message-ID: <15402-a453c90ed4cf88b2@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15402
Logged by:          TAKATSUKA Haruka
Email address:      harukat@sraoss.co.jp
PostgreSQL version: 11beta4
Operating system:   Linux (CentOS 6)
Description:        

Hello PostgreSQL hackers,

A hot standby server with “archive_mode = on” keeps initial WAL segment
files
that copied by pg_basebackup. It shows the following status.
000000010000000000000042 will be kept forever in this case.

$ ls data_primary/pg_wal/
000000010000000000000042.00000028.backup  00000001000000000000004D
000000010000000000000048                  00000001000000000000004E
000000010000000000000049                  00000001000000000000004F
00000001000000000000004A                  000000010000000000000050
00000001000000000000004B                  000000010000000000000051
00000001000000000000004C                  archive_status
$ ls data_standby/pg_wal/
000000010000000000000042  00000001000000000000004B 
00000001000000000000004F
000000010000000000000048  00000001000000000000004C  archive_status
000000010000000000000049  00000001000000000000004D
00000001000000000000004A  00000001000000000000004E
$ ls data_standby/pg_wal/archive_status/
000000010000000000000042.ready  00000001000000000000004A.done
000000010000000000000048.done   00000001000000000000004B.done
000000010000000000000049.done   00000001000000000000004C.done

Though I understand renaming the .ready to .done manually can clean it,
I would like to fix the server code like the following patch.
I'd appreciate if you would consider that.

- - - - -
diff --git a/src/backend/access/transam/xlog.c
b/src/backend/access/transam/xlog.c
index 5abaeb0..191ba60 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -3963,7 +3963,9 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr
RedoRecPtr, XLogRecPtr endptr)
 		 */
 		if (strcmp(xlde->d_name + 8, lastoff + 8) <= 0)
 		{
-			if (XLogArchiveCheckDone(xlde->d_name))
+			if (XLogArchiveCheckDone(xlde->d_name) ||
+			    (XLogArchiveMode != ARCHIVE_MODE_ALWAYS &&
+			     XLogCtl->SharedRecoveryInProgress))
 			{
 				/* Update the last removed location in shared memory first */
 				UpdateLastRemovedPtr(xlde->d_name);
- - - - - -

Thanks,



view thread (9+ messages)  latest in thread

Message-ID: <15402-a453c90ed4cf88b2@postgresql.org>
Permalink:  ../15402-a453c90ed4cf88b2@postgresql.org/
Also on:    postgresql.org/message-id/15402-a453c90ed4cf88b2@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, harukat@sraoss.co.jp
  Subject: Re: BUG #15402: Hot standby server with archive_mode=on keeps initial WAL segments
  In-Reply-To: <15402-a453c90ed4cf88b2@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox