Skip to content

Commit 82eaeaf

Browse files
committed
CCBC-1612: do not throttle CCCP provider in faster failover mode
In faster failover more, we expect server notifications, and we should not throttle refresh signals because it is done on provider level, and it ensures that not more than one request is in flight at a time. Change-Id: I2a95a1780272a74ab57ee070521a46b99302a06c Reviewed-on: https://review.couchbase.org/c/libcouchbase/+/197336 Reviewed-by: Brett Lawson <brett19@gmail.com> Tested-by: Build Bot <build@couchbase.com>
1 parent d250bfd commit 82eaeaf

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

src/bootstrap.cc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,20 @@ lcb_STATUS Bootstrap::bootstrap(unsigned options)
260260
next_ts = last_refresh;
261261
next_ts += LCB_US2NS(LCBT_SETTING(parent, weird_things_delay));
262262
if (now < next_ts && errcounter < errthresh) {
263-
lcb_log(
264-
LOGARGS(parent, INFO),
265-
"Not requesting a config refresh because of throttling parameters. Next refresh possible in %" PRIu64
266-
"ms or %u errors. "
267-
"See LCB_CNTL_CONFDELAY_THRESH and LCB_CNTL_CONFERRTHRESH to modify the throttling settings",
268-
LCB_NS2US(next_ts - now) / 1000, errthresh - errcounter);
269-
return LCB_SUCCESS;
263+
const auto *provider = parent->confmon->cur_provider;
264+
if (provider == nullptr || !(provider->type == clconfig::CLCONFIG_CCCP &&
265+
parent->confmon->mode == clconfig::CONFMON_M_PUSH)) {
266+
lcb_log(LOGARGS(parent, INFO),
267+
"Not requesting a config refresh because of throttling parameters. Next refresh possible in "
268+
"%" PRIu64 "ms or %u errors. "
269+
"See LCB_CNTL_CONFDELAY_THRESH and LCB_CNTL_CONFERRTHRESH to modify the throttling settings",
270+
LCB_NS2US(next_ts - now) / 1000, errthresh - errcounter);
271+
return LCB_SUCCESS;
272+
}
273+
lcb_log(LOGARGS(parent, INFO),
274+
"A config refresh requested, trigger CCCP provider. (next_ts=%" PRIu64
275+
"ms, errcounter=%u, errthresh=%u)",
276+
LCB_NS2US(next_ts - now) / 1000, errcounter, errthresh);
270277
}
271278
}
272279

src/bucketconfig/bc_cccp.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ lcb_STATUS CccpProvider::schedule_next_request(lcb_STATUS err, bool can_rollover
220220
if (skip_if_push_supported && nodes->all_hosts_support_config_push()) {
221221
/* all nodes support configuration push, and this function invoked from periodic poller, so nothing has to be
222222
* done here */
223+
parent->mode = CONFMON_M_PUSH;
223224
parent->stop();
224225
return LCB_SUCCESS;
225226
}
@@ -254,6 +255,7 @@ lcb_STATUS CccpProvider::schedule_next_request(lcb_STATUS err, bool can_rollover
254255
/* we found the server, but at the same time all sockets support push, so we can stop polling and just
255256
* expect notifications from KV engine */
256257
lcb_log(LOGARGS(this, DEBUG), "Stop background polling, as all nodes support configuration push");
258+
parent->mode = CONFMON_M_PUSH;
257259
parent->stop();
258260
return LCB_SUCCESS;
259261
}

src/bucketconfig/clconfig.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ enum State {
145145
CONFMON_S_ITERGRACE = 1 << 1
146146
};
147147

148+
enum Mode {
149+
/** Periodically poll for configuration */
150+
CONFMON_M_POLL,
151+
/** Subscribe for notifications from the server */
152+
CONFMON_M_PUSH,
153+
};
154+
148155
struct Provider;
149156
struct Listener;
150157
class ConfigInfo;
@@ -399,6 +406,8 @@ struct Confmon {
399406
/* CONFMON_S_* values. Used internally */
400407
int state;
401408

409+
Mode mode{CONFMON_M_POLL};
410+
402411
/** Last time the provider was stopped. As a microsecond timestamp */
403412
lcb_uint64_t last_stop_us;
404413

0 commit comments

Comments
 (0)