修复备机存在写xlog问题

This commit is contained in:
congzhou2603
2025-02-17 12:01:49 +08:00
parent 9792148770
commit 41a9152b98
2 changed files with 7 additions and 1 deletions

View File

@ -350,7 +350,8 @@ void BackgroundWriterMain(void)
* time. E.g. Checkpointer, when active, is barely ever in its
* mainloop and thus makes it hard to log regularly.
*/
if (XLogStandbyInfoActive() && !RecoveryInProgress()) {
if (XLogStandbyInfoActive() && !RecoveryInProgress() &&
(!SS_DISASTER_CLUSTER || SS_DISASTER_CLUSTER && SS_PRIMARY_MODE)) {
TimestampTz timeout = 0;
TimestampTz now = GetCurrentTimestamp();
timeout = TimestampTzPlusMilliseconds(last_snapshot_ts, LOG_SNAPSHOT_INTERVAL_MS);

View File

@ -87,6 +87,11 @@ void XLogBeginInsert(void)
Assert(t_thrd.xlog_cxt.mainrdata_len == 0);
Assert(!(SS_CLUSTER_ONDEMAND_RECOVERY && SS_STANDBY_MODE));
if (SS_STANDBY_MODE) {
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("instance is in standby mode"),
errhint("standby node cannot make new WAL entries in shared storage mode.")));
}
/* cross-check on whether we should be here or not */
if (!XLogInsertAllowed())
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("recovery is in progress"),