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

Commitc40bb11

Browse files
committed
Prevent starting a standalone backend with standby_mode on.
This can't really work because standby_mode expects there to be moreWAL arriving, which there will not ever be because there's no WALreceiver process to fetch it. Moreover, if standby_mode is on thenhot standby might also be turned on, causing even more strangenessbecause that expects read-only sessions to be executing in parallel.Bernd Helmle reported a case where btree_xlog_delete_get_latestRemovedXidgot confused, but rather than band-aiding individual problems it seemsbest to prevent getting anywhere near this state in the first place.Back-patch to all supported branches.In passing, also fix some omissions of errcodes in other ereport's inreadRecoveryCommandFile().Michael Paquier (errcode hacking by me)Discussion: <00F0B2CEF6D0CEF8A90119D4@eje.credativ.lan>
1 parent3aa233f commitc40bb11

File tree

1 file changed

+19
-5
lines changed
  • src/backend/access/transam

1 file changed

+19
-5
lines changed

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4980,7 +4980,8 @@ readRecoveryCommandFile(void)
49804980
rtli= (TimeLineID)strtoul(item->value,NULL,0);
49814981
if (errno==EINVAL||errno==ERANGE)
49824982
ereport(FATAL,
4983-
(errmsg("recovery_target_timeline is not a valid number: \"%s\"",
4983+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4984+
errmsg("recovery_target_timeline is not a valid number: \"%s\"",
49844985
item->value)));
49854986
}
49864987
if (rtli)
@@ -4996,7 +4997,8 @@ readRecoveryCommandFile(void)
49964997
recoveryTargetXid= (TransactionId)strtoul(item->value,NULL,0);
49974998
if (errno==EINVAL||errno==ERANGE)
49984999
ereport(FATAL,
4999-
(errmsg("recovery_target_xid is not a valid number: \"%s\"",
5000+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5001+
errmsg("recovery_target_xid is not a valid number: \"%s\"",
50005002
item->value)));
50015003
ereport(DEBUG2,
50025004
(errmsg_internal("recovery_target_xid = %u",
@@ -5111,7 +5113,8 @@ readRecoveryCommandFile(void)
51115113
}
51125114
else
51135115
ereport(FATAL,
5114-
(errmsg("unrecognized recovery parameter \"%s\"",
5116+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5117+
errmsg("unrecognized recovery parameter \"%s\"",
51155118
item->name)));
51165119
}
51175120

@@ -5130,7 +5133,8 @@ readRecoveryCommandFile(void)
51305133
{
51315134
if (recoveryRestoreCommand==NULL)
51325135
ereport(FATAL,
5133-
(errmsg("recovery command file \"%s\" must specify restore_command when standby mode is not enabled",
5136+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5137+
errmsg("recovery command file \"%s\" must specify restore_command when standby mode is not enabled",
51345138
RECOVERY_COMMAND_FILE)));
51355139
}
51365140

@@ -5144,6 +5148,15 @@ readRecoveryCommandFile(void)
51445148
!EnableHotStandby)
51455149
recoveryTargetAction=RECOVERY_TARGET_ACTION_SHUTDOWN;
51465150

5151+
/*
5152+
* We don't support standby_mode in standalone backends; that requires
5153+
* other processes such as the WAL receiver to be alive.
5154+
*/
5155+
if (StandbyModeRequested&& !IsUnderPostmaster)
5156+
ereport(FATAL,
5157+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5158+
errmsg("standby mode is not supported by single-user servers")));
5159+
51475160
/* Enable fetching from archive recovery area */
51485161
ArchiveRecoveryRequested= true;
51495162

@@ -5160,7 +5173,8 @@ readRecoveryCommandFile(void)
51605173
/* Timeline 1 does not have a history file, all else should */
51615174
if (rtli!=1&& !existsTimeLineHistory(rtli))
51625175
ereport(FATAL,
5163-
(errmsg("recovery target timeline %u does not exist",
5176+
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5177+
errmsg("recovery target timeline %u does not exist",
51645178
rtli)));
51655179
recoveryTargetTLI=rtli;
51665180
recoveryTargetIsLatest= false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp