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

Commit8e971a4

Browse files
michaelpqpull[bot]
authored andcommitted
Tweak pg_promote() to report failures on kill() or postmaster failures
Since its introduction in1007465, pg_promote() has been returninga false status in three cases:- SIGUSR1 not sent to the postmaster process.- Postmaster death during standby promotion.- Standby not promoted within the specified wait time.An application calling this function will have a hard time understandingwhat a false state returned actually means.Per discussion, this switches the two first states to fail rather thanreturn a "false" status, making the second case more consistent with theexisting CHECK_FOR_INTERRUPTS in the wait loop. False is only returnedwhen the promotion is not completed within the specified time (60s bydefault).Author: Ashutosh SharmaReviewed-by: Fujii Masao, Laurenz Albe, Michael PaquierDiscussion:https://postgr.es/m/CAE9k0P=QTrwptL0t4J0fuBRDDjgsT-0PVKd-ikd96i1hyL7Bcg@mail.gmail.com
1 parent61ba865 commit8e971a4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,10 @@ pg_promote(PG_FUNCTION_ARGS)
711711
/* signal the postmaster */
712712
if (kill(PostmasterPid,SIGUSR1)!=0)
713713
{
714-
ereport(WARNING,
715-
(errmsg("failed to send signal to postmaster: %m")));
716714
(void)unlink(PROMOTE_SIGNAL_FILE);
717-
PG_RETURN_BOOL(false);
715+
ereport(ERROR,
716+
(errcode(ERRCODE_SYSTEM_ERROR),
717+
errmsg("failed to send signal to postmaster: %m")));
718718
}
719719

720720
/* return immediately if waiting was not requested */
@@ -744,7 +744,10 @@ pg_promote(PG_FUNCTION_ARGS)
744744
* necessity for manual cleanup of all postmaster children.
745745
*/
746746
if (rc&WL_POSTMASTER_DEATH)
747-
PG_RETURN_BOOL(false);
747+
ereport(FATAL,
748+
(errcode(ERRCODE_ADMIN_SHUTDOWN),
749+
errmsg("terminating connection due to unexpected postmaster exit"),
750+
errcontext("while waiting on promotion")));
748751
}
749752

750753
ereport(WARNING,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp