Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GUC controlling whether to pause recovery if some critical GUCs at replica have smaller value than on primary #503

Merged
merged 5 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/backend/access/transam/xlogrecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ TimestampTz recoveryTargetTime;
const char *recoveryTargetName;
XLogRecPtr recoveryTargetLSN;
int recovery_min_apply_delay = 0;
bool allowReplicaMisconfig = true; /* NEON: GUC is defined in neon extension */

/* options formerly taken from recovery.conf for XLOG streaming */
char *PrimaryConnInfo = NULL;
Expand Down Expand Up @@ -4858,6 +4859,12 @@ RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue
currValue,
minValue)));

if (allowReplicaMisconfig)
{
/* Сontinue replication even though it can cause problems later */
return;
}

SetRecoveryPause(true);

ereport(LOG,
Expand Down Expand Up @@ -4906,7 +4913,17 @@ RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue
ConditionVariableCancelSleep();
}

ereport(FATAL,
if (allowReplicaMisconfig)
ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("Insufficient parameter settings can cause problems during recovery"),
/* Repeat the detail from above so it's easy to find in the log. */
errdetail("%s = %d is a lower setting than on the primary server, where its value was %d.",
param_name,
currValue,
minValue)));
else
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("recovery aborted because of insufficient parameter settings"),
/* Repeat the detail from above so it's easy to find in the log. */
Expand Down
1 change: 1 addition & 0 deletions src/include/access/xlogrecovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extern PGDLLIMPORT char *PrimarySlotName;
extern PGDLLIMPORT char *recoveryRestoreCommand;
extern PGDLLIMPORT char *recoveryEndCommand;
extern PGDLLIMPORT char *archiveCleanupCommand;
extern PGDLLIMPORT bool allowReplicaMisconfig;

/* indirectly set via GUC system */
extern PGDLLIMPORT TransactionId recoveryTargetXid;
Expand Down