From 1eb23621ba1ae9d5db91545b1aa23bbe0b64dbb1 Mon Sep 17 00:00:00 2001 From: mujinqiang <1165845907@qq.com> Date: Mon, 17 May 2021 16:18:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=B6=E6=97=B6=E5=8F=82=E6=95=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BF=9D=E5=AD=98=E5=88=B0u=5Fsess=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/backend/utils/misc/guc.cpp | 2 +- src/gausskernel/storage/access/transam/xlog.cpp | 10 +++++----- src/include/knl/knl_guc/knl_session_attr_storage.h | 6 +++++- src/include/knl/knl_thread.h | 4 ---- 4 files changed, 11 insertions(+), 11 deletions(-) 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;