diff --git a/src/gausskernel/process/postmaster/checkpointer.cpp b/src/gausskernel/process/postmaster/checkpointer.cpp index 83038ff39..52a0e9142 100755 --- a/src/gausskernel/process/postmaster/checkpointer.cpp +++ b/src/gausskernel/process/postmaster/checkpointer.cpp @@ -387,7 +387,6 @@ void CheckpointerMain(void) u_sess->attr.attr_storage.CheckPointTimeout = ENABLE_INCRE_CKPT ? u_sess->attr.attr_storage.incrCheckPointTimeout : u_sess->attr.attr_storage.fullCheckPointTimeout; - most_available_sync = (volatile bool) u_sess->attr.attr_storage.guc_most_available_sync; /* * Checkpointer is the last process to shut down, so we ask it to @@ -715,7 +714,6 @@ void CheckpointWriteDelay(int flags, double progress) if (t_thrd.checkpoint_cxt.got_SIGHUP) { t_thrd.checkpoint_cxt.got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); - most_available_sync = (volatile bool)u_sess->attr.attr_storage.guc_most_available_sync; /* update shmem copies of config variables */ UpdateSharedMemoryConfig(); } diff --git a/src/gausskernel/process/tcop/postgres.cpp b/src/gausskernel/process/tcop/postgres.cpp index 12f8b1493..56b203ab9 100755 --- a/src/gausskernel/process/tcop/postgres.cpp +++ b/src/gausskernel/process/tcop/postgres.cpp @@ -82,6 +82,7 @@ #include "replication/datasender.h" #include "replication/walsender.h" #include "replication/slot.h" +#include "replication/syncrep.h" #include "rewrite/rewriteHandler.h" #include "storage/buf/bufmgr.h" #include "storage/ipc.h" @@ -6940,6 +6941,8 @@ void reload_configfile(void) } u_sess->sig_cxt.got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); + most_available_sync = (volatile bool) u_sess->attr.attr_storage.guc_most_available_sync; + SyncRepUpdateSyncStandbysDefined(); if (currentOwner == NULL) { ResourceOwnerRelease(t_thrd.utils_cxt.CurrentResourceOwner, RESOURCE_RELEASE_BEFORE_LOCKS, true, true); ResourceOwnerRelease(t_thrd.utils_cxt.CurrentResourceOwner, RESOURCE_RELEASE_LOCKS, true, true); diff --git a/src/gausskernel/process/threadpool/threadpool_scheduler.cpp b/src/gausskernel/process/threadpool/threadpool_scheduler.cpp index 7523dfa85..84ed7196e 100644 --- a/src/gausskernel/process/threadpool/threadpool_scheduler.cpp +++ b/src/gausskernel/process/threadpool/threadpool_scheduler.cpp @@ -40,6 +40,7 @@ #include "utils/memutils.h" #include "utils/ps_status.h" #include "utils/guc.h" +#include "replication/syncrep.h" #define SCHEDULER_TIME_UNIT 1000000 //us #define ENLARGE_THREAD_TIME 5 @@ -63,6 +64,9 @@ static void reloadConfigFileIfNecessary() if (t_thrd.threadpool_cxt.scheduler->m_getSIGHUP) { t_thrd.threadpool_cxt.scheduler->m_getSIGHUP = false; ProcessConfigFile(PGC_SIGHUP); + /* Update most_available_sync if it's modified dynamically. */ + most_available_sync = (volatile bool) u_sess->attr.attr_storage.guc_most_available_sync; + SyncRepUpdateSyncStandbysDefined(); } } diff --git a/src/gausskernel/storage/replication/syncrep.cpp b/src/gausskernel/storage/replication/syncrep.cpp index 147ee4498..87f6494c0 100755 --- a/src/gausskernel/storage/replication/syncrep.cpp +++ b/src/gausskernel/storage/replication/syncrep.cpp @@ -313,8 +313,11 @@ void SyncRepWaitForLSN(XLogRecPtr XactCommitLSN, bool enableHandleCancel) } /* - * If we modify the syncmode dynamically, we'll stop wait + * If we modify the syncmode dynamically, we'll stop wait. + * Reload config file here to update most_available_sync if it's modified + * dynamically. */ + reload_configfile(); if ((t_thrd.walsender_cxt.WalSndCtl->sync_master_standalone && !IS_SHARED_STORAGE_MODE && !DelayIntoMostAvaSync(false)) || u_sess->attr.attr_storage.guc_synchronous_commit <= SYNCHRONOUS_COMMIT_LOCAL_FLUSH) {