BUG #15402: Hot standby server with archive_mode=on keeps initial WALsegments

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #15402: Hot standby server with archive_mode=on keeps initial WALsegments
Дата
Msg-id 15402-a453c90ed4cf88b2@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #15402: Hot standby server with archive_mode=on keepsinitial WAL segments
Список pgsql-bugs
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,


В списке pgsql-bugs по дате отправления:

Предыдущее
От: steven schienschang
Дата:
Сообщение: pgadmin is missing items on the list
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #15402: Hot standby server with archive_mode=on keepsinitial WAL segments