From e403eb4893d7aee18e4c3fd22c609ff774842f99 Mon Sep 17 00:00:00 2001 From: "jiadebinmary@gmail.com" Date: Thu, 18 May 2023 13:23:58 +0000 Subject: [PATCH] Adjust election renew lease interval. --- src/logservice/palf/election/utils/election_common_define.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/logservice/palf/election/utils/election_common_define.h b/src/logservice/palf/election/utils/election_common_define.h index 9d9fa8b15a..0a7d5603c7 100644 --- a/src/logservice/palf/election/utils/election_common_define.h +++ b/src/logservice/palf/election/utils/election_common_define.h @@ -112,8 +112,8 @@ constexpr int64_t MAX_LEASE_TIME = 10_s; constexpr int64_t PRIORITY_BUFFER_SIZE = 512; constexpr int64_t INVALID_VALUE = -1;// 所有int64_t变量的初始默认无效值 constexpr int64_t CACHE_EXPIRATION_TIME = 5_s; -extern int64_t MAX_TST; // 最大单程消息延迟,暂设为750ms,在单测中会将其调低,日后可改为配置项,现阶段先用全局变量代替 -inline int64_t CALCULATE_RENEW_LEASE_INTERVAL() { return std::min(0.5 * MAX_TST, 250_ms); }// 续约周期固定为消息延迟的一半,最大不超过250ms +extern int64_t MAX_TST; // 最大单程消息延迟,暂设为1s,在单测中会将其调低,日后可改为配置项,现阶段先用全局变量代替 +inline int64_t CALCULATE_RENEW_LEASE_INTERVAL() { return std::min(0.5 * MAX_TST, 500_ms); }// 续约周期固定为消息延迟的一半,最大不超过500ms inline int64_t CALCULATE_TIME_WINDOW_SPAN_TS() { return 2 * MAX_TST; }// 时间窗口的长度,为两个最大单程消息延迟, 默认为2s inline int64_t CALCULATE_MAX_ELECT_COST_TIME() { return 10 * MAX_TST; }// 一次选举可能出现的最大耗时设置,默认为10s inline int64_t CALCULATE_LEASE_INTERVAL() { return 4 * MAX_TST; }// 4个消息延迟,默认是4s