!1272 回合禁用备机归档的代码
Merge pull request !1272 from Cross-罗/standby_archive
This commit is contained in:
@ -2785,12 +2785,16 @@ static int ServerLoop(void)
|
||||
}
|
||||
|
||||
/* If we have lost the archiver, try to start a new one */
|
||||
if (XLogArchivingActive() && g_instance.pid_cxt.PgArchPID == 0 && !dummyStandbyMode) {
|
||||
if (pmState == PM_RUN || pmState == PM_HOT_STANDBY || pmState == PM_RECOVERY) {
|
||||
if (XLogArchivingActive() && g_instance.pid_cxt.PgArchPID == 0 && !dummyStandbyMode){
|
||||
if (pmState == PM_RUN) {
|
||||
g_instance.pid_cxt.PgArchPID = pgarch_start();
|
||||
} else if (pmState == PM_HOT_STANDBY) {
|
||||
obs_slot = getObsReplicationSlot();
|
||||
if (obs_slot != NULL) {
|
||||
g_instance.pid_cxt.PgArchPID = pgarch_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have lost the stats collector, try to start a new one */
|
||||
if (g_instance.pid_cxt.PgStatPID == 0 && (pmState == PM_RUN || pmState == PM_HOT_STANDBY) && !dummyStandbyMode)
|
||||
g_instance.pid_cxt.PgStatPID = pgstat_start();
|
||||
|
||||
@ -125,10 +125,8 @@ const char *g_reserve_param[RESERVE_SIZE] = {
|
||||
"archive_dest",
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
"recovery_min_apply_delay",
|
||||
"archive_mode",
|
||||
"sync_config_strategy"
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
#endif
|
||||
|
||||
@ -3197,6 +3197,7 @@ static int WalSndLoop(WalSndSendDataCallback send_data)
|
||||
/* Check for input from the client */
|
||||
ProcessRepliesIfAny();
|
||||
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
/* Only the primary can send the archive lsn to standby */
|
||||
load_server_mode();
|
||||
if (t_thrd.xlog_cxt.server_mode == PRIMARY_MODE && IsValidArchiverStandby(t_thrd.walsender_cxt.MyWalSnd)) {
|
||||
@ -3230,6 +3231,7 @@ static int WalSndLoop(WalSndSendDataCallback send_data)
|
||||
WalSndSendArchiveLsn2Standby(t_thrd.walsender_cxt.MyWalSnd->arch_task_lsn);
|
||||
pg_atomic_write_u32(standby_archive_flag, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Walsender first startup, send a keepalive to standby, no need reply. */
|
||||
if (first_startup) {
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
#include "pgxc/barrier.h"
|
||||
#define MAX_PATH_LEN 1024
|
||||
|
||||
#define RESERVE_SIZE 36
|
||||
#define RESERVE_SIZE 35
|
||||
|
||||
typedef struct ResourceOwnerData* ResourceOwner;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user