couchbase 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -0
- package/deps/couchbase-cxx-client/.github/workflows/linters.yml +2 -2
- package/deps/couchbase-cxx-client/.github/workflows/sanitizers.yml +18 -2
- package/deps/couchbase-cxx-client/.github/workflows/tests.yml +14 -34
- package/deps/couchbase-cxx-client/.github/workflows/windows.yml +13 -15
- package/deps/couchbase-cxx-client/CMakeLists.txt +6 -1
- package/deps/couchbase-cxx-client/bin/build-tests +3 -0
- package/deps/couchbase-cxx-client/bin/build-tests.rb +3 -0
- package/deps/couchbase-cxx-client/bin/init-cluster +1 -1
- package/deps/couchbase-cxx-client/bin/run-tests +1 -1
- package/deps/couchbase-cxx-client/cmake/StandardProjectSettings.cmake +1 -1
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +25 -6
- package/deps/couchbase-cxx-client/couchbase/io/mcbp_session.hxx +21 -7
- package/deps/couchbase-cxx-client/couchbase/meta/version.cxx +7 -0
- package/deps/couchbase-cxx-client/couchbase/operations/document_decrement.cxx +0 -3
- package/deps/couchbase-cxx-client/couchbase/operations/document_decrement.hxx +0 -1
- package/deps/couchbase-cxx-client/couchbase/operations/document_increment.cxx +0 -3
- package/deps/couchbase-cxx-client/couchbase/operations/document_increment.hxx +0 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_dataset_get_all.cxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_get_pending_mutations.cxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_get_pending_mutations.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/query_index_drop.cxx +4 -3
- package/deps/couchbase-cxx-client/couchbase/origin.hxx +10 -0
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_decrement.cxx +3 -8
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_decrement.hxx +0 -2
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_increment.cxx +0 -9
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_increment.hxx +0 -2
- package/deps/couchbase-cxx-client/couchbase/utils/json_streaming_lexer.cxx +6 -2
- package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +4 -6
- package/deps/couchbase-cxx-client/test/test_integration_connect.cxx +4 -0
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +194 -138
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +26 -10
- package/deps/couchbase-cxx-client/test/test_unit_json_streaming_lexer.cxx +119 -0
- package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +1 -1
- package/deps/couchbase-cxx-client/test/utils/server_version.cxx +2 -1
- package/deps/couchbase-cxx-client/test/utils/server_version.hxx +22 -4
- package/deps/couchbase-cxx-client/test/utils/test_context.cxx +11 -1
- package/deps/couchbase-cxx-client/test/utils/test_context.hxx +1 -0
- package/deps/couchbase-transactions-cxx/CMakeLists.txt +2 -2
- package/deps/couchbase-transactions-cxx/deps/couchbase-cxx-client/couchbase/{management/design_document_fmt.hxx → design_document_namespace_fmt.hxx} +5 -5
- package/deps/couchbase-transactions-cxx/deps/couchbase-cxx-client/couchbase/operations/management/query_index_get_all.cxx +26 -16
- package/deps/couchbase-transactions-cxx/include/couchbase/transactions/durability_level.hxx +15 -0
- package/deps/couchbase-transactions-cxx/include/couchbase/transactions.hxx +2 -6
- package/deps/couchbase-transactions-cxx/src/transactions/attempt_context_impl.cxx +1 -1
- package/deps/couchbase-transactions-cxx/src/transactions/logging.cxx +20 -17
- package/deps/couchbase-transactions-cxx/tests/transactions/simple_t.cpp +22 -0
- package/deps/couchbase-transactions-cxx/tests/transactions/transactions_env.h +1 -1
- package/dist/binding.d.ts +0 -2
- package/dist/collection.js +0 -2
- package/dist/httpexecutor.d.ts +1 -0
- package/package.json +1 -1
- package/src/jstocbpp_autogen.hpp +3 -9
- package/deps/couchbase-cxx-client/.github/workflows/benchmarks.yml +0 -94
- package/deps/couchbase-transactions-cxx/deps/couchbase-cxx-client/.github/workflows/benchmarks.yml +0 -94
package/README.md
CHANGED
@@ -85,6 +85,14 @@ respectively.
|
|
85
85
|
Finally, to build the API reference for the project, run `make docs` from the
|
86
86
|
root directory, and a docs folder will be created with the api reference.
|
87
87
|
|
88
|
+
# Support & Additional Resources
|
89
|
+
|
90
|
+
If you found an issue, please file it in our [JIRA](https://issues.couchbase.com/projects/JSCBC/issues/).
|
91
|
+
|
92
|
+
The Couchbase Discord server is a place where you can collaborate about all things Couchbase. Connect with others from the community, learn tips and tricks, and ask questions. [Join Discord and contribute](https://discord.com/invite/sQ5qbPZuTh).
|
93
|
+
|
94
|
+
You can ask questions in our [forums](https://forums.couchbase.com/).
|
95
|
+
|
88
96
|
## License
|
89
97
|
|
90
98
|
Copyright 2013 Couchbase Inc.
|
@@ -2,9 +2,9 @@ name: sanitizers
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [main]
|
6
6
|
pull_request:
|
7
|
-
branches: [
|
7
|
+
branches: [main]
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
address:
|
@@ -29,6 +29,10 @@ jobs:
|
|
29
29
|
submodules: recursive
|
30
30
|
- name: Initialize couchbase
|
31
31
|
run: ./bin/init-cluster
|
32
|
+
- name: ccache
|
33
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
34
|
+
with:
|
35
|
+
key: ${{ github.job }}
|
32
36
|
- name: Build tests
|
33
37
|
env:
|
34
38
|
CB_SANITIZER: asan
|
@@ -68,6 +72,10 @@ jobs:
|
|
68
72
|
submodules: recursive
|
69
73
|
- name: Initialize couchbase
|
70
74
|
run: ./bin/init-cluster
|
75
|
+
- name: ccache
|
76
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
77
|
+
with:
|
78
|
+
key: ${{ github.job }}
|
71
79
|
- name: Build tests
|
72
80
|
env:
|
73
81
|
CB_SANITIZER: lsan
|
@@ -107,6 +115,10 @@ jobs:
|
|
107
115
|
submodules: recursive
|
108
116
|
- name: Initialize couchbase
|
109
117
|
run: ./bin/init-cluster
|
118
|
+
- name: ccache
|
119
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
120
|
+
with:
|
121
|
+
key: ${{ github.job }}
|
110
122
|
- name: Build tests
|
111
123
|
env:
|
112
124
|
CB_SANITIZER: ubsan
|
@@ -146,6 +158,10 @@ jobs:
|
|
146
158
|
submodules: recursive
|
147
159
|
- name: Initialize couchbase
|
148
160
|
run: ./bin/init-cluster
|
161
|
+
- name: ccache
|
162
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
163
|
+
with:
|
164
|
+
key: ${{ github.job }}
|
149
165
|
- name: Build tests
|
150
166
|
env:
|
151
167
|
CB_SANITIZER: tsan
|
@@ -2,16 +2,22 @@ name: tests
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [main]
|
6
6
|
pull_request:
|
7
|
-
branches: [
|
7
|
+
branches: [main]
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
10
|
+
test:
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
server:
|
14
|
+
- 7.1.0
|
15
|
+
- 7.0.3
|
16
|
+
- 6.6.5
|
11
17
|
runs-on: ubuntu-20.04
|
12
18
|
services:
|
13
19
|
couchbase:
|
14
|
-
image: couchbase:enterprise
|
20
|
+
image: couchbase:enterprise-${{ matrix.server }}
|
15
21
|
ports:
|
16
22
|
- 8091-8096:8091-8096
|
17
23
|
- 11210:11210
|
@@ -25,36 +31,10 @@ jobs:
|
|
25
31
|
submodules: recursive
|
26
32
|
- name: Initialize couchbase
|
27
33
|
run: ./bin/init-cluster
|
28
|
-
- name:
|
29
|
-
|
30
|
-
- name: Check couchbase
|
31
|
-
run: ./bin/check-cluster
|
32
|
-
- name: Run tests
|
33
|
-
timeout-minutes: 15
|
34
|
-
env:
|
35
|
-
TEST_SERVER_VERSION: 7.0.3
|
36
|
-
TEST_CONNECTION_STRING: couchbase://127.0.0.1
|
37
|
-
TEST_LOG_LEVEL: trace
|
38
|
-
run: ./bin/run-tests
|
39
|
-
|
40
|
-
mad_hatter:
|
41
|
-
runs-on: ubuntu-20.04
|
42
|
-
services:
|
43
|
-
couchbase:
|
44
|
-
image: couchbase:enterprise-6.6.4
|
45
|
-
ports:
|
46
|
-
- 8091-8096:8091-8096
|
47
|
-
- 11210:11210
|
48
|
-
steps:
|
49
|
-
- name: Install build environment
|
50
|
-
run: |
|
51
|
-
sudo apt-get update -y
|
52
|
-
sudo apt-get install -y libssl-dev cmake gcc g++ curl
|
53
|
-
- uses: actions/checkout@v2
|
34
|
+
- name: ccache
|
35
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
54
36
|
with:
|
55
|
-
|
56
|
-
- name: Initialize couchbase
|
57
|
-
run: ./bin/init-cluster
|
37
|
+
key: ${{ github.job }}
|
58
38
|
- name: Build tests
|
59
39
|
run: ./bin/build-tests
|
60
40
|
- name: Check couchbase
|
@@ -62,7 +42,7 @@ jobs:
|
|
62
42
|
- name: Run tests
|
63
43
|
timeout-minutes: 15
|
64
44
|
env:
|
65
|
-
TEST_SERVER_VERSION:
|
45
|
+
TEST_SERVER_VERSION: ${{ matrix.server }}
|
66
46
|
TEST_CONNECTION_STRING: couchbase://127.0.0.1
|
67
47
|
TEST_LOG_LEVEL: trace
|
68
48
|
run: ./bin/run-tests
|
@@ -2,13 +2,16 @@ name: windows
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [main]
|
6
6
|
pull_request:
|
7
|
-
branches: [
|
7
|
+
branches: [main]
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
11
|
-
|
10
|
+
build:
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
os: [windows-2022, windows-2019]
|
14
|
+
runs-on: ${{ matrix.os }}
|
12
15
|
steps:
|
13
16
|
- name: Install build environment
|
14
17
|
run: |
|
@@ -16,17 +19,12 @@ jobs:
|
|
16
19
|
- uses: actions/checkout@v2
|
17
20
|
with:
|
18
21
|
submodules: recursive
|
19
|
-
- name:
|
20
|
-
|
21
|
-
|
22
|
-
vs19:
|
23
|
-
runs-on: windows-2019
|
24
|
-
steps:
|
25
|
-
- name: Install build environment
|
26
|
-
run: |
|
27
|
-
choco install --no-progress openssl
|
28
|
-
- uses: actions/checkout@v2
|
22
|
+
- name: ccache
|
23
|
+
uses: hendrikmuhs/ccache-action@v1.2
|
29
24
|
with:
|
30
|
-
|
25
|
+
key: ${{ github.job }}-${{ matrix.os }}
|
26
|
+
variant: sccache
|
31
27
|
- name: Build tests
|
28
|
+
env:
|
29
|
+
CB_CACHE_OPTION: sccache
|
32
30
|
run: ruby ./bin/build-tests.rb
|
@@ -101,7 +101,12 @@ target_include_directories(
|
|
101
101
|
target_link_libraries(couchbase_cxx_client PRIVATE project_options project_warnings)
|
102
102
|
|
103
103
|
include(cmake/DetectStandardFilesystem.cmake)
|
104
|
-
couchbase_cxx_check_filesystem(
|
104
|
+
couchbase_cxx_check_filesystem(
|
105
|
+
couchbase_cxx_client
|
106
|
+
"filesystem"
|
107
|
+
"std::filesystem"
|
108
|
+
"stdc++fs;c++fs"
|
109
|
+
STD_FILESYSTEM)
|
105
110
|
if(STD_FILESYSTEM)
|
106
111
|
message(STATUS "Using std::filesystem")
|
107
112
|
else()
|
@@ -32,12 +32,14 @@ CB_CC=${CB_CC:-$(which ${CB_DEFAULT_CC})}
|
|
32
32
|
CB_CXX=${CB_CXX:-$(which ${CB_DEFAULT_CXX})}
|
33
33
|
CB_NUMBER_OF_JOBS=${CB_NUMBER_OF_JOBS:-1}
|
34
34
|
CB_CMAKE_BUILD_TYPE=${CB_CMAKE_BUILD_TYPE:-Debug}
|
35
|
+
CB_CACHE_OPTION=${CB_CACHE_OPTION:-ccache}
|
35
36
|
|
36
37
|
echo "CB_CMAKE=${CB_CMAKE}"
|
37
38
|
echo "CB_CC=${CB_CC}"
|
38
39
|
echo "CB_CXX=${CB_CXX}"
|
39
40
|
echo "CB_NUMBER_OF_JOBS=${CB_NUMBER_OF_JOBS}"
|
40
41
|
echo "CB_CMAKE_BUILD_TYPE=${CB_CMAKE_BUILD_TYPE}"
|
42
|
+
echo "CB_CACHE_OPTION=${CB_CACHE_OPTION}"
|
41
43
|
|
42
44
|
CB_CMAKE_EXTRAS=
|
43
45
|
case "${CB_SANITIZER}" in
|
@@ -79,6 +81,7 @@ ${CB_CMAKE} \
|
|
79
81
|
-DCMAKE_CXX_COMPILER="${CB_CXX}" \
|
80
82
|
-DCOUCHBASE_CXX_CLIENT_BUILD_TESTS=ON \
|
81
83
|
-DCOUCHBASE_CXX_CLIENT_BUILD_SHARED=ON \
|
84
|
+
-DCACHE_OPTION="${CB_CACHE_OPTION}" \
|
82
85
|
${CB_CMAKE_EXTRAS} \
|
83
86
|
-B "${BUILD_DIR}" \
|
84
87
|
-S "${PROJECT_ROOT}"
|
@@ -48,6 +48,7 @@ CB_CC = ENV.fetch("CB_CC", which(CB_DEFAULT_CC))
|
|
48
48
|
CB_CXX = ENV.fetch("CB_CXX", which(CB_DEFAULT_CXX))
|
49
49
|
CB_NUMBER_OF_JOBS = ENV.fetch("CB_NUMBER_OF_JOBS", "1").to_i
|
50
50
|
CB_CMAKE_BUILD_TYPE = ENV.fetch("CB_CMAKE_BUILD_TYPE", "Debug")
|
51
|
+
CB_CACHE_OPTION = ENV.fetch("CB_CACHE_OPTION", "ccache")
|
51
52
|
|
52
53
|
puts "RUBY_PLATFORM=#{RUBY_PLATFORM}"
|
53
54
|
puts "CB_CMAKE=#{CB_CMAKE}"
|
@@ -58,6 +59,7 @@ if RUBY_PLATFORM !~ /mswin|mingw/
|
|
58
59
|
puts "CB_CC=#{CB_CC}"
|
59
60
|
puts "CB_CXX=#{CB_CXX}"
|
60
61
|
end
|
62
|
+
puts "CB_CACHE_OPTION=#{CB_CACHE_OPTION}"
|
61
63
|
|
62
64
|
CB_CMAKE_EXTRAS = []
|
63
65
|
case CB_SANITIZER
|
@@ -91,6 +93,7 @@ Dir.chdir(BUILD_DIR) do
|
|
91
93
|
run(CB_CMAKE,
|
92
94
|
"-DCMAKE_BUILD_TYPE=#{CB_CMAKE_BUILD_TYPE}",
|
93
95
|
"-DCOUCHBASE_CXX_CLIENT_BUILD_TESTS=ON",
|
96
|
+
"-DCACHE_OPTION=#{CB_CACHE_OPTION}",
|
94
97
|
*CB_CMAKE_EXTRAS,
|
95
98
|
"-B", BUILD_DIR,
|
96
99
|
"-S", PROJECT_ROOT)
|
@@ -30,7 +30,7 @@ options = {
|
|
30
30
|
username: ENV.fetch("CB_USERNAME", "Administrator"),
|
31
31
|
password: ENV.fetch("CB_PASSWORD", "password"),
|
32
32
|
bucket: ENV.fetch("CB_BUCKET", "default"),
|
33
|
-
server_quota: ENV.fetch("CB_SERVER_QUOTA",
|
33
|
+
server_quota: ENV.fetch("CB_SERVER_QUOTA", 2048).to_i,
|
34
34
|
index_quota: ENV.fetch("CB_INDEX_QUOTA", 256).to_i,
|
35
35
|
bucket_quota: ENV.fetch("CB_BUCKET_QUOTA", 256).to_i,
|
36
36
|
enable_developer_preview: ENV.fetch("CB_DEVELOPER_PREVIEW", false).to_b,
|
@@ -49,6 +49,14 @@ class cluster : public std::enable_shared_from_this<cluster>
|
|
49
49
|
return std::shared_ptr<cluster>(new cluster(ctx));
|
50
50
|
}
|
51
51
|
|
52
|
+
[[nodiscard]] std::pair<std::error_code, couchbase::origin> origin() const
|
53
|
+
{
|
54
|
+
if (stopped_) {
|
55
|
+
return { error::network_errc::cluster_closed, {} };
|
56
|
+
}
|
57
|
+
return { {}, origin_ };
|
58
|
+
}
|
59
|
+
|
52
60
|
template<typename Handler>
|
53
61
|
void open(const couchbase::origin& origin, Handler&& handler)
|
54
62
|
{
|
@@ -289,21 +297,32 @@ class cluster : public std::enable_shared_from_this<cluster>
|
|
289
297
|
{
|
290
298
|
// Warn users if they attempt to use Capella without TLS being enabled.
|
291
299
|
{
|
292
|
-
bool
|
300
|
+
bool has_capella_host = false;
|
301
|
+
bool has_non_capella_host = false;
|
293
302
|
static std::string suffix = "cloud.couchbase.com";
|
294
|
-
auto
|
295
|
-
for (auto& node : nodes_list) {
|
303
|
+
for (const auto& node : origin_.get_hostnames()) {
|
296
304
|
if (auto pos = node.find(suffix); pos != std::string::npos && pos + suffix.size() == node.size()) {
|
297
|
-
|
298
|
-
|
305
|
+
has_capella_host = true;
|
306
|
+
} else {
|
307
|
+
has_non_capella_host = true;
|
299
308
|
}
|
300
309
|
}
|
301
310
|
|
302
|
-
if (
|
311
|
+
if (has_capella_host && !origin_.options().enable_tls) {
|
303
312
|
LOG_WARNING("[{}]: TLS is required when connecting to Couchbase Capella. Please enable TLS by prefixing "
|
304
313
|
"the connection string with \"couchbases://\" (note the final 's').",
|
305
314
|
id_);
|
306
315
|
}
|
316
|
+
|
317
|
+
if (origin_.options().enable_tls /* TLS is enabled */
|
318
|
+
&& origin_.options().trust_certificate.empty() /* No CA certificate (or other SDK-specific trust source) is specified */
|
319
|
+
&& origin_.options().tls_verify != tls_verify_mode::none /* The user did not disable all TLS verification */
|
320
|
+
&& has_non_capella_host /* The connection string has a hostname that does NOT end in ".cloud.couchbase.com" */) {
|
321
|
+
LOG_ERROR("[{}] When TLS is enabled, the cluster options must specify certificate(s) to trust. (Unless connecting to "
|
322
|
+
"cloud.couchbase.com.)",
|
323
|
+
id_);
|
324
|
+
return handler(error::common_errc::invalid_argument);
|
325
|
+
}
|
307
326
|
}
|
308
327
|
|
309
328
|
if (origin_.options().enable_tls) {
|
@@ -405,7 +405,9 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
405
405
|
}
|
406
406
|
};
|
407
407
|
|
408
|
-
class normal_handler
|
408
|
+
class normal_handler
|
409
|
+
: public message_handler
|
410
|
+
, public std::enable_shared_from_this<normal_handler>
|
409
411
|
{
|
410
412
|
private:
|
411
413
|
std::shared_ptr<mcbp_session> session_;
|
@@ -413,11 +415,18 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
413
415
|
std::atomic_bool stopped_{ false };
|
414
416
|
|
415
417
|
public:
|
416
|
-
~normal_handler() override
|
418
|
+
~normal_handler() override
|
419
|
+
{
|
420
|
+
stop();
|
421
|
+
}
|
417
422
|
|
418
423
|
explicit normal_handler(std::shared_ptr<mcbp_session> session)
|
419
424
|
: session_(session)
|
420
425
|
, heartbeat_timer_(session_->ctx_)
|
426
|
+
{
|
427
|
+
}
|
428
|
+
|
429
|
+
void start()
|
421
430
|
{
|
422
431
|
if (session_->supports_gcccp_) {
|
423
432
|
fetch_config({});
|
@@ -559,11 +568,11 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
559
568
|
req.opaque(session_->next_opaque());
|
560
569
|
session_->write_and_flush(req.data());
|
561
570
|
heartbeat_timer_.expires_after(std::chrono::milliseconds(2500));
|
562
|
-
heartbeat_timer_.async_wait([
|
571
|
+
heartbeat_timer_.async_wait([self = shared_from_this()](std::error_code e) {
|
563
572
|
if (e == asio::error::operation_aborted) {
|
564
573
|
return;
|
565
574
|
}
|
566
|
-
fetch_config(e);
|
575
|
+
self->fetch_config(e);
|
567
576
|
});
|
568
577
|
}
|
569
578
|
};
|
@@ -782,6 +791,7 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
782
791
|
}
|
783
792
|
if (handler_) {
|
784
793
|
handler_->stop();
|
794
|
+
handler_ = nullptr;
|
785
795
|
}
|
786
796
|
{
|
787
797
|
std::scoped_lock lock(command_handlers_mutex_);
|
@@ -1053,7 +1063,11 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
1053
1063
|
return stop(retry_reason::node_not_available);
|
1054
1064
|
}
|
1055
1065
|
state_ = diag::endpoint_state::connected;
|
1056
|
-
|
1066
|
+
{
|
1067
|
+
auto handler = std::make_shared<normal_handler>(shared_from_this());
|
1068
|
+
handler->start();
|
1069
|
+
handler_ = handler;
|
1070
|
+
}
|
1057
1071
|
std::scoped_lock lock(pending_buffer_mutex_);
|
1058
1072
|
bootstrapped_ = true;
|
1059
1073
|
if (!pending_buffer_.empty()) {
|
@@ -1149,7 +1163,7 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
1149
1163
|
bootstrap_hostname_,
|
1150
1164
|
endpoint_address_,
|
1151
1165
|
endpoint_.port());
|
1152
|
-
handler_ = std::
|
1166
|
+
handler_ = std::make_shared<bootstrap_handler>(shared_from_this());
|
1153
1167
|
connection_deadline_.expires_at(asio::steady_timer::time_point::max());
|
1154
1168
|
connection_deadline_.cancel();
|
1155
1169
|
}
|
@@ -1271,7 +1285,7 @@ class mcbp_session : public std::enable_shared_from_this<mcbp_session>
|
|
1271
1285
|
couchbase::origin origin_;
|
1272
1286
|
std::optional<std::string> bucket_name_;
|
1273
1287
|
mcbp_parser parser_;
|
1274
|
-
std::
|
1288
|
+
std::shared_ptr<message_handler> handler_;
|
1275
1289
|
utils::movable_function<void(std::error_code, const topology::configuration&)> bootstrap_handler_{};
|
1276
1290
|
std::mutex command_handlers_mutex_{};
|
1277
1291
|
std::map<uint32_t, utils::movable_function<void(std::error_code, retry_reason, io::mcbp_message&&)>> command_handlers_{};
|
@@ -88,6 +88,13 @@ sdk_build_info()
|
|
88
88
|
#elif defined(SSLEAY_VERSION)
|
89
89
|
info["openssl_runtime"] = SSLeay_version(SSLEAY_VERSION);
|
90
90
|
#endif
|
91
|
+
info["__cplusplus"] = fmt::format("{}", __cplusplus);
|
92
|
+
#if defined(_MSC_VER)
|
93
|
+
info["_MSC_VER"] = fmt::format("{}", _MSC_VER);
|
94
|
+
#endif
|
95
|
+
#if defined(__GLIBC__)
|
96
|
+
info["libc"] = fmt::format("glibc {}.{}", __GLIBC__, __GLIBC_MINOR__);
|
97
|
+
#endif
|
91
98
|
|
92
99
|
return info;
|
93
100
|
}
|
@@ -50,7 +50,6 @@ struct decrement_request {
|
|
50
50
|
protocol::durability_level durability_level{ protocol::durability_level::none };
|
51
51
|
std::optional<std::chrono::milliseconds> timeout{};
|
52
52
|
io::retry_context<io::retry_strategy::best_effort> retries{ false };
|
53
|
-
bool preserve_expiry{ false };
|
54
53
|
|
55
54
|
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, mcbp_context&& context) const;
|
56
55
|
|
@@ -50,7 +50,6 @@ struct increment_request {
|
|
50
50
|
protocol::durability_level durability_level{ protocol::durability_level::none };
|
51
51
|
std::optional<std::chrono::milliseconds> timeout{};
|
52
52
|
io::retry_context<io::retry_strategy::best_effort> retries{ false };
|
53
|
-
bool preserve_expiry{ false };
|
54
53
|
|
55
54
|
[[nodiscard]] std::error_code encode_to(encoded_request_type& encoded, mcbp_context&& context) const;
|
56
55
|
|
package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_dataset_get_all.cxx
CHANGED
@@ -27,7 +27,7 @@ std::error_code
|
|
27
27
|
analytics_dataset_get_all_request::encode_to(encoded_request_type& encoded, http_context& /* context */) const
|
28
28
|
{
|
29
29
|
tao::json::value body{
|
30
|
-
{ "statement", "SELECT d.* FROM Metadata.`Dataset` d WHERE d.DataverseName <>
|
30
|
+
{ "statement", R"(SELECT d.* FROM Metadata.`Dataset` d WHERE d.DataverseName <> "Metadata" AND d.DatasetType = "INTERNAL")" },
|
31
31
|
};
|
32
32
|
encoded.headers["content-type"] = "application/json";
|
33
33
|
encoded.method = "POST";
|
@@ -47,7 +47,7 @@ analytics_get_pending_mutations_request::make_response(error_context::http&& ctx
|
|
47
47
|
if (payload.is_object()) {
|
48
48
|
for (const auto& [dataverse, entry] : payload.get_object()) {
|
49
49
|
for (const auto& [dataset, counter] : entry.get_object()) {
|
50
|
-
response.stats.try_emplace(fmt::format("{}.{}", dataverse, dataset), counter.
|
50
|
+
response.stats.try_emplace(fmt::format("{}.{}", dataverse, dataset), counter.as<std::int64_t>());
|
51
51
|
}
|
52
52
|
}
|
53
53
|
}
|
@@ -30,7 +30,7 @@ struct analytics_get_pending_mutations_response {
|
|
30
30
|
error_context::http ctx;
|
31
31
|
std::string status{};
|
32
32
|
std::vector<analytics_problem> errors{};
|
33
|
-
std::map<std::string, std::
|
33
|
+
std::map<std::string, std::int64_t> stats{};
|
34
34
|
};
|
35
35
|
|
36
36
|
struct analytics_get_pending_mutations_request {
|
@@ -39,13 +39,14 @@ query_index_drop_request::encode_to(encoded_request_type& encoded, http_context&
|
|
39
39
|
}
|
40
40
|
|
41
41
|
std::string drop_index_stmt;
|
42
|
-
if (
|
42
|
+
if (is_primary && index_name.empty()) {
|
43
|
+
drop_index_stmt = fmt::format(R"(DROP PRIMARY INDEX ON {} USING GSI)", keyspace);
|
44
|
+
} else if (!scope_name.empty() || !collection_name.empty()) {
|
43
45
|
drop_index_stmt = fmt::format(R"(DROP INDEX `{}` ON {} USING GSI)", index_name, keyspace);
|
44
46
|
} else {
|
45
47
|
drop_index_stmt = fmt::format(R"(DROP INDEX {}.`{}` USING GSI)", keyspace, index_name);
|
46
48
|
}
|
47
|
-
tao::json::value body{ { "statement",
|
48
|
-
{ "client_context_id", encoded.client_context_id } };
|
49
|
+
tao::json::value body{ { "statement", drop_index_stmt }, { "client_context_id", encoded.client_context_id } };
|
49
50
|
encoded.method = "POST";
|
50
51
|
encoded.path = "/query/service";
|
51
52
|
encoded.body = utils::json::generate(body);
|
@@ -118,6 +118,16 @@ struct origin {
|
|
118
118
|
return credentials_.key_path;
|
119
119
|
}
|
120
120
|
|
121
|
+
[[nodiscard]] std::vector<std::string> get_hostnames() const
|
122
|
+
{
|
123
|
+
std::vector<std::string> res;
|
124
|
+
res.reserve(nodes_.size());
|
125
|
+
for (const auto& [hostname, _] : nodes_) {
|
126
|
+
res.emplace_back(hostname);
|
127
|
+
}
|
128
|
+
return res;
|
129
|
+
}
|
130
|
+
|
121
131
|
[[nodiscard]] std::vector<std::string> get_nodes() const
|
122
132
|
{
|
123
133
|
std::vector<std::string> res;
|
@@ -54,6 +54,7 @@ decrement_response_body::parse(protocol::status status,
|
|
54
54
|
}
|
55
55
|
return false;
|
56
56
|
}
|
57
|
+
|
57
58
|
void
|
58
59
|
decrement_request_body::id(const document_id& id)
|
59
60
|
{
|
@@ -63,6 +64,7 @@ decrement_request_body::id(const document_id& id)
|
|
63
64
|
key_.insert(0, encoded.get());
|
64
65
|
}
|
65
66
|
}
|
67
|
+
|
66
68
|
void
|
67
69
|
decrement_request_body::durability(protocol::durability_level level, std::optional<std::uint16_t> timeout)
|
68
70
|
{
|
@@ -83,14 +85,7 @@ decrement_request_body::durability(protocol::durability_level level, std::option
|
|
83
85
|
framing_extras_[extras_size + 1] = static_cast<std::uint8_t>(level);
|
84
86
|
}
|
85
87
|
}
|
86
|
-
|
87
|
-
decrement_request_body::preserve_expiry()
|
88
|
-
{
|
89
|
-
auto frame_id = static_cast<uint8_t>(protocol::request_frame_info_id::preserve_ttl);
|
90
|
-
auto extras_size = framing_extras_.size();
|
91
|
-
framing_extras_.resize(extras_size + 1);
|
92
|
-
framing_extras_[extras_size + 0] = static_cast<std::uint8_t>(static_cast<std::uint32_t>(frame_id) << 4U | 0U);
|
93
|
-
}
|
88
|
+
|
94
89
|
void
|
95
90
|
decrement_request_body::fill_extras()
|
96
91
|
{
|
@@ -87,15 +87,6 @@ increment_request_body::durability(protocol::durability_level level, std::option
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
|
90
|
-
void
|
91
|
-
increment_request_body::preserve_expiry()
|
92
|
-
{
|
93
|
-
auto frame_id = static_cast<uint8_t>(protocol::request_frame_info_id::preserve_ttl);
|
94
|
-
auto extras_size = framing_extras_.size();
|
95
|
-
framing_extras_.resize(extras_size + 1);
|
96
|
-
framing_extras_[extras_size + 0] = static_cast<std::uint8_t>(static_cast<std::uint32_t>(frame_id) << 4U | 0U);
|
97
|
-
}
|
98
|
-
|
99
90
|
void
|
100
91
|
increment_request_body::fill_extras()
|
101
92
|
{
|
@@ -39,7 +39,7 @@ noop_on_row(std::string&& /* row */)
|
|
39
39
|
}
|
40
40
|
|
41
41
|
#define STATE_MARKER_ROOT (reinterpret_cast<void*>(1))
|
42
|
-
#define STATE_MARKER_ROWSET (reinterpret_cast<void*>(
|
42
|
+
#define STATE_MARKER_ROWSET (reinterpret_cast<void*>(2))
|
43
43
|
|
44
44
|
struct streaming_lexer_impl {
|
45
45
|
streaming_lexer_impl(jsonsl_t lexer, jsonsl_jpr_t pointer)
|
@@ -310,7 +310,7 @@ row_pop_callback(jsonsl_t lexer, jsonsl_action_t /* action */, struct jsonsl_sta
|
|
310
310
|
}
|
311
311
|
|
312
312
|
static void
|
313
|
-
initial_action_pop_callback(jsonsl_t lexer, jsonsl_action_t
|
313
|
+
initial_action_pop_callback(jsonsl_t lexer, jsonsl_action_t action, struct jsonsl_state_st* state, const jsonsl_char_t* at)
|
314
314
|
{
|
315
315
|
auto* impl = static_cast<detail::streaming_lexer_impl*>(lexer->data);
|
316
316
|
|
@@ -321,6 +321,10 @@ initial_action_pop_callback(jsonsl_t lexer, jsonsl_action_t /* action */, struct
|
|
321
321
|
if (state->type == JSONSL_T_HKEY) {
|
322
322
|
impl->last_key_ = impl->buffer_.substr(state->pos_begin + 1, state->pos_cur - state->pos_begin - 1);
|
323
323
|
}
|
324
|
+
|
325
|
+
if (state->data == STATE_MARKER_ROOT) {
|
326
|
+
trailer_pop_callback(lexer, action, state, at);
|
327
|
+
}
|
324
328
|
}
|
325
329
|
|
326
330
|
static void
|