set wal_sender_timeout >= 30minutes for gs_probackup

This commit is contained in:
LiHeng 2021-09-09 21:09:43 +08:00
parent 53e0a7b5e3
commit a75fa7ba38
3 changed files with 15 additions and 2 deletions

View File

@ -1306,6 +1306,7 @@ static void knl_t_walsender_init(knl_t_walsender_context* walsender_cxt)
walsender_cxt->walSndCaughtUp = false;
walsender_cxt->advancePrimaryConn = NULL;
walsender_cxt->last_check_timeout_timestamp = 0;
walsender_cxt->timeoutCheckInternal = 0;
}
static void knl_t_tsearch_init(knl_t_tsearch_context* tsearch_cxt)

View File

@ -3105,6 +3105,12 @@ static int WalSndLoop(WalSndSendDataCallback send_data)
last_syncconf_timestamp = GetCurrentTimestamp();
t_thrd.walsender_cxt.last_logical_xlog_advanced_timestamp = GetCurrentTimestamp();
t_thrd.walsender_cxt.waiting_for_ping_response = false;
#define MINUTE_30 (30 * 60 * 1000) /* 30 minutes */
t_thrd.walsender_cxt.timeoutCheckInternal = u_sess->attr.attr_storage.wal_sender_timeout;
if (strcmp(u_sess->attr.attr_common.application_name, "gs_probackup") == 0 &&
t_thrd.walsender_cxt.timeoutCheckInternal < MINUTE_30) {
t_thrd.walsender_cxt.timeoutCheckInternal = MINUTE_30;
}
/* Loop forever, unless we get an error */
for (;;) {
@ -3601,9 +3607,9 @@ static inline TimestampTz CalculateTimeout(TimestampTz last_reply_time)
if (walsnd->sendRole == SNDROLE_PRIMARY_BUILDSTANDBY) {
return TimestampTzPlusMilliseconds(last_reply_time,
MULTIPLE_TIME * u_sess->attr.attr_storage.wal_sender_timeout);
MULTIPLE_TIME * t_thrd.walsender_cxt.timeoutCheckInternal);
} else {
return TimestampTzPlusMilliseconds(last_reply_time, u_sess->attr.attr_storage.wal_sender_timeout);
return TimestampTzPlusMilliseconds(last_reply_time, t_thrd.walsender_cxt.timeoutCheckInternal);
}
}

View File

@ -2193,6 +2193,12 @@ typedef struct knl_t_walsender_context {
struct pg_conn* advancePrimaryConn;
/* Timestamp of the last check-timeout time in WalSndCheckTimeOut. */
TimestampTz last_check_timeout_timestamp;
/*
* Actual timeout for guc wal_sender_timeout, default value is wal_sender_timeout.
* timeoutCheckInternal will greater than or equal to 30 minutes for gs_probackup. It is so
* hackly of 30 minutes, but now, 30 minutes is enough.
*/
int timeoutCheckInternal;
} knl_t_walsender_context;
typedef struct knl_t_walreceiverfuncs_context {