Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f6e15a

Browse files
committed
Revert refactoring of restore command code to shell_restore.c
This reverts commits 24c35ec and 57169ad. PreRestoreCommand() andPostRestoreCommand() need to be put closer to the system() call callinga restore_command, as they enable in_restore_command for the startupprocess which would in turn trigger an immediate proc_exit() in theSIGTERM handler. Perhaps we could get rid of this behavior entirely,but 24c35ec has made the window where the flag is enabled much largerthan it was, and any Postgres-like actions (palloc, etc.) taken by codepaths while the flag is enabled could lead to more severe issues in theshutdown processing.Note that curculio has showed that there are much more problems in thisarea, unrelated to this change, actually, hence the issues related tothat had better be addressed first. Keeping the code of HEAD in linewith the stable branches should make that a bit easier.Per discussion with Andres Freund and Nathan Bossart.Discussion:https://postgr.es/m/Y979NR3U5VnWrTwB@paquier.xyz
1 parentb2d0e13 commit2f6e15a

File tree

12 files changed

+215
-219
lines changed

12 files changed

+215
-219
lines changed

‎src/backend/access/transam/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ OBJS = \
1919
multixact.o\
2020
parallel.o\
2121
rmgr.o\
22-
shell_restore.o\
2322
slru.o\
2423
subtrans.o\
2524
timeline.o\

‎src/backend/access/transam/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ backend_sources += files(
77
'multixact.c',
88
'parallel.c',
99
'rmgr.c',
10-
'shell_restore.c',
1110
'slru.c',
1211
'subtrans.c',
1312
'timeline.c',

‎src/backend/access/transam/shell_restore.c

Lines changed: 0 additions & 171 deletions
This file was deleted.

‎src/backend/access/transam/xlog.c

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ static char *GetXLogBuffer(XLogRecPtr ptr, TimeLineID tli);
692692
staticXLogRecPtrXLogBytePosToRecPtr(uint64bytepos);
693693
staticXLogRecPtrXLogBytePosToEndRecPtr(uint64bytepos);
694694
staticuint64XLogRecPtrToBytePos(XLogRecPtrptr);
695-
staticvoidGetOldestRestartPointFileName(char*fname);
696695

697696
staticvoidWALInsertLockAcquire(void);
698697
staticvoidWALInsertLockAcquireExclusive(void);
@@ -4890,12 +4889,10 @@ CleanupAfterArchiveRecovery(TimeLineID EndOfLogTLI, XLogRecPtr EndOfLog,
48904889
* Execute the recovery_end_command, if any.
48914890
*/
48924891
if (recoveryEndCommand&&strcmp(recoveryEndCommand,"")!=0)
4893-
{
4894-
charlastRestartPointFname[MAXFNAMELEN];
4895-
4896-
GetOldestRestartPointFileName(lastRestartPointFname);
4897-
shell_recovery_end(lastRestartPointFname);
4898-
}
4892+
ExecuteRecoveryCommand(recoveryEndCommand,
4893+
"recovery_end_command",
4894+
true,
4895+
WAIT_EVENT_RECOVERY_END_COMMAND);
48994896

49004897
/*
49014898
* We switched to a new timeline. Clean up segments on the old timeline.
@@ -7312,12 +7309,10 @@ CreateRestartPoint(int flags)
73127309
* Finally, execute archive_cleanup_command, if any.
73137310
*/
73147311
if (archiveCleanupCommand&&strcmp(archiveCleanupCommand,"")!=0)
7315-
{
7316-
charlastRestartPointFname[MAXFNAMELEN];
7317-
7318-
GetOldestRestartPointFileName(lastRestartPointFname);
7319-
shell_archive_cleanup(lastRestartPointFname);
7320-
}
7312+
ExecuteRecoveryCommand(archiveCleanupCommand,
7313+
"archive_cleanup_command",
7314+
false,
7315+
WAIT_EVENT_ARCHIVE_CLEANUP_COMMAND);
73217316

73227317
return true;
73237318
}
@@ -8894,22 +8889,6 @@ GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli)
88948889
LWLockRelease(ControlFileLock);
88958890
}
88968891

8897-
/*
8898-
* Returns the WAL file name for the last checkpoint or restartpoint. This is
8899-
* the oldest WAL file that we still need if we have to restart recovery.
8900-
*/
8901-
staticvoid
8902-
GetOldestRestartPointFileName(char*fname)
8903-
{
8904-
XLogRecPtrrestartRedoPtr;
8905-
TimeLineIDrestartTli;
8906-
XLogSegNorestartSegNo;
8907-
8908-
GetOldestRestartPoint(&restartRedoPtr,&restartTli);
8909-
XLByteToSeg(restartRedoPtr,restartSegNo,wal_segment_size);
8910-
XLogFileName(fname,restartTli,restartSegNo,wal_segment_size);
8911-
}
8912-
89138892
/* Thin wrapper around ShutdownWalRcv(). */
89148893
void
89158894
XLogShutdownWalRcv(void)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp