延时参数修改为保存到u_sess中

This commit is contained in:
mujinqiang 2021-05-17 16:18:10 +08:00
parent 6b600011ef
commit 1eb23621ba
4 changed files with 11 additions and 11 deletions

View File

@ -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,

View File

@ -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, &microsecs);
TimestampDifference(GetCurrentTimestamp(), u_sess->attr.attr_storage.recoveryDelayUntilTime, &secs, &microsecs);
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, &microsecs);
/* To clear LSNMarker item that has not been processed in pageworker */

View File

@ -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;

View File

@ -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;