couchbase 3.2.5 → 3.2.6
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/lcb/CMakeLists.txt +28 -6
- package/deps/lcb/README.markdown +5 -9
- package/deps/lcb/RELEASE_NOTES.markdown +75 -12
- package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
- package/deps/lcb/doc/Doxyfile +1 -1
- package/deps/lcb/doc/cbc.markdown +10 -0
- package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
- package/deps/lcb/include/libcouchbase/error.h +1 -1
- package/deps/lcb/packaging/rpm/libcouchbase.spec.in +1 -1
- package/deps/lcb/plugins/io/iocp/iocp_iops.h +1 -1
- package/deps/lcb/plugins/io/iocp/iocp_loop.c +3 -3
- package/deps/lcb/plugins/io/iocp/iocp_util.c +2 -2
- package/deps/lcb/src/bucketconfig/bc_file.cc +29 -15
- package/deps/lcb/src/capi/collection_qualifier.hh +0 -3
- package/deps/lcb/src/instance.cc +19 -0
- package/deps/lcb/src/operations/ping.cc +2 -2
- package/deps/lcb/src/settings.cc +1 -0
- package/deps/lcb/src/ssl/ssl_common.c +111 -22
- package/deps/lcb/src/vbucket/vbucket.c +16 -7
- package/deps/lcb/tests/CMakeLists.txt +1 -1
- package/deps/lcb/tests/iotests/mock-environment.cc +3 -0
- package/deps/lcb/tests/iotests/mock-environment.h +1 -0
- package/deps/lcb/tests/iotests/t_ratelimit.cc +11 -1
- package/deps/lcb/tools/CMakeLists.txt +1 -1
- package/deps/lcb/tools/cbc-handlers.h +39 -0
- package/deps/lcb/tools/cbc-n1qlback.cc +1 -0
- package/deps/lcb/tools/cbc-pillowfight.cc +45 -35
- package/deps/lcb/tools/cbc.cc +31 -0
- package/deps/lcb/tools/docgen/docgen.h +11 -10
- package/dist/httpexecutor.d.ts +1 -0
- package/package.json +1 -1
package/deps/lcb/CMakeLists.txt
CHANGED
@@ -30,7 +30,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
|
|
30
30
|
# Couchbase mock path to download
|
31
31
|
SET(COUCHBASE_MOCK_VERSION 1.5.25)
|
32
32
|
SET(COUCHBASE_MOCK_URL "https://github.com/couchbase/CouchbaseMock/releases/download/${COUCHBASE_MOCK_VERSION}/CouchbaseMock-${COUCHBASE_MOCK_VERSION}.jar")
|
33
|
-
project(libcouchbase VERSION 3.
|
33
|
+
project(libcouchbase VERSION 3.3.3 LANGUAGES C CXX)
|
34
34
|
|
35
35
|
if (NOT CMAKE_VERSION VERSION_LESS "3.13")
|
36
36
|
# CMP0077: option() honors normal variables
|
@@ -278,20 +278,30 @@ ELSE()
|
|
278
278
|
# and set the appropriate OpenSSL variables
|
279
279
|
IF(APPLE)
|
280
280
|
IF(NOT OpenSSL_DIR)
|
281
|
-
EXECUTE_PROCESS(COMMAND brew --prefix openssl
|
281
|
+
EXECUTE_PROCESS(COMMAND brew --prefix openssl@1.1
|
282
282
|
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
283
283
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
284
284
|
MESSAGE(STATUS "Found OpenSSL Prefix: ${OPENSSL_ROOT_DIR}")
|
285
285
|
ENDIF()
|
286
286
|
ENDIF()
|
287
287
|
FIND_PACKAGE(OpenSSL)
|
288
|
+
# If it still not found, try to locate it using pkg-config
|
289
|
+
IF(NOT OPENSSL_FOUND AND UNIX)
|
290
|
+
find_package(PkgConfig)
|
291
|
+
IF(PkgConfig_FOUND)
|
292
|
+
pkg_check_modules(OPENSSL openssl11)
|
293
|
+
IF(OPENSSL_FOUND)
|
294
|
+
SET(OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIRS})
|
295
|
+
SET(OPENSSL_LIBRARIES ${OPENSSL_LINK_LIBRARIES})
|
296
|
+
ENDIF()
|
297
|
+
ENDIF()
|
298
|
+
ENDIF()
|
288
299
|
ENDIF(NOT OPENSSL_FOUND)
|
289
300
|
|
290
301
|
IF(OPENSSL_FOUND)
|
291
302
|
MESSAGE(STATUS "SSL Found: ${OPENSSL_VERSION} (${OPENSSL_LIBRARIES})")
|
292
303
|
ELSE()
|
293
|
-
MESSAGE(
|
294
|
-
ADD_DEFINITIONS(-DLCB_NO_SSL=1)
|
304
|
+
MESSAGE(FATAL_ERROR "SSL Not Found. Use LCB_NO_SSL to produce build without OpenSSL")
|
295
305
|
ENDIF()
|
296
306
|
ENDIF()
|
297
307
|
|
@@ -299,7 +309,14 @@ ADD_SUBDIRECTORY(src/vbucket)
|
|
299
309
|
ADD_SUBDIRECTORY(contrib/cbsasl)
|
300
310
|
ADD_SUBDIRECTORY(contrib/cliopts)
|
301
311
|
ADD_SUBDIRECTORY(src/ssl)
|
302
|
-
|
312
|
+
IF(NOT LCB_JSONCPP_LIB)
|
313
|
+
ADD_SUBDIRECTORY(contrib/lcb-jsoncpp)
|
314
|
+
ENDIF()
|
315
|
+
IF(NOT LCB_JSONCPP_INCLUDE_DIR)
|
316
|
+
INCLUDE_DIRECTORIES(contrib/lcb-jsoncpp)
|
317
|
+
ELSE()
|
318
|
+
INCLUDE_DIRECTORIES(${LCB_JSONCPP_INCLUDE_DIR})
|
319
|
+
ENDIF()
|
303
320
|
IF(NOT LCB_SNAPPY_LIB)
|
304
321
|
ADD_SUBDIRECTORY(contrib/snappy)
|
305
322
|
ENDIF()
|
@@ -344,11 +361,13 @@ SET(LCB_CORE_OBJS
|
|
344
361
|
$<TARGET_OBJECTS:lcbcore>
|
345
362
|
$<TARGET_OBJECTS:lcbcore-cxx>
|
346
363
|
$<TARGET_OBJECTS:lcb_jsparse>
|
347
|
-
$<TARGET_OBJECTS:lcb_jsoncpp>
|
348
364
|
${LCB_DTRACE_OBJECT}
|
349
365
|
${lcb_plat_objs}
|
350
366
|
${lcb_ssl_objs})
|
351
367
|
|
368
|
+
IF(NOT LCB_JSONCPP_LIB)
|
369
|
+
LIST (APPEND LCB_CORE_OBJS $<TARGET_OBJECTS:lcb_jsoncpp>)
|
370
|
+
ENDIF()
|
352
371
|
IF(NOT LCB_SNAPPY_LIB)
|
353
372
|
LIST (APPEND LCB_CORE_OBJS $<TARGET_OBJECTS:lcb_snappy>)
|
354
373
|
ENDIF()
|
@@ -400,6 +419,9 @@ ENDIF()
|
|
400
419
|
IF(LIBPROFILER)
|
401
420
|
SET(LCB_LINK_DEPS ${LCB_LINK_DEPS} ${LIBPROFILER})
|
402
421
|
ENDIF()
|
422
|
+
IF(LCB_JSONCPP_LIB)
|
423
|
+
SET(LCB_LINK_DEPS ${LCB_LINK_DEPS} ${LCB_JSONCPP_LIB})
|
424
|
+
ENDIF()
|
403
425
|
IF(LCB_SNAPPY_LIB)
|
404
426
|
SET(LCB_LINK_DEPS ${LCB_LINK_DEPS} ${LCB_SNAPPY_LIB})
|
405
427
|
ENDIF()
|
package/deps/lcb/README.markdown
CHANGED
@@ -6,6 +6,11 @@ This is the C client library for [Couchbase](http://www.couchbase.com)
|
|
6
6
|
It communicates with the cluster and speaks the relevant protocols
|
7
7
|
necessary to connect to the cluster and execute data operations.
|
8
8
|
|
9
|
+
## Support and Feedback
|
10
|
+
|
11
|
+
If you find an issue, please file it in [our JIRA issue tracker](https://couchbase.com/issues/browse/CCBC). Also you are
|
12
|
+
always welcome on [our forum](https://forums.couchbase.com/c/c-sdk) and [Discord](https://discord.com/invite/sQ5qbPZuTh).
|
13
|
+
|
9
14
|
## Features
|
10
15
|
|
11
16
|
* Can function as either a synchronous or asynchronous library
|
@@ -110,15 +115,6 @@ servers the spec will look like `couchbase://localhost,default` or `couchbase://
|
|
110
115
|
Also tests expecting `beer-sample` bucket loaded. It comes with the server. Look at "Sample buckets" section of Admin
|
111
116
|
Console.
|
112
117
|
|
113
|
-
## Bugs, Support, Issues
|
114
|
-
You may report issues in the library in our issue tracker at
|
115
|
-
<https://issues.couchbase.com>. Sign up for an account and file an issue
|
116
|
-
against the _Couchbase C Client Library_ project.
|
117
|
-
|
118
|
-
The developers of the library hang out in IRC on `#libcouchbase` on
|
119
|
-
irc.freenode.net.
|
120
|
-
|
121
|
-
|
122
118
|
## Examples
|
123
119
|
|
124
120
|
* The `examples` directory
|
@@ -1,31 +1,94 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 3.3.3 (2022-09-09)
|
4
|
+
* CCBC-1565: load system CAs when the trust certificate is not provided
|
5
|
+
|
6
|
+
When the user has not set any root ca provider but is using TLS then we
|
7
|
+
should trust both the system store and the Capella root CA.
|
8
|
+
|
9
|
+
* CCBC-1564: update error message for authentication failure
|
10
|
+
|
11
|
+
* CCBC-1568: skip logging for closed SSL IO contexts
|
12
|
+
|
13
|
+
OpenSSL might still invoke IO callbacks after the actual context has
|
14
|
+
been closed. This more likely could happen with libuv-style IO.
|
15
|
+
|
16
|
+
This patch ensures that once socket context has been closed, its pointer
|
17
|
+
in SSL object will be erased.
|
18
|
+
|
19
|
+
* Added cbc-bucket-list command to list all buckets.
|
20
|
+
|
21
|
+
## 3.3.2 (2022-08-29)
|
22
|
+
|
23
|
+
* CCBC-1559: cbc-n1qlback: give time to IO loop in case of failure.
|
24
|
+
|
25
|
+
In schenario where all query nodes suddenly failed over and/or removed
|
26
|
+
from the cluster, all requests in cbc-n1qlback will start failing.
|
27
|
+
Because the libcouchbase knows that the latest config does not have any
|
28
|
+
query nodes, it rejects all queries immediately. The single-threaded
|
29
|
+
nature of libcouchbase does not allow the IO loop to run in background,
|
30
|
+
and the code in the tool does not run `lcb_wait` in case of failure.
|
31
|
+
|
32
|
+
As a fix, we run `lcb_tick_nowait` in case of failure, which is enough
|
33
|
+
for libcouchbase to give IO loop a chance to check for any pending
|
34
|
+
events and invoke corresponding callbacks.
|
35
|
+
|
36
|
+
* CCBC-1552: Allow building with external jsoncpp
|
37
|
+
|
38
|
+
* CCBC-1544: update feedback links: Jira, Forums and Discord
|
39
|
+
|
40
|
+
* CCBC-1556: clarify log messages related to config cache
|
41
|
+
|
42
|
+
* CCBC-1557: allow caching cluster-level configurations
|
43
|
+
|
44
|
+
The library will cache cluster-level configurations only if the
|
45
|
+
`config_cache= connection` string option is set to directory (ends
|
46
|
+
with '/' symbol), otherwise it will cache only buckets configurations
|
47
|
+
(note that in this case the application should use unique cache name for
|
48
|
+
each bucket, otherwise the library will ignore cache if the bucket name
|
49
|
+
will not match).
|
50
|
+
|
51
|
+
## 3.3.1 (2022-05-25)
|
52
|
+
|
53
|
+
* CCBC-1550: Fixed RPM packages for CentOS 7, now they will require OpenSSL 1.1 during build. Also build script will not
|
54
|
+
automatically define `LCB_NO_SSL` option if OpenSSL is not found. For builds without TLS support, this option must be
|
55
|
+
explicitly defined.
|
56
|
+
|
57
|
+
* CCBC-1546: cbc-pillowfight: add '--rand-space-per-thread' to allow threads to work from different rand numbers.
|
58
|
+
|
59
|
+
## 3.3.0 (2022-05-09)
|
60
|
+
|
61
|
+
* CCBC-1538: use 64-bit integer to store time in IOCP plugin
|
62
|
+
* CCBC-1540: bundle capella ca certificate with SDK
|
63
|
+
* CCBC-1526: do not validate length of collection specifier. Length will be checked on the server-side.
|
64
|
+
* CCBC-1527: pillowfight: deallocate all memory during shutdown
|
65
|
+
|
3
66
|
## 3.2.5 (2022-02-08)
|
4
67
|
|
5
|
-
CCBC-1486: Add support for preserve expiry to query options
|
6
|
-
CCBC-1534, CCBC-1411: improve query error handling
|
7
|
-
CCBC-1519: pass extra privilege with KV "on-behalf-of".
|
8
|
-
CCBC-1521: fix bootstrap process when client cert is used and error map is supported. If client cert auth is used, once
|
68
|
+
* CCBC-1486: Add support for preserve expiry to query options
|
69
|
+
* CCBC-1534, CCBC-1411: improve query error handling
|
70
|
+
* CCBC-1519: pass extra privilege with KV "on-behalf-of".
|
71
|
+
* CCBC-1521: fix bootstrap process when client cert is used and error map is supported. If client cert auth is used, once
|
9
72
|
the error map response has been received, the negotiation is complete.
|
10
|
-
CCBC-1529: load authentication certificate as chain file.
|
11
|
-
CCBC-1525: remove stringstream in `collection_qualifier`. Constructing a stringstream object every time
|
73
|
+
* CCBC-1529: load authentication certificate as chain file.
|
74
|
+
* CCBC-1525: remove stringstream in `collection_qualifier`. Constructing a stringstream object every time
|
12
75
|
`collection_qualifier` is constructed is very expensive.
|
13
|
-
CCBC-1528: update parsing of "quota limit" error for FTS
|
76
|
+
* CCBC-1528: update parsing of "quota limit" error for FTS
|
14
77
|
|
15
78
|
## 3.2.4 (2021-11-23)
|
16
79
|
|
17
|
-
CCBC-1522: Filter `DnsQuery` results on Windows by type: only use records with `DNS_TYPE_SRV` type.
|
80
|
+
* CCBC-1522: Filter `DnsQuery` results on Windows by type: only use records with `DNS_TYPE_SRV` type.
|
18
81
|
|
19
|
-
CCBC-1521: Fixed bootstrap process when client certificate is used. We always pipeline error map request with `HELLO`
|
82
|
+
* CCBC-1521: Fixed bootstrap process when client certificate is used. We always pipeline error map request with `HELLO`
|
20
83
|
request, and usually await for `hello`+`error_map` responses, because after that goes SASL authentication (and then
|
21
84
|
optional selection of the bucket) which cannot be completely pipelined. But in case of client certificate, we might
|
22
85
|
terminate bootstrap process too early if the bootstrap process does not require immediate selection of the bucket.
|
23
86
|
|
24
|
-
CCBC-1432: Support for rate limiting error codes: `LCB_ERR_RATE_LIMITED` and `LCB_ERR_QUOTA_LIMITED`.
|
87
|
+
* CCBC-1432: Support for rate limiting error codes: `LCB_ERR_RATE_LIMITED` and `LCB_ERR_QUOTA_LIMITED`.
|
25
88
|
|
26
|
-
CCBC-1514: Do not translate unknown error with "item-only" attribute into `LCB_ERR_CAS_MISMATCH`.
|
89
|
+
* CCBC-1514: Do not translate unknown error with "item-only" attribute into `LCB_ERR_CAS_MISMATCH`.
|
27
90
|
|
28
|
-
CCBC-1515: Performance optimization: replace `sstream` with string `append()`. Only if list of IO vectors supplied for
|
91
|
+
* CCBC-1515: Performance optimization: replace `sstream` with string `append()`. Only if list of IO vectors supplied for
|
29
92
|
value in mutation operations.
|
30
93
|
|
31
94
|
## 3.2.3 (2021-10-20)
|
@@ -65,7 +65,7 @@ IF(APPLE)
|
|
65
65
|
ELSE()
|
66
66
|
SET(LCB_SONAME_MAJOR "8")
|
67
67
|
ENDIF()
|
68
|
-
SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.
|
68
|
+
SET(LCB_SONAME_FULL "${LCB_SONAME_MAJOR}.0.11")
|
69
69
|
|
70
70
|
MESSAGE(STATUS "libcouchbase ${LCB_VERSION_MAJOR},${LCB_VERSION_MINOR},${LCB_VERSION_PATCH}")
|
71
71
|
MESSAGE(STATUS "Building libcouchbase ${LCB_VERSION}/${LCB_VERSION_CHANGESET}")
|
package/deps/lcb/doc/Doxyfile
CHANGED
@@ -38,7 +38,7 @@ PROJECT_NAME = "Couchbase C Client"
|
|
38
38
|
# could be handy for archiving the generated documentation or if some version
|
39
39
|
# control system is used.
|
40
40
|
|
41
|
-
PROJECT_NUMBER = 3.
|
41
|
+
PROJECT_NUMBER = 3.3.3
|
42
42
|
|
43
43
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
44
44
|
# for a project that appears at the top of each page and should give viewer a
|
@@ -20,6 +20,7 @@
|
|
20
20
|
`cbc lock` _KEY_ [_OPTIONS_]<br>
|
21
21
|
`cbc unlock` _KEY_ _CAS_ [_OPTIONS_]<br>
|
22
22
|
`cbc admin` _-P PASSWORD_ _RESTAPI_ [_OPTIONS_]<br>
|
23
|
+
`cbc bucket-list` _-P PASSWORD_ [_OPTIONS_]<br>
|
23
24
|
`cbc bucket-create` _-P PASSWORD_ _NAME_ [_OPTIONS_]<br>
|
24
25
|
`cbc bucket-delete` _-P PASSWORD_ _NAME_ [_OPTIONS_]<br>
|
25
26
|
`cbc bucket-flush` _NAME_ [_OPTIONS_]<br>
|
@@ -362,6 +363,15 @@ In addition to the [OPTIONS](#OPTIONS) specified above, the following options ar
|
|
362
363
|
Specify the HTTP method to use for the specific request. The default method is
|
363
364
|
`GET`.
|
364
365
|
|
366
|
+
### bucket-list
|
367
|
+
|
368
|
+
List the buckets in the cluster
|
369
|
+
|
370
|
+
In addition to the [OPTIONS](#OPTIONS) specified above, the following options are recognized:
|
371
|
+
|
372
|
+
* `-r`, `--raw`:
|
373
|
+
Print unformatted server response in JSON form.
|
374
|
+
|
365
375
|
### bucket-create
|
366
376
|
|
367
377
|
Create a bucket in the cluster.
|
@@ -33,7 +33,7 @@
|
|
33
33
|
*/
|
34
34
|
|
35
35
|
/** @brief libcouchbase version string */
|
36
|
-
#define LCB_VERSION_STRING "3.
|
36
|
+
#define LCB_VERSION_STRING "3.3.3-njs"
|
37
37
|
|
38
38
|
/**@brief libcouchbase hex version
|
39
39
|
*
|
@@ -50,12 +50,12 @@
|
|
50
50
|
* 2.1.3 | 0x020103
|
51
51
|
* 3.0.15 | 0x030015
|
52
52
|
*/
|
53
|
-
#define LCB_VERSION
|
53
|
+
#define LCB_VERSION 0x030303
|
54
54
|
|
55
55
|
/**@brief The SCM revision ID
|
56
56
|
* @see LCB_CNTL_CHANGESET
|
57
57
|
*/
|
58
|
-
#define LCB_VERSION_CHANGESET "
|
58
|
+
#define LCB_VERSION_CHANGESET "66ff4fad9947e6fb60be06b3aeb57a8b77fbada2"
|
59
59
|
|
60
60
|
/**@brief The client ID
|
61
61
|
*/
|
@@ -72,7 +72,7 @@ X(LCB_ERR_REQUEST_CANCELED, 202, LCB_ERROR_TYPE_SHARED, 0, "A request is
|
|
72
72
|
X(LCB_ERR_INVALID_ARGUMENT, 203, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "It is unambiguously determined that the error was caused because of invalid arguments from the user") \
|
73
73
|
X(LCB_ERR_SERVICE_NOT_AVAILABLE, 204, LCB_ERROR_TYPE_SHARED, 0, "It was determined from the config unambiguously that the service is not available") \
|
74
74
|
X(LCB_ERR_INTERNAL_SERVER_FAILURE, 205, LCB_ERROR_TYPE_SHARED, 0, "Internal server error") \
|
75
|
-
X(LCB_ERR_AUTHENTICATION_FAILURE, 206, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "Authentication error") \
|
75
|
+
X(LCB_ERR_AUTHENTICATION_FAILURE, 206, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "Authentication error. Possible reasons: incorrect authentication configuration, bucket doesn't exist or bucket may be hibernated.") \
|
76
76
|
X(LCB_ERR_TEMPORARY_FAILURE, 207, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_TRANSIENT, "Temporary failure") \
|
77
77
|
X(LCB_ERR_PARSING_FAILURE, 208, LCB_ERROR_TYPE_SHARED, 0, "Parsing failed") \
|
78
78
|
X(LCB_ERR_CAS_MISMATCH, 209, LCB_ERROR_TYPE_SHARED, LCB_ERROR_FLAG_INPUT, "CAS mismatch") \
|
@@ -15,7 +15,7 @@ BuildRequires: cmake >= 3.5.1
|
|
15
15
|
|
16
16
|
BuildRequires: pkgconfig(libevent) >= 2
|
17
17
|
BuildRequires: libev-devel >= 3
|
18
|
-
BuildRequires:
|
18
|
+
BuildRequires: openssl11-devel
|
19
19
|
BuildRequires: systemtap-sdt-devel, systemtap-devel
|
20
20
|
URL: https://developer.couchbase.com/server/other-products/release-notes-archives/c-sdk
|
21
21
|
Source: https://packages.couchbase.com/clients/c/@TARREDAS@.tar.gz
|
@@ -155,7 +155,7 @@ int iocp_w32err_2errno(DWORD error);
|
|
155
155
|
DWORD iocp_set_last_error(lcb_io_opt_t io, SOCKET sock);
|
156
156
|
|
157
157
|
/** Get current timestamp in microseconds */
|
158
|
-
|
158
|
+
uint64_t iocp_micros(void);
|
159
159
|
|
160
160
|
/** Get current timestamp in milliseconds */
|
161
161
|
#define iocp_millis() (iocp_micros() / 1000)
|
@@ -209,9 +209,9 @@ static void deque_expired_timers(iocp_t *io, lcb_U64 now)
|
|
209
209
|
/** Maximum amount of time the I/O can hog the loop */
|
210
210
|
#define IOCP_IOLOOP_MAXTIME 1000
|
211
211
|
|
212
|
-
static int should_yield(
|
212
|
+
static int should_yield(uint64_t start)
|
213
213
|
{
|
214
|
-
|
214
|
+
uint64_t now = iocp_micros();
|
215
215
|
return now - start > IOCP_IOLOOP_MAXTIME;
|
216
216
|
}
|
217
217
|
|
@@ -238,7 +238,7 @@ static void iocp_run_loop(lcb_io_opt_t iobase, int is_tick)
|
|
238
238
|
|
239
239
|
do {
|
240
240
|
/** To ensure we don't starve pending timers, use an iteration */
|
241
|
-
|
241
|
+
uint64_t usStartTime;
|
242
242
|
|
243
243
|
if (!now) {
|
244
244
|
now = iocp_millis();
|
@@ -44,9 +44,9 @@ DWORD iocp_set_last_error(lcb_io_opt_t io, SOCKET sock)
|
|
44
44
|
return werr;
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
uint64_t iocp_micros(void)
|
48
48
|
{
|
49
|
-
return
|
49
|
+
return gethrtime() / 1000;
|
50
50
|
}
|
51
51
|
|
52
52
|
LPFN_CONNECTEX iocp_initialize_connectex(SOCKET sock)
|
@@ -45,6 +45,7 @@ struct FileProvider : Provider, Listener {
|
|
45
45
|
}
|
46
46
|
}
|
47
47
|
void write_cache(lcbvb_CONFIG *cfg);
|
48
|
+
void mkcachefile(const char *name, const char *bucket);
|
48
49
|
|
49
50
|
/* Overrides */
|
50
51
|
ConfigInfo *get_cached() override;
|
@@ -58,6 +59,7 @@ struct FileProvider : Provider, Listener {
|
|
58
59
|
int last_errno;
|
59
60
|
bool is_readonly; /* Whether the config cache should _not_ overwrite the file */
|
60
61
|
lcb::io::Timer<FileProvider, &FileProvider::reload_cache> timer;
|
62
|
+
bool do_not_cache_cluster{true};
|
61
63
|
};
|
62
64
|
|
63
65
|
FileProvider::Status FileProvider::load_cache()
|
@@ -70,7 +72,9 @@ FileProvider::Status FileProvider::load_cache()
|
|
70
72
|
|
71
73
|
if (!ifs.is_open() || !ifs.good()) {
|
72
74
|
int save_errno = last_errno = errno;
|
73
|
-
lcb_log(LOGARGS(this,
|
75
|
+
lcb_log(LOGARGS(this, WARN),
|
76
|
+
LOGFMT "Couldn't open config cache for reading (%s). Proceed to next configuration provider.",
|
77
|
+
LOGID(this), strerror(save_errno));
|
74
78
|
return CACHE_ERROR;
|
75
79
|
}
|
76
80
|
|
@@ -118,17 +122,26 @@ FileProvider::Status FileProvider::load_cache()
|
|
118
122
|
goto GT_DONE;
|
119
123
|
}
|
120
124
|
|
121
|
-
if (lcbvb_get_distmode(vbc)
|
125
|
+
if (lcbvb_get_distmode(vbc) == LCBVB_DIST_KETAMA) {
|
122
126
|
lcb_log(LOGARGS(this, ERROR), LOGFMT "Not applying cached memcached config", LOGID(this));
|
123
127
|
goto GT_DONE;
|
124
128
|
}
|
125
129
|
|
126
|
-
if (settings().bucket == nullptr) {
|
127
|
-
lcb_log(
|
130
|
+
if (settings().bucket == nullptr && vbc->bname != nullptr) {
|
131
|
+
lcb_log(
|
132
|
+
LOGARGS(this, DEBUG),
|
133
|
+
LOGFMT
|
134
|
+
"The cached configuration has bucket associated, but the connection does not have it. Ignore the cache.",
|
135
|
+
LOGID(this));
|
128
136
|
goto GT_DONE;
|
129
|
-
}
|
130
|
-
|
131
|
-
|
137
|
+
} else if (settings().bucket != nullptr && vbc->bname == nullptr) {
|
138
|
+
lcb_log(
|
139
|
+
LOGARGS(this, DEBUG),
|
140
|
+
LOGFMT
|
141
|
+
"The connection has bucket associated, but the cached configuration does not have it. Ignore the cache.",
|
142
|
+
LOGID(this));
|
143
|
+
goto GT_DONE;
|
144
|
+
} else if (settings().bucket != nullptr && vbc->bname != nullptr && strcmp(vbc->bname, settings().bucket) != 0) {
|
132
145
|
lcb_log(LOGARGS(this, ERROR), LOGFMT "Bucket name in file is different from the one requested", LOGID(this));
|
133
146
|
goto GT_DONE;
|
134
147
|
}
|
@@ -152,7 +165,7 @@ GT_DONE:
|
|
152
165
|
|
153
166
|
void FileProvider::write_cache(lcbvb_CONFIG *cfg)
|
154
167
|
{
|
155
|
-
if (filename.empty() || is_readonly ||
|
168
|
+
if (filename.empty() || is_readonly || (do_not_cache_cluster && parent->settings->conntype == LCB_TYPE_CLUSTER)) {
|
156
169
|
return;
|
157
170
|
}
|
158
171
|
|
@@ -234,7 +247,7 @@ FileProvider::FileProvider(Confmon *parent_)
|
|
234
247
|
parent->add_listener(this);
|
235
248
|
}
|
236
249
|
|
237
|
-
|
250
|
+
void FileProvider::mkcachefile(const char *name, const char *bucket)
|
238
251
|
{
|
239
252
|
std::string buffer;
|
240
253
|
bool is_dir = false;
|
@@ -252,22 +265,23 @@ static std::string mkcachefile(const char *name, const char *bucket)
|
|
252
265
|
is_dir = true;
|
253
266
|
}
|
254
267
|
if (is_dir) {
|
268
|
+
// append bucket name only if we know that cachefile is directory
|
255
269
|
if (bucket == nullptr) {
|
256
|
-
|
270
|
+
buffer += ".cluster";
|
271
|
+
do_not_cache_cluster = false;
|
272
|
+
} else {
|
273
|
+
buffer += bucket;
|
257
274
|
}
|
258
|
-
// append bucket name only if we know that
|
259
|
-
// cachefile is directory
|
260
|
-
buffer += bucket;
|
261
275
|
}
|
262
276
|
|
263
|
-
|
277
|
+
filename = buffer;
|
264
278
|
}
|
265
279
|
|
266
280
|
bool lcb::clconfig::file_set_filename(Provider *p, const char *f, bool ro)
|
267
281
|
{
|
268
282
|
auto *provider = static_cast<FileProvider *>(p);
|
269
283
|
provider->enabled = true;
|
270
|
-
provider->
|
284
|
+
provider->mkcachefile(f, p->parent->settings->bucket);
|
271
285
|
if (provider->filename.empty()) {
|
272
286
|
return false;
|
273
287
|
}
|
@@ -122,9 +122,6 @@ struct collection_qualifier {
|
|
122
122
|
/* nullptr/0 for collection is mapped to default collection */
|
123
123
|
return true;
|
124
124
|
}
|
125
|
-
if (element_len < 1 || element_len > 30) {
|
126
|
-
return false;
|
127
|
-
}
|
128
125
|
for (size_t i = 0; i < element_len; ++i) {
|
129
126
|
if (!is_valid_collection_char(element[i])) {
|
130
127
|
return false;
|
package/deps/lcb/src/instance.cc
CHANGED
@@ -466,6 +466,25 @@ lcb_STATUS lcb_create(lcb_INSTANCE **instance, const lcb_CREATEOPTS *options)
|
|
466
466
|
goto GT_DONE;
|
467
467
|
}
|
468
468
|
|
469
|
+
{
|
470
|
+
// Warn users if they attempt to use Capella without TLS being enabled.
|
471
|
+
bool is_capella = false;
|
472
|
+
static std::string suffix = "cloud.couchbase.com";
|
473
|
+
for (auto &node : spec.hosts()) {
|
474
|
+
auto pos = node.hostname.find(suffix);
|
475
|
+
if (pos != std::string::npos && pos + suffix.size() == node.hostname.size()) {
|
476
|
+
is_capella = true;
|
477
|
+
break;
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
if (is_capella && (spec.sslopts() & LCB_SSL_ENABLED) == 0) {
|
482
|
+
lcb_log(LOGARGS(obj, INFO),
|
483
|
+
"TLS is required when connecting to Couchbase Capella. Please enable TLS by prefixing "
|
484
|
+
"the connection string with \"couchbases://\" (note the final 's').");
|
485
|
+
}
|
486
|
+
}
|
487
|
+
|
469
488
|
if ((obj = (lcb_INSTANCE *)calloc(1, sizeof(*obj))) == nullptr) {
|
470
489
|
err = LCB_ERR_NO_MEMORY;
|
471
490
|
goto GT_DONE;
|
@@ -69,7 +69,7 @@ LIBCOUCHBASE_API lcb_STATUS lcb_respping_result_id(const lcb_RESPPING *resp, siz
|
|
69
69
|
return LCB_ERR_OPTIONS_CONFLICT;
|
70
70
|
}
|
71
71
|
*endpoint_id = resp->services[index].id;
|
72
|
-
*endpoint_id_len = strlen(*endpoint_id);
|
72
|
+
*endpoint_id_len = *endpoint_id == nullptr ? 0 : strlen(*endpoint_id);
|
73
73
|
return LCB_SUCCESS;
|
74
74
|
}
|
75
75
|
|
@@ -100,7 +100,7 @@ LIBCOUCHBASE_API lcb_STATUS lcb_respping_result_local(const lcb_RESPPING *resp,
|
|
100
100
|
return LCB_ERR_OPTIONS_CONFLICT;
|
101
101
|
}
|
102
102
|
*address = resp->services[index].local;
|
103
|
-
*address_len = strlen(*address);
|
103
|
+
*address_len = *address == nullptr ? 0 : strlen(*address);
|
104
104
|
return LCB_SUCCESS;
|
105
105
|
}
|
106
106
|
|
package/deps/lcb/src/settings.cc
CHANGED