couchbase 3.2.4 → 3.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/binding.gyp +5 -0
  2. package/deps/lcb/CMakeLists.txt +28 -6
  3. package/deps/lcb/README.markdown +5 -9
  4. package/deps/lcb/RELEASE_NOTES.markdown +80 -5
  5. package/deps/lcb/cmake/Modules/GetVersionInfo.cmake +1 -1
  6. package/deps/lcb/doc/Doxyfile +1 -1
  7. package/deps/lcb/doc/cbc.markdown +10 -0
  8. package/deps/lcb/gyp_config/common/libcouchbase/configuration.h +3 -3
  9. package/deps/lcb/include/libcouchbase/couchbase.h +52 -0
  10. package/deps/lcb/include/libcouchbase/error.h +5 -2
  11. package/deps/lcb/libcouchbase.gyp +7 -1
  12. package/deps/lcb/packaging/rpm/libcouchbase.spec.in +1 -1
  13. package/deps/lcb/plugins/io/iocp/iocp_iops.h +1 -1
  14. package/deps/lcb/plugins/io/iocp/iocp_loop.c +3 -3
  15. package/deps/lcb/plugins/io/iocp/iocp_util.c +2 -2
  16. package/deps/lcb/src/bucketconfig/bc_file.cc +29 -15
  17. package/deps/lcb/src/capi/cmd_counter.hh +12 -0
  18. package/deps/lcb/src/capi/cmd_exists.hh +12 -0
  19. package/deps/lcb/src/capi/cmd_get.hh +12 -0
  20. package/deps/lcb/src/capi/cmd_get_replica.hh +14 -1
  21. package/deps/lcb/src/capi/cmd_query.cc +13 -0
  22. package/deps/lcb/src/capi/cmd_query.hh +22 -14
  23. package/deps/lcb/src/capi/cmd_remove.hh +12 -0
  24. package/deps/lcb/src/capi/cmd_store.hh +12 -0
  25. package/deps/lcb/src/capi/cmd_subdoc.hh +12 -0
  26. package/deps/lcb/src/capi/cmd_touch.hh +12 -0
  27. package/deps/lcb/src/capi/cmd_unlock.hh +12 -0
  28. package/deps/lcb/src/capi/collection_qualifier.hh +4 -9
  29. package/deps/lcb/src/instance.cc +19 -0
  30. package/deps/lcb/src/internal.h +2 -1
  31. package/deps/lcb/src/mcserver/negotiate.cc +3 -0
  32. package/deps/lcb/src/n1ql/n1ql.cc +5 -1
  33. package/deps/lcb/src/n1ql/query_handle.cc +55 -30
  34. package/deps/lcb/src/n1ql/query_handle.hh +14 -2
  35. package/deps/lcb/src/operations/counter.cc +12 -0
  36. package/deps/lcb/src/operations/exists.cc +12 -0
  37. package/deps/lcb/src/operations/get.cc +12 -0
  38. package/deps/lcb/src/operations/get_replica.cc +18 -6
  39. package/deps/lcb/src/operations/ping.cc +2 -2
  40. package/deps/lcb/src/operations/remove.cc +12 -0
  41. package/deps/lcb/src/operations/store.cc +12 -0
  42. package/deps/lcb/src/operations/subdoc.cc +12 -0
  43. package/deps/lcb/src/operations/touch.cc +12 -0
  44. package/deps/lcb/src/operations/unlock.cc +12 -0
  45. package/deps/lcb/src/search/search_handle.cc +1 -2
  46. package/deps/lcb/src/settings.cc +1 -0
  47. package/deps/lcb/src/ssl/ssl_common.c +111 -22
  48. package/deps/lcb/src/utilities.cc +21 -0
  49. package/deps/lcb/src/utilities.h +3 -0
  50. package/deps/lcb/src/vbucket/vbucket.c +16 -7
  51. package/deps/lcb/tests/CMakeLists.txt +1 -1
  52. package/deps/lcb/tests/iotests/mock-environment.cc +13 -1
  53. package/deps/lcb/tests/iotests/mock-environment.h +3 -1
  54. package/deps/lcb/tests/iotests/serverparams.h +7 -2
  55. package/deps/lcb/tests/iotests/t_ratelimit.cc +739 -0
  56. package/deps/lcb/tests/iotests/testutil.cc +174 -0
  57. package/deps/lcb/tests/iotests/testutil.h +53 -0
  58. package/deps/lcb/tools/CMakeLists.txt +1 -1
  59. package/deps/lcb/tools/cbc-handlers.h +39 -0
  60. package/deps/lcb/tools/cbc-n1qlback.cc +1 -0
  61. package/deps/lcb/tools/cbc-pillowfight.cc +45 -35
  62. package/deps/lcb/tools/cbc.cc +31 -0
  63. package/deps/lcb/tools/docgen/docgen.h +11 -10
  64. package/dist/analyticsexecutor.js +2 -2
  65. package/dist/analyticsindexmanager.js +3 -3
  66. package/dist/binarycollection.d.ts +17 -0
  67. package/dist/binding.js +1 -1
  68. package/dist/bindingutilities.js +5 -1
  69. package/dist/bucketmanager.d.ts +1 -22
  70. package/dist/bucketmanager.js +5 -5
  71. package/dist/cluster.js +1 -1
  72. package/dist/collection.js +6 -6
  73. package/dist/collectionmanager.js +2 -2
  74. package/dist/connection.js +3 -3
  75. package/dist/connspec.js +5 -1
  76. package/dist/couchbase.js +5 -1
  77. package/dist/httpexecutor.d.ts +1 -0
  78. package/dist/httpexecutor.js +5 -1
  79. package/dist/logging.js +1 -1
  80. package/dist/queryexecutor.js +3 -3
  81. package/dist/searchindexmanager.js +1 -1
  82. package/dist/usermanager.js +2 -2
  83. package/dist/utilities.d.ts +1 -2
  84. package/dist/utilities.js +9 -2
  85. package/dist/viewexecutor.js +1 -1
  86. package/package.json +1 -1
  87. package/src/uv-plugin-all.cpp +1 -0
  88. package/dist/cas.d.ts +0 -0
  89. package/dist/cas.js +0 -1
package/binding.gyp CHANGED
@@ -67,6 +67,11 @@
67
67
  '-pedantic',
68
68
  '-std=gnu99',
69
69
  ]
70
+ }],
71
+ ['OS=="linux"', {
72
+ "libraries": [
73
+ '-static-libgcc -static-libstdc++',
74
+ ]
70
75
  }]
71
76
  ],
72
77
  'sources': [
@@ -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.2.4 LANGUAGES C CXX)
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(STATUS "SSL Not Found. SSL support will be disabled")
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
- ADD_SUBDIRECTORY(contrib/lcb-jsoncpp)
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()
@@ -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,19 +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
+
66
+ ## 3.2.5 (2022-02-08)
67
+
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
72
+ the error map response has been received, the negotiation is complete.
73
+ * CCBC-1529: load authentication certificate as chain file.
74
+ * CCBC-1525: remove stringstream in `collection_qualifier`. Constructing a stringstream object every time
75
+ `collection_qualifier` is constructed is very expensive.
76
+ * CCBC-1528: update parsing of "quota limit" error for FTS
77
+
3
78
  ## 3.2.4 (2021-11-23)
4
79
 
5
- 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.
6
81
 
7
- 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`
8
83
  request, and usually await for `hello`+`error_map` responses, because after that goes SASL authentication (and then
9
84
  optional selection of the bucket) which cannot be completely pipelined. But in case of client certificate, we might
10
85
  terminate bootstrap process too early if the bootstrap process does not require immediate selection of the bucket.
11
86
 
12
- 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`.
13
88
 
14
- 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`.
15
90
 
16
- 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
17
92
  value in mutation operations.
18
93
 
19
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.5")
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}")
@@ -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.2.4
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.2.4-njs"
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 0x030204
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 "38cc0708dfcc5a706c6b21dc80bcd84f05890225"
58
+ #define LCB_VERSION_CHANGESET "66ff4fad9947e6fb60be06b3aeb57a8b77fbada2"
59
59
 
60
60
  /**@brief The client ID
61
61
  */
@@ -710,6 +710,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdget_timeout(lcb_CMDGET *cmd, uint32_t timeout
710
710
  * @internal Internal: This should never be used and is not supported.
711
711
  */
712
712
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdget_on_behalf_of(lcb_CMDGET *cmd, const char *data, size_t data_len);
713
+ /**
714
+ * @internal Internal: This should never be used and is not supported.
715
+ */
716
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdget_on_behalf_of_extra_privilege(lcb_CMDGET *cmd, const char *privilege,
717
+ size_t privilege_len);
713
718
 
714
719
  LIBCOUCHBASE_API lcb_STATUS lcb_get(lcb_INSTANCE *instance, void *cookie, const lcb_CMDGET *cmd);
715
720
  /**@}*/
@@ -816,6 +821,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdgetreplica_timeout(lcb_CMDGETREPLICA *cmd, ui
816
821
  * @internal Internal: This should never be used and is not supported.
817
822
  */
818
823
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdgetreplica_on_behalf_of(lcb_CMDGETREPLICA *cmd, const char *data, size_t data_len);
824
+ /**
825
+ * @internal Internal: This should never be used and is not supported.
826
+ */
827
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdgetreplica_on_behalf_of_extra_privilege(lcb_CMDGETREPLICA *cmd,
828
+ const char *privilege, size_t privilege_len);
819
829
  LIBCOUCHBASE_API lcb_STATUS lcb_getreplica(lcb_INSTANCE *instance, void *cookie, const lcb_CMDGETREPLICA *cmd);
820
830
 
821
831
  /**@}*/
@@ -843,6 +853,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdexists_timeout(lcb_CMDEXISTS *cmd, uint32_t t
843
853
  * @internal Internal: This should never be used and is not supported.
844
854
  */
845
855
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdexists_on_behalf_of(lcb_CMDEXISTS *cmd, const char *data, size_t data_len);
856
+ /**
857
+ * @internal Internal: This should never be used and is not supported.
858
+ */
859
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdexists_on_behalf_of_extra_privilege(lcb_CMDEXISTS *cmd, const char *privilege,
860
+ size_t privilege_len);
846
861
 
847
862
  LIBCOUCHBASE_API lcb_STATUS lcb_exists(lcb_INSTANCE *instance, void *cookie, const lcb_CMDEXISTS *cmd);
848
863
 
@@ -994,6 +1009,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdstore_timeout(lcb_CMDSTORE *cmd, uint32_t tim
994
1009
  * @internal Internal: This should never be used and is not supported.
995
1010
  */
996
1011
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdstore_on_behalf_of(lcb_CMDSTORE *cmd, const char *data, size_t data_len);
1012
+ /**
1013
+ * @internal Internal: This should never be used and is not supported.
1014
+ */
1015
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdstore_on_behalf_of_extra_privilege(lcb_CMDSTORE *cmd, const char *privilege,
1016
+ size_t privilege_len);
997
1017
  LIBCOUCHBASE_API lcb_STATUS lcb_store(lcb_INSTANCE *instance, void *cookie, const lcb_CMDSTORE *cmd);
998
1018
  /**@}*/
999
1019
 
@@ -1103,6 +1123,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdremove_timeout(lcb_CMDREMOVE *cmd, uint32_t t
1103
1123
  * @internal Internal: This should never be used and is not supported.
1104
1124
  */
1105
1125
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdremove_on_behalf_of(lcb_CMDREMOVE *cmd, const char *data, size_t data_len);
1126
+ /**
1127
+ * @internal Internal: This should never be used and is not supported.
1128
+ */
1129
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdremove_on_behalf_of_extra_privilege(lcb_CMDREMOVE *cmd, const char *privilege,
1130
+ size_t privilege_len);
1106
1131
  LIBCOUCHBASE_API lcb_STATUS lcb_remove(lcb_INSTANCE *instance, void *cookie, const lcb_CMDREMOVE *cmd);
1107
1132
 
1108
1133
  /**@}*/
@@ -1196,6 +1221,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdcounter_timeout(lcb_CMDCOUNTER *cmd, uint32_t
1196
1221
  * @internal Internal: This should never be used and is not supported.
1197
1222
  */
1198
1223
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdcounter_on_behalf_of(lcb_CMDCOUNTER *cmd, const char *data, size_t data_len);
1224
+ /**
1225
+ * @internal Internal: This should never be used and is not supported.
1226
+ */
1227
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdcounter_on_behalf_of_extra_privilege(lcb_CMDCOUNTER *cmd, const char *privilege,
1228
+ size_t privilege_len);
1199
1229
  LIBCOUCHBASE_API lcb_STATUS lcb_counter(lcb_INSTANCE *instance, void *cookie, const lcb_CMDCOUNTER *cmd);
1200
1230
 
1201
1231
  /**@} (Group: Counter) */
@@ -1277,6 +1307,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdunlock_timeout(lcb_CMDUNLOCK *cmd, uint32_t t
1277
1307
  * @internal Internal: This should never be used and is not supported.
1278
1308
  */
1279
1309
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdunlock_on_behalf_of(lcb_CMDUNLOCK *cmd, const char *data, size_t data_len);
1310
+ /**
1311
+ * @internal Internal: This should never be used and is not supported.
1312
+ */
1313
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdunlock_on_behalf_of_extra_privilege(lcb_CMDUNLOCK *cmd, const char *privilege,
1314
+ size_t privilege_len);
1280
1315
  LIBCOUCHBASE_API lcb_STATUS lcb_unlock(lcb_INSTANCE *instance, void *cookie, const lcb_CMDUNLOCK *cmd);
1281
1316
 
1282
1317
  /**@} (Group: Unlock) */
@@ -1348,6 +1383,11 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdtouch_timeout(lcb_CMDTOUCH *cmd, uint32_t tim
1348
1383
  * @internal Internal: This should never be used and is not supported.
1349
1384
  */
1350
1385
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdtouch_on_behalf_of(lcb_CMDTOUCH *cmd, const char *data, size_t data_len);
1386
+ /**
1387
+ * @internal Internal: This should never be used and is not supported.
1388
+ */
1389
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdtouch_on_behalf_of_extra_privilege(lcb_CMDTOUCH *cmd, const char *privilege,
1390
+ size_t privilege_len);
1351
1391
  LIBCOUCHBASE_API lcb_STATUS lcb_touch(lcb_INSTANCE *instance, void *cookie, const lcb_CMDTOUCH *cmd);
1352
1392
 
1353
1393
  /**@} (Group: Touch) */
@@ -3070,6 +3110,16 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_option(lcb_CMDQUERY *cmd, const char *n
3070
3110
  size_t value_len);
3071
3111
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_handle(lcb_CMDQUERY *cmd, lcb_QUERY_HANDLE **handle);
3072
3112
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_timeout(lcb_CMDQUERY *cmd, uint32_t timeout);
3113
+ /**
3114
+ * @uncommitted
3115
+ * Indicates that the query engine to preserve expiration values set on any
3116
+ * documents modified by this query.
3117
+ *
3118
+ *
3119
+ * @param cmd the command
3120
+ * @param preserve_expiry if non-zero, the query will preserve expiration values
3121
+ */
3122
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdquery_preserve_expiry(lcb_CMDQUERY *cmd, int preserve_expiry);
3073
3123
 
3074
3124
  /**
3075
3125
  * @internal Internal: This should never be used and is not supported.
@@ -3290,6 +3340,8 @@ LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_timeout(lcb_CMDSUBDOC *cmd, uint32_t t
3290
3340
  * @internal Internal: This should never be used and is not supported.
3291
3341
  */
3292
3342
  LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_on_behalf_of(lcb_CMDSUBDOC *cmd, const char *data, size_t data_len);
3343
+ LIBCOUCHBASE_API lcb_STATUS lcb_cmdsubdoc_on_behalf_of_extra_privilege(lcb_CMDSUBDOC *cmd, const char *privilege,
3344
+ size_t privilege_len);
3293
3345
 
3294
3346
  LIBCOUCHBASE_API lcb_STATUS lcb_subdoc(lcb_INSTANCE *instance, void *cookie, const lcb_CMDSUBDOC *cmd);
3295
3347
  /** @} */
@@ -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") \
@@ -250,6 +250,8 @@ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_rc(const lcb_QUERY_ERROR_CONTEXT *c
250
250
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_first_error_code(const lcb_QUERY_ERROR_CONTEXT *ctx, uint32_t *code);
251
251
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_first_error_message(const lcb_QUERY_ERROR_CONTEXT *ctx,
252
252
  const char **message, size_t *message_len);
253
+ LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_error_response_body(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **body,
254
+ size_t *body_len);
253
255
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_statement(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **statement,
254
256
  size_t *statement_len);
255
257
  LIBCOUCHBASE_API lcb_STATUS lcb_errctx_query_client_context_id(const lcb_QUERY_ERROR_CONTEXT *ctx, const char **id,
@@ -388,7 +390,8 @@ lcb_errmap_callback lcb_set_errmap_callback(lcb_INSTANCE *instance, lcb_errmap_c
388
390
  X(LCB_RETRY_REASON_CIRCUIT_BREAKER_OPEN, 13, 1, 0) \
389
391
  X(LCB_RETRY_REASON_QUERY_PREPARED_STATEMENT_FAILURE, 14, 1, 0) \
390
392
  X(LCB_RETRY_REASON_ANALYTICS_TEMPORARY_FAILURE, 15, 1, 0) \
391
- X(LCB_RETRY_REASON_SEARCH_TOO_MANY_REQUESTS, 16, 1, 0)
393
+ X(LCB_RETRY_REASON_SEARCH_TOO_MANY_REQUESTS, 16, 1, 0) \
394
+ X(LCB_RETRY_REASON_QUERY_ERROR_RETRYABLE, 17, 1, 0)
392
395
  /* clang-format on */
393
396
 
394
397
  typedef enum {
@@ -12,6 +12,7 @@
12
12
  'msvs_settings': {
13
13
  'VCCLCompilerTool': {
14
14
  'RuntimeLibrary': 1, # static debug
15
+ 'ExceptionHandling': 2
15
16
  },
16
17
  },
17
18
  },
@@ -20,6 +21,7 @@
20
21
  'msvs_settings': {
21
22
  'VCCLCompilerTool': {
22
23
  'RuntimeLibrary': 0, # static release
24
+ 'ExceptionHandling': 2
23
25
  },
24
26
  },
25
27
  }
@@ -64,6 +66,11 @@
64
66
  ]
65
67
  }
66
68
  }],
69
+ ['OS=="linux"', {
70
+ "libraries": [
71
+ '-static-libgcc -static-libstdc++',
72
+ ]
73
+ }],
67
74
  ]
68
75
  },
69
76
 
@@ -155,7 +162,6 @@
155
162
  'type': 'static_library',
156
163
  'sources': [
157
164
  'contrib/HdrHistogram_c/src/hdr_encoding.c',
158
- 'contrib/HdrHistogram_c/src/hdr_histogram_log_no_op.c',
159
165
  'contrib/HdrHistogram_c/src/hdr_histogram_log.c',
160
166
  'contrib/HdrHistogram_c/src/hdr_histogram.c',
161
167
  'contrib/HdrHistogram_c/src/hdr_interval_recorder.c',
@@ -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: openssl-devel
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
- lcb_U32 iocp_micros(void);
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(lcb_U32 start)
212
+ static int should_yield(uint64_t start)
213
213
  {
214
- lcb_U32 now = iocp_micros();
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
- lcb_U32 usStartTime;
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
- lcb_uint32_t iocp_micros(void)
47
+ uint64_t iocp_micros(void)
48
48
  {
49
- return (lcb_uint32_t)(gethrtime() / 1000);
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, ERROR), LOGFMT "Couldn't open for reading: %s", LOGID(this), strerror(save_errno));
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) != LCBVB_DIST_VBUCKET) {
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(LOGARGS(this, ERROR), LOGFMT "Bucket name is nullptr", LOGID(this));
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
- if (strcmp(vbc->bname, settings().bucket) != 0) {
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 || cfg->bname == nullptr || cfg->bname_len == 0) {
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
- static std::string mkcachefile(const char *name, const char *bucket)
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
- return "";
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
- return buffer;
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->filename = mkcachefile(f, p->parent->settings->bucket);
284
+ provider->mkcachefile(f, p->parent->settings->bucket);
271
285
  if (provider->filename.empty()) {
272
286
  return false;
273
287
  }
@@ -187,6 +187,17 @@ struct lcb_CMDCOUNTER_ {
187
187
  return LCB_SUCCESS;
188
188
  }
189
189
 
190
+ lcb_STATUS on_behalf_of_add_extra_privilege(std::string privilege)
191
+ {
192
+ extra_privileges_.emplace_back(std::move(privilege));
193
+ return LCB_SUCCESS;
194
+ }
195
+
196
+ const std::vector<std::string> &extra_privileges() const
197
+ {
198
+ return extra_privileges_;
199
+ }
200
+
190
201
  bool want_impersonation() const
191
202
  {
192
203
  return !impostor_.empty();
@@ -210,6 +221,7 @@ struct lcb_CMDCOUNTER_ {
210
221
  bool initialize_if_does_not_exist_{false};
211
222
  lcb_DURABILITY_LEVEL durability_level_{LCB_DURABILITYLEVEL_NONE};
212
223
  std::string impostor_{};
224
+ std::vector<std::string> extra_privileges_{};
213
225
  };
214
226
 
215
227
  /**