Skip to content

Commit

Permalink
Do not fallback to static config automatically
Browse files Browse the repository at this point in the history
Now when we have G3CP mechanism, we can make static config fallback
optional.

Change-Id: I22f466e92b050718446e4c58042eb436a1b84af9
Reviewed-on: http://review.couchbase.org/113065
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Brett Lawson <brett19@gmail.com>
  • Loading branch information
avsej committed Aug 8, 2019
1 parent 6a2eb72 commit f912670
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion include/libcouchbase/cntl.h
Expand Up @@ -1404,11 +1404,17 @@ typedef enum {
*/
#define LCB_CNTL_PERSISTENCE_TIMEOUT_FLOOR 0x5f

/**
*
* @volatile
*/
#define LCB_CNTL_ALLOW_STATIC_CONFIG 0x60

/**
* This is not a command, but rather an indicator of the last item.
* @internal
*/
#define LCB_CNTL__MAX 0x60
#define LCB_CNTL__MAX 0x61
/**@}*/

#ifdef __cplusplus
Expand Down
3 changes: 2 additions & 1 deletion src/bucketconfig/confmon.cc
Expand Up @@ -217,7 +217,8 @@ void Confmon::provider_failed(Provider *provider, lcb_STATUS reason)
}
}

if (settings->conntype == LCB_TYPE_CLUSTER && provider->type == CLCONFIG_HTTP) {
if (settings->conntype == LCB_TYPE_CLUSTER && provider->type == CLCONFIG_HTTP
&& LCBT_SETTING(instance, allow_static_config)) {
Provider *cladmin = get_provider(CLCONFIG_CLADMIN);
if (!cladmin->enabled) {
cladmin->enable();
Expand Down
6 changes: 6 additions & 0 deletions src/cntl.cc
Expand Up @@ -621,6 +621,10 @@ HANDLER(collections_handler) {
RETURN_GET_SET(int, LCBT_SETTING(instance, use_collections));
}

HANDLER(allow_static_config_handler) {
RETURN_GET_SET(int, LCBT_SETTING(instance, allow_static_config));
}

HANDLER(comp_min_size_handler) {
if (mode == LCB_CNTL_SET && *reinterpret_cast<lcb_U32*>(arg) < LCB_DEFAULT_COMPRESS_MIN_SIZE) {
return LCB_ECTL_BADARG;
Expand Down Expand Up @@ -754,6 +758,7 @@ static ctl_handler handlers[] = {
http_pooltmo_handler, /* LCB_CNTL_HTTP_POOL_TIMEOUT */
durable_write_handler, /* LCB_CNTL_ENABLE_DURABLE_WRITE */
timeout_common, /* LCB_CNTL_PERSISTENCE_TIMEOUT_FLOOR */
allow_static_config_handler, /* LCB_CNTL_ALLOW_STATIC_CONFIG */
NULL
};

Expand Down Expand Up @@ -950,6 +955,7 @@ static cntl_OPCODESTRS stropcode_map[] = {
{"enable_collections", LCB_CNTL_ENABLE_COLLECTIONS, convert_intbool},
{"enable_durable_write", LCB_CNTL_ENABLE_DURABLE_WRITE, convert_intbool},
{"persistence_timeout_floor", LCB_CNTL_PERSISTENCE_TIMEOUT_FLOOR, convert_timevalue},
{"allow_static_config", LCB_CNTL_ALLOW_STATIC_CONFIG, convert_intbool},
{NULL, -1}};

#define CNTL_NUM_HANDLERS (sizeof(handlers) / sizeof(handlers[0]))
Expand Down
1 change: 1 addition & 0 deletions src/settings.c
Expand Up @@ -68,6 +68,7 @@ void lcb_default_settings(lcb_settings *settings)
settings->log_redaction = 0;
settings->use_tracing = 1;
settings->network = NULL;
settings->allow_static_config = 0;
settings->tracer_orphaned_queue_flush_interval = LCBTRACE_DEFAULT_ORPHANED_QUEUE_FLUSH_INTERVAL;
settings->tracer_orphaned_queue_size = LCBTRACE_DEFAULT_ORPHANED_QUEUE_SIZE;
settings->tracer_threshold_queue_flush_interval = LCBTRACE_DEFAULT_THRESHOLD_QUEUE_FLUSH_INTERVAL;
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Expand Up @@ -185,6 +185,7 @@ typedef struct lcb_settings_st {
unsigned use_collections : 1;
unsigned log_redaction : 1;
unsigned use_tracing : 1;
unsigned allow_static_config : 1;
/** Do not use remap vbuckets (do not use fast forward map, or any other heuristics) */
unsigned vb_noremap : 1;
/** Do not wait for GET_CLUSTER_CONFIG request to finish in lcb_wait(),
Expand Down

0 comments on commit f912670

Please sign in to comment.