mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
At promotion, don't leave behind a partial segment on the old timeline.
With commit de768844
, a copy of the partial segment was archived with the
.partial suffix, but the original file was still left in pg_xlog, so it
didn't actually solve the problems with archiving the partial segment that
it was supposed to solve. With this patch, the partial segment is renamed
rather than copied, so we only archive it with the .partial suffix.
Also be more robust in detecting if the last segment is already being
archived. Previously I used XLogArchiveIsBusy() for that, but that's not
quite right. With archive_mode='always', there might be a .ready file for
it, and we don't want to rename it to .partial in that case.
The old segment is needed until we're fully committed to the new timeline,
i.e. until we've written the end-of-recovery WAL record and updated the
min recovery point and timeline in the control file. So move the renaming
later in the startup sequence, after all that's been done.
This commit is contained in:
@@ -305,6 +305,7 @@ extern void XLogArchiveForceDone(const char *xlog);
|
||||
extern bool XLogArchiveCheckDone(const char *xlog);
|
||||
extern bool XLogArchiveIsBusy(const char *xlog);
|
||||
extern bool XLogArchiveIsReady(const char *xlog);
|
||||
extern bool XLogArchiveIsReadyOrDone(const char *xlog);
|
||||
extern void XLogArchiveCleanup(const char *xlog);
|
||||
|
||||
#endif /* XLOG_INTERNAL_H */
|
||||
|
Reference in New Issue
Block a user