Details
-
Bug
-
Resolution: Fixed
-
Critical
-
3.0.6
-
None
-
None
-
1
Description
As part of Amadeus project connecting to Couchbase, we are using a proxy to reduce the number of connections in case of 10K+ backends connection.
The change CCBC-1248 (Always request error map feature) done has a critical impact on our client towards the proxy. Indeed, our proxy is not compatible with errmap, ie. the client needs to send the hello and wait for proxy ack before sending any errmap packets.
Moreover, we need to deactivate errmap on libcouchbase (inside proxy) that communicates with the server.
Please view our current patch below done in 3.0.6 to resolve the issue:
--- include/libcouchbase/cntl.h 2021-02-19 08:17:59.930166608 +0000 |
+++ include/libcouchbase/cntl.h 2021-02-19 08:19:16.692446482 +0000 |
@@ -929,6 +929,16 @@ |
#define LCB_CNTL_READ_CHUNKSIZE 0x42 |
/**
|
+ * Enable/Disable the Error Map feature. This is disabled by default.
|
+ * Works only on servers which support error map
|
+ *
|
+ * Use `enable_errmap` in the connection string
|
+ *
|
+ * @cntl_arg_both{int* (as boolean)}
|
+ */
|
+#define LCB_CNTL_ENABLE_ERRMAP 0x43 |
+
|
+/** |
* Enable/Disable sending the SELECT_BUCKET command after authentication.
|
* This is useful to test auth, and should not be set by end-users.
|
*
|
--- src/cntl.cc 2021-02-19 13:01:01.085968337 +0000
|
+++ src/cntl.cc 2021-02-19 13:01:54.803231440 +0000
|
@@ -222,6 +222,9 @@
|
HANDLER(read_chunk_size_handler) {
|
RETURN_GET_SET(lcb_U32, LCBT_SETTING(instance, read_chunk_size));
|
}
|
+HANDLER(enable_errmap_handler) {
|
+ RETURN_GET_SET(int, LCBT_SETTING(instance, use_errmap));
|
+}
|
HANDLER(select_bucket_handler) {
|
RETURN_GET_SET(int, LCBT_SETTING(instance, select_bucket));
|
}
|
@@ -758,7 +761,7 @@
|
bucket_auth_handler, /* LCB_CNTL_BUCKET_CRED */
|
timeout_common, /* LCB_CNTL_RETRY_NMV_DELAY */ |
read_chunk_size_handler, /* LCB_CNTL_READ_CHUNKSIZE */ |
- NULL, /* deprecated LCB_CNTL_ENABLE_ERRMAP (0x43) */ |
+ enable_errmap_handler, /* deprecated LCB_CNTL_ENABLE_ERRMAP (0x43) */ |
select_bucket_handler, /* LCB_CNTL_SELECT_BUCKET */ |
tcp_keepalive_handler, /* LCB_CNTL_TCP_KEEPALIVE */ |
config_poll_interval_handler, /* LCB_CNTL_CONFIG_POLL_INTERVAL */ |
@@ -968,6 +971,7 @@ |
{"retry_nmv_delay", LCB_CNTL_RETRY_NMV_INTERVAL, convert_timevalue}, |
{"bucket_cred", LCB_CNTL_BUCKET_CRED, NULL}, |
{"read_chunk_size", LCB_CNTL_READ_CHUNKSIZE, convert_u32}, |
+ {"enable_errmap", LCB_CNTL_ENABLE_ERRMAP, convert_intbool}, |
{"select_bucket", LCB_CNTL_SELECT_BUCKET, convert_intbool}, |
{"tcp_keepalive", LCB_CNTL_TCP_KEEPALIVE, convert_intbool}, |
{"config_poll_interval", LCB_CNTL_CONFIG_POLL_INTERVAL, convert_timevalue}, |
--- src/settings.h 2021-02-19 07:52:24.513287125 +0000 |
+++ src/settings.h 2021-02-19 07:56:16.901368996 +0000 |
@@ -183,6 +183,7 @@ |
unsigned use_collections : 1; |
unsigned log_redaction : 1; |
unsigned use_tracing : 1; |
+ unsigned use_errmap : 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; |
--- src/settings.c 2021-02-19 07:52:11.453123910 +0000 |
+++ src/settings.c 2021-02-19 07:55:48.693839277 +0000 |
@@ -63,6 +63,7 @@ |
settings->tcp_keepalive = LCB_DEFAULT_TCP_KEEPALIVE;
|
settings->config_poll_interval = LCB_DEFAULT_CONFIG_POLL_INTERVAL;
|
settings->use_collections = 1; |
+ settings->use_errmap = 1; |
settings->log_redaction = 0; |
settings->use_tracing = 1; |
settings->network = NULL;
|
--- src/mcserver/mcserver.cc 2021-02-19 07:51:08.773505379 +0000 |
+++ src/mcserver/mcserver.cc 2021-02-19 07:53:23.434531569 +0000 |
@@ -366,7 +366,7 @@ |
int Server::handle_unknown_error(const mc_PACKET *request, const MemcachedResponse &mcresp, lcb_STATUS &newerr) |
{
|
- if (!settings->errmap->isLoaded()) { |
+ if (!settings->errmap->isLoaded() || !settings->use_errmap) { |
// If there's no error map, just return false |
return ERRMAP_HANDLE_CONTINUE; |
}
|
--- src/mcserver/negotiate.cc 2021-02-19 12:49:47.721190549 +0000 |
+++ src/mcserver/negotiate.cc 2021-02-19 12:51:27.762133953 +0000 |
@@ -417,7 +417,9 @@ |
features[nfeatures++] = PROTOCOL_BINARY_FEATURE_XATTR;
|
features[nfeatures++] = PROTOCOL_BINARY_FEATURE_JSON;
|
features[nfeatures++] = PROTOCOL_BINARY_FEATURE_SELECT_BUCKET;
|
- features[nfeatures++] = PROTOCOL_BINARY_FEATURE_XERROR;
|
+ if (settings->use_errmap) { |
+ features[nfeatures++] = PROTOCOL_BINARY_FEATURE_XERROR;
|
+ }
|
if (settings->tcp_nodelay) { |
features[nfeatures++] = PROTOCOL_BINARY_FEATURE_TCPNODELAY;
|
}
|
@@ -627,7 +629,9 @@ |
break; |
}
|
- if (!info->has_feature(PROTOCOL_BINARY_FEATURE_XERROR)) { |
+ if (info->has_feature(PROTOCOL_BINARY_FEATURE_XERROR)) { |
+ request_errmap();
|
+ } else { |
lcb_log(LOGARGS(this, TRACE), LOGFMT "GET_ERRORMAP unsupported/disabled", LOGID(this)); |
}
|
@@ -730,7 +734,6 @@ |
}
|
send_hello();
|
- request_errmap();
|
if (!settings->keypath) { |
send_list_mechs();
|
}
|
Attachments
For Gerrit Dashboard: CCBC-1379 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
150752,3 | CCBC-1379: allow to disable error map | master | libcouchbase | Status: MERGED | +2 | +1 |