1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +03:00

Revert "Avoid creating archive status ".ready" files too early"

This reverts commit 515e3d84a0 and equivalent commits in back
branches.  This solution to the problem has a number of problems, so
we'll try again with a different approach.

Per note from Andres Freund

Discussion: https://postgr.es/m/20210831042949.52eqp5xwbxgrfank@alap3.anarazel.de
This commit is contained in:
Alvaro Herrera
2021-09-04 12:14:30 -04:00
parent 87ad491472
commit 96b665083e
8 changed files with 24 additions and 234 deletions

View File

@@ -433,7 +433,7 @@ KeepFileRestoredFromArchive(const char *path, const char *xlogfname)
if (XLogArchiveMode != ARCHIVE_MODE_ALWAYS)
XLogArchiveForceDone(xlogfname);
else
XLogArchiveNotify(xlogfname, true);
XLogArchiveNotify(xlogfname);
/*
* If the existing file was replaced, since walsenders might have it open,
@@ -462,12 +462,9 @@ KeepFileRestoredFromArchive(const char *path, const char *xlogfname)
* by the archiver, e.g. we write 0000000100000001000000C6.ready
* and the archiver then knows to archive XLOGDIR/0000000100000001000000C6,
* then when complete, rename it to 0000000100000001000000C6.done
*
* Optionally, nudge the archiver process so that it'll notice the file we
* create.
*/
void
XLogArchiveNotify(const char *xlog, bool nudge)
XLogArchiveNotify(const char *xlog)
{
char archiveStatusPath[MAXPGPATH];
FILE *fd;
@@ -492,8 +489,8 @@ XLogArchiveNotify(const char *xlog, bool nudge)
return;
}
/* If caller requested, let archiver know it's got work to do */
if (nudge)
/* Notify archiver that it's got something to do */
if (IsUnderPostmaster)
PgArchWakeup();
}
@@ -501,12 +498,12 @@ XLogArchiveNotify(const char *xlog, bool nudge)
* Convenience routine to notify using segment number representation of filename
*/
void
XLogArchiveNotifySeg(XLogSegNo segno, bool nudge)
XLogArchiveNotifySeg(XLogSegNo segno)
{
char xlog[MAXFNAMELEN];
XLogFileName(xlog, ThisTimeLineID, segno, wal_segment_size);
XLogArchiveNotify(xlog, nudge);
XLogArchiveNotify(xlog);
}
/*
@@ -611,7 +608,7 @@ XLogArchiveCheckDone(const char *xlog)
return true;
/* Retry creation of the .ready file */
XLogArchiveNotify(xlog, true);
XLogArchiveNotify(xlog);
return false;
}