diff --git a/src/common/backend/utils/misc/guc.cpp b/src/common/backend/utils/misc/guc.cpp index 881b9bcc6..c422b46db 100644 --- a/src/common/backend/utils/misc/guc.cpp +++ b/src/common/backend/utils/misc/guc.cpp @@ -3761,7 +3761,7 @@ static void InitConfigureNamesInt() gettext_noop("Sets the minimum delay for applying changes during recovery."), NULL, GUC_UNIT_MS}, - &t_thrd.xlog_cxt.recovery_min_apply_delay, + &u_sess->attr.attr_storage.recovery_min_apply_delay, 0, 0, INT_MAX, diff --git a/src/gausskernel/storage/access/transam/xlog.cpp b/src/gausskernel/storage/access/transam/xlog.cpp index aed3cddbd..f8ef6a3a3 100644 --- a/src/gausskernel/storage/access/transam/xlog.cpp +++ b/src/gausskernel/storage/access/transam/xlog.cpp @@ -7817,7 +7817,7 @@ static bool RecoveryApplyDelay(const XLogReaderState *record) long waitTime = 0; /* nothing to do if no delay configured */ - if (t_thrd.xlog_cxt.recovery_min_apply_delay <= 0) { + if (u_sess->attr.attr_storage.recovery_min_apply_delay <= 0) { return false; } @@ -7858,11 +7858,11 @@ static bool RecoveryApplyDelay(const XLogReaderState *record) return false; } - t_thrd.xlog_cxt.recoveryDelayUntilTime = - TimestampTzPlusMilliseconds(xtime, t_thrd.xlog_cxt.recovery_min_apply_delay); + u_sess->attr.attr_storage.recoveryDelayUntilTime = + TimestampTzPlusMilliseconds(xtime, u_sess->attr.attr_storage.recovery_min_apply_delay); /* Exit without arming the latch if it's already past time to apply this record */ - TimestampDifference(GetCurrentTimestamp(), t_thrd.xlog_cxt.recoveryDelayUntilTime, &secs, µsecs); + TimestampDifference(GetCurrentTimestamp(), u_sess->attr.attr_storage.recoveryDelayUntilTime, &secs, µsecs); if (secs <= 0 && microsecs <= 0) { return false; } @@ -7878,7 +7878,7 @@ static bool RecoveryApplyDelay(const XLogReaderState *record) } /* Wait for difference between GetCurrentTimestamp() and recoveryDelayUntilTime */ - TimestampDifference(GetCurrentTimestamp(), t_thrd.xlog_cxt.recoveryDelayUntilTime, + TimestampDifference(GetCurrentTimestamp(), u_sess->attr.attr_storage.recoveryDelayUntilTime, &secs, µsecs); /* To clear LSNMarker item that has not been processed in pageworker */ diff --git a/src/include/knl/knl_guc/knl_session_attr_storage.h b/src/include/knl/knl_guc/knl_session_attr_storage.h index 702e9b208..69017dd30 100644 --- a/src/include/knl/knl_guc/knl_session_attr_storage.h +++ b/src/include/knl/knl_guc/knl_session_attr_storage.h @@ -38,6 +38,7 @@ #define SRC_INCLUDE_KNL_KNL_SESSION_ATTR_STORAGE #include "knl/knl_guc/knl_guc_common.h" +#include "datatype/timestamp.h" typedef struct knl_session_attr_storage { bool raise_errors_if_no_files; @@ -186,7 +187,10 @@ typedef struct knl_session_attr_storage { int defer_csn_cleanup_time; bool enable_hashbucket; - +#ifndef ENABLE_MULTIPLE_NODES + int recovery_min_apply_delay; + TimestampTz recoveryDelayUntilTime; +#endif /* for GTT */ int max_active_gtt; int vacuum_gtt_defer_check_age; diff --git a/src/include/knl/knl_thread.h b/src/include/knl/knl_thread.h index 2a51650f5..cb32d370f 100644 --- a/src/include/knl/knl_thread.h +++ b/src/include/knl/knl_thread.h @@ -446,10 +446,6 @@ typedef struct knl_t_xlog_context { char* recoveryTargetBarrierId; char* recoveryTargetName; XLogRecPtr recoveryTargetLSN; -#ifndef ENABLE_MULTIPLE_NODES - int recovery_min_apply_delay; - TimestampTz recoveryDelayUntilTime; -#endif /* options taken from recovery.conf for XLOG streaming */ bool StandbyModeRequested; char* PrimaryConnInfo;