couchbase 3.4.3 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/couchbase/CMakeLists.txt +15 -1
- data/ext/couchbase/core/bucket.cxx +183 -152
- data/ext/couchbase/core/bucket.hxx +17 -4
- data/ext/couchbase/core/cluster.hxx +34 -13
- data/ext/couchbase/core/cluster_options.hxx +3 -0
- data/ext/couchbase/core/crud_component.cxx +51 -22
- data/ext/couchbase/core/error_context/key_value.cxx +2 -1
- data/ext/couchbase/core/error_context/key_value.hxx +10 -12
- data/ext/couchbase/core/impl/build_deferred_query_indexes.cxx +115 -50
- data/ext/couchbase/core/impl/cluster.cxx +6 -0
- data/ext/couchbase/core/impl/create_bucket.cxx +155 -0
- data/ext/couchbase/core/impl/create_query_index.cxx +172 -59
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +2 -1
- data/ext/couchbase/core/impl/drop_bucket.cxx +66 -0
- data/ext/couchbase/core/impl/drop_query_index.cxx +138 -59
- data/ext/couchbase/core/impl/flush_bucket.cxx +66 -0
- data/ext/couchbase/core/impl/get_all_buckets.cxx +163 -0
- data/ext/couchbase/core/impl/get_all_query_indexes.cxx +67 -37
- data/ext/couchbase/core/impl/get_bucket.cxx +153 -0
- data/ext/couchbase/core/impl/internal_manager_error_context.cxx +113 -0
- data/ext/couchbase/core/impl/internal_manager_error_context.hxx +60 -0
- data/ext/couchbase/core/impl/key_value_error_category.cxx +2 -4
- data/ext/couchbase/core/impl/key_value_error_context.cxx +98 -0
- data/ext/couchbase/core/impl/lookup_in.cxx +1 -0
- data/ext/couchbase/core/impl/lookup_in_all_replicas.cxx +176 -0
- data/ext/couchbase/core/impl/lookup_in_all_replicas.hxx +80 -0
- data/ext/couchbase/core/impl/lookup_in_any_replica.cxx +167 -0
- data/ext/couchbase/core/impl/lookup_in_any_replica.hxx +75 -0
- data/ext/couchbase/core/impl/lookup_in_replica.cxx +97 -0
- data/ext/couchbase/core/impl/lookup_in_replica.hxx +67 -0
- data/ext/couchbase/core/impl/manager_error_context.cxx +100 -0
- data/ext/couchbase/core/impl/query.cxx +1 -0
- data/ext/couchbase/core/impl/query_error_context.cxx +75 -0
- data/ext/couchbase/core/impl/update_bucket.cxx +130 -0
- data/ext/couchbase/core/impl/watch_query_indexes.cxx +53 -29
- data/ext/couchbase/core/io/dns_client.cxx +111 -40
- data/ext/couchbase/core/io/dns_config.cxx +5 -4
- data/ext/couchbase/core/io/http_session.hxx +24 -1
- data/ext/couchbase/core/io/mcbp_command.hxx +9 -2
- data/ext/couchbase/core/io/mcbp_session.cxx +80 -43
- data/ext/couchbase/core/io/mcbp_session.hxx +4 -3
- data/ext/couchbase/core/logger/custom_rotating_file_sink.cxx +1 -1
- data/ext/couchbase/core/logger/logger.cxx +80 -20
- data/ext/couchbase/core/logger/logger.hxx +31 -0
- data/ext/couchbase/core/meta/features.hxx +25 -0
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +192 -0
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +188 -0
- data/ext/couchbase/core/operations/document_query.cxx +11 -0
- data/ext/couchbase/core/operations/document_query.hxx +1 -0
- data/ext/couchbase/core/operations.hxx +2 -0
- data/ext/couchbase/core/origin.cxx +270 -0
- data/ext/couchbase/core/origin.hxx +2 -0
- data/ext/couchbase/core/protocol/client_response.hxx +1 -0
- data/ext/couchbase/core/protocol/cmd_hello.hxx +1 -0
- data/ext/couchbase/core/protocol/cmd_lookup_in_replica.cxx +107 -0
- data/ext/couchbase/core/protocol/cmd_lookup_in_replica.hxx +137 -0
- data/ext/couchbase/core/protocol/hello_feature.hxx +6 -0
- data/ext/couchbase/core/protocol/hello_feature_fmt.hxx +3 -0
- data/ext/couchbase/core/protocol/status.cxx +2 -2
- data/ext/couchbase/core/range_scan_options.cxx +3 -27
- data/ext/couchbase/core/range_scan_options.hxx +13 -17
- data/ext/couchbase/core/range_scan_orchestrator.cxx +388 -170
- data/ext/couchbase/core/range_scan_orchestrator.hxx +13 -2
- data/ext/couchbase/core/range_scan_orchestrator_options.hxx +5 -3
- data/ext/couchbase/core/scan_options.hxx +0 -19
- data/ext/couchbase/core/scan_result.cxx +19 -5
- data/ext/couchbase/core/scan_result.hxx +5 -2
- data/ext/couchbase/core/timeout_defaults.hxx +2 -3
- data/ext/couchbase/core/topology/capabilities.hxx +3 -0
- data/ext/couchbase/core/topology/capabilities_fmt.hxx +8 -0
- data/ext/couchbase/core/topology/collections_manifest_fmt.hxx +1 -1
- data/ext/couchbase/core/topology/configuration.hxx +15 -0
- data/ext/couchbase/core/topology/configuration_json.hxx +6 -1
- data/ext/couchbase/core/utils/connection_string.cxx +62 -47
- data/ext/couchbase/core/utils/connection_string.hxx +1 -0
- data/ext/couchbase/couchbase/analytics_error_context.hxx +1 -1
- data/ext/couchbase/couchbase/behavior_options.hxx +19 -2
- data/ext/couchbase/couchbase/bucket_manager.hxx +135 -0
- data/ext/couchbase/couchbase/build_query_index_options.hxx +0 -30
- data/ext/couchbase/couchbase/cluster.hxx +14 -0
- data/ext/couchbase/couchbase/collection.hxx +111 -0
- data/ext/couchbase/couchbase/collection_query_index_manager.hxx +7 -48
- data/ext/couchbase/couchbase/create_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/create_primary_query_index_options.hxx +0 -29
- data/ext/couchbase/couchbase/create_query_index_options.hxx +0 -33
- data/ext/couchbase/couchbase/drop_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/drop_primary_query_index_options.hxx +0 -30
- data/ext/couchbase/couchbase/drop_query_index_options.hxx +0 -31
- data/ext/couchbase/couchbase/error_codes.hxx +1 -2
- data/ext/couchbase/couchbase/error_context.hxx +10 -2
- data/ext/couchbase/couchbase/flush_bucket_options.hxx +41 -0
- data/ext/couchbase/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
- data/ext/couchbase/couchbase/get_all_buckets_options.hxx +44 -0
- data/ext/couchbase/couchbase/get_all_query_indexes_options.hxx +0 -30
- data/ext/couchbase/couchbase/get_and_lock_options.hxx +2 -2
- data/ext/couchbase/couchbase/get_and_touch_options.hxx +2 -2
- data/ext/couchbase/couchbase/get_bucket_options.hxx +43 -0
- data/ext/couchbase/couchbase/get_options.hxx +2 -2
- data/ext/couchbase/couchbase/insert_options.hxx +3 -3
- data/ext/couchbase/couchbase/key_value_error_context.hxx +7 -2
- data/ext/couchbase/couchbase/lookup_in_all_replicas_options.hxx +109 -0
- data/ext/couchbase/couchbase/lookup_in_any_replica_options.hxx +101 -0
- data/ext/couchbase/couchbase/lookup_in_options.hxx +2 -2
- data/ext/couchbase/couchbase/lookup_in_replica_result.hxx +74 -0
- data/ext/couchbase/couchbase/lookup_in_result.hxx +26 -0
- data/ext/couchbase/couchbase/management/bucket_settings.hxx +116 -0
- data/ext/couchbase/couchbase/manager_error_context.hxx +29 -53
- data/ext/couchbase/couchbase/mutate_in_options.hxx +2 -2
- data/ext/couchbase/couchbase/query_error_context.hxx +3 -1
- data/ext/couchbase/couchbase/query_index_manager.hxx +16 -83
- data/ext/couchbase/couchbase/query_options.hxx +18 -0
- data/ext/couchbase/couchbase/remove_options.hxx +2 -2
- data/ext/couchbase/couchbase/replace_options.hxx +3 -3
- data/ext/couchbase/couchbase/security_options.hxx +15 -0
- data/ext/couchbase/couchbase/subdocument_error_context.hxx +4 -2
- data/ext/couchbase/couchbase/touch_options.hxx +2 -2
- data/ext/couchbase/couchbase/unlock_options.hxx +2 -2
- data/ext/couchbase/couchbase/update_bucket_options.hxx +41 -0
- data/ext/couchbase/couchbase/upsert_options.hxx +3 -3
- data/ext/couchbase/couchbase/watch_query_indexes_options.hxx +0 -31
- data/ext/couchbase/test/CMakeLists.txt +1 -0
- data/ext/couchbase/test/test_integration_collections.cxx +6 -0
- data/ext/couchbase/test/test_integration_crud.cxx +5 -0
- data/ext/couchbase/test/test_integration_examples.cxx +137 -1
- data/ext/couchbase/test/test_integration_management.cxx +709 -266
- data/ext/couchbase/test/test_integration_query.cxx +19 -7
- data/ext/couchbase/test/test_integration_range_scan.cxx +351 -112
- data/ext/couchbase/test/test_integration_search.cxx +10 -1
- data/ext/couchbase/test/test_integration_subdoc.cxx +655 -0
- data/ext/couchbase/test/test_transaction_public_async_api.cxx +13 -12
- data/ext/couchbase/test/test_transaction_public_blocking_api.cxx +27 -21
- data/ext/couchbase/test/test_unit_connection_string.cxx +29 -0
- data/ext/couchbase/test/test_unit_query.cxx +75 -0
- data/ext/couchbase.cxx +583 -29
- data/ext/revisions.rb +3 -3
- data/lib/couchbase/cluster.rb +1 -1
- data/lib/couchbase/collection.rb +108 -0
- data/lib/couchbase/collection_options.rb +100 -0
- data/lib/couchbase/errors.rb +5 -0
- data/lib/couchbase/key_value_scan.rb +125 -0
- data/lib/couchbase/options.rb +151 -0
- data/lib/couchbase/scope.rb +1 -1
- data/lib/couchbase/utils/time.rb +14 -1
- data/lib/couchbase/version.rb +1 -1
- metadata +41 -7
- data/ext/couchbase/core/impl/collection_query_index_manager.cxx +0 -93
|
@@ -32,7 +32,7 @@ async_options()
|
|
|
32
32
|
return cfg;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
TEST_CASE("can async get", "[transactions]")
|
|
35
|
+
TEST_CASE("transactions public async API: can async get", "[transactions]")
|
|
36
36
|
{
|
|
37
37
|
test::utils::integration_test_guard integration;
|
|
38
38
|
|
|
@@ -62,7 +62,7 @@ TEST_CASE("can async get", "[transactions]")
|
|
|
62
62
|
f.get();
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
TEST_CASE("can get fail as expected", "[transactions]")
|
|
65
|
+
TEST_CASE("transactions public async API: can get fail as expected", "[transactions]")
|
|
66
66
|
{
|
|
67
67
|
test::utils::integration_test_guard integration;
|
|
68
68
|
|
|
@@ -85,7 +85,7 @@ TEST_CASE("can get fail as expected", "[transactions]")
|
|
|
85
85
|
async_options());
|
|
86
86
|
f.get();
|
|
87
87
|
}
|
|
88
|
-
TEST_CASE("can async remove", "[transactions]")
|
|
88
|
+
TEST_CASE("transactions public async API: can async remove", "[transactions]")
|
|
89
89
|
{
|
|
90
90
|
test::utils::integration_test_guard integration;
|
|
91
91
|
|
|
@@ -114,7 +114,7 @@ TEST_CASE("can async remove", "[transactions]")
|
|
|
114
114
|
f.get();
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
TEST_CASE("async remove with bad cas fails as expected", "[transactions]")
|
|
117
|
+
TEST_CASE("transactions public async API: async remove with bad cas fails as expected", "[transactions]")
|
|
118
118
|
{
|
|
119
119
|
test::utils::integration_test_guard integration;
|
|
120
120
|
|
|
@@ -144,7 +144,8 @@ TEST_CASE("async remove with bad cas fails as expected", "[transactions]")
|
|
|
144
144
|
async_options());
|
|
145
145
|
f.get();
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
|
|
148
|
+
TEST_CASE("transactions public async API: can async insert", "[transactions]")
|
|
148
149
|
{
|
|
149
150
|
test::utils::integration_test_guard integration;
|
|
150
151
|
|
|
@@ -168,7 +169,7 @@ TEST_CASE("can async insert", "[transactions]")
|
|
|
168
169
|
f.get();
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
TEST_CASE("async insert fails when doc already exists, but doesn't rollback", "[transactions]")
|
|
172
|
+
TEST_CASE("transactions public async API: async insert fails when doc already exists, but doesn't rollback", "[transactions]")
|
|
172
173
|
{
|
|
173
174
|
test::utils::integration_test_guard integration;
|
|
174
175
|
|
|
@@ -196,7 +197,7 @@ TEST_CASE("async insert fails when doc already exists, but doesn't rollback", "[
|
|
|
196
197
|
f.get();
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
TEST_CASE("can async replace", "[transactions]")
|
|
200
|
+
TEST_CASE("transactions public async API: can async replace", "[transactions]")
|
|
200
201
|
{
|
|
201
202
|
test::utils::integration_test_guard integration;
|
|
202
203
|
|
|
@@ -227,7 +228,7 @@ TEST_CASE("can async replace", "[transactions]")
|
|
|
227
228
|
async_options());
|
|
228
229
|
f.get();
|
|
229
230
|
}
|
|
230
|
-
TEST_CASE("async replace fails as expected with bad cas", "[transactions]")
|
|
231
|
+
TEST_CASE("transactions public async API: async replace fails as expected with bad cas", "[transactions]")
|
|
231
232
|
{
|
|
232
233
|
test::utils::integration_test_guard integration;
|
|
233
234
|
|
|
@@ -259,7 +260,7 @@ TEST_CASE("async replace fails as expected with bad cas", "[transactions]")
|
|
|
259
260
|
f.get();
|
|
260
261
|
}
|
|
261
262
|
|
|
262
|
-
TEST_CASE("uncaught exception will rollback", "[transactions]")
|
|
263
|
+
TEST_CASE("transactions public async API: uncaught exception will rollback", "[transactions]")
|
|
263
264
|
{
|
|
264
265
|
test::utils::integration_test_guard integration;
|
|
265
266
|
|
|
@@ -293,7 +294,7 @@ TEST_CASE("uncaught exception will rollback", "[transactions]")
|
|
|
293
294
|
f.get();
|
|
294
295
|
}
|
|
295
296
|
|
|
296
|
-
TEST_CASE("can set transaction options", "[transactions]")
|
|
297
|
+
TEST_CASE("transactions public async API: can set transaction options", "[transactions]")
|
|
297
298
|
{
|
|
298
299
|
test::utils::integration_test_guard integration;
|
|
299
300
|
|
|
@@ -334,7 +335,7 @@ TEST_CASE("can set transaction options", "[transactions]")
|
|
|
334
335
|
f.get();
|
|
335
336
|
}
|
|
336
337
|
|
|
337
|
-
TEST_CASE("can do mutating query", "[transactions]")
|
|
338
|
+
TEST_CASE("transactions public async API: can do mutating query", "[transactions]")
|
|
338
339
|
{
|
|
339
340
|
|
|
340
341
|
test::utils::integration_test_guard integration;
|
|
@@ -360,7 +361,7 @@ TEST_CASE("can do mutating query", "[transactions]")
|
|
|
360
361
|
f.get();
|
|
361
362
|
}
|
|
362
363
|
|
|
363
|
-
TEST_CASE("some query errors rollback", "[transactions]")
|
|
364
|
+
TEST_CASE("transactions public async API: some query errors rollback", "[transactions]")
|
|
364
365
|
{
|
|
365
366
|
test::utils::integration_test_guard integration;
|
|
366
367
|
|
|
@@ -94,7 +94,7 @@ upsert_scope_and_collection(std::shared_ptr<couchbase::core::cluster> cluster,
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
TEST_CASE("can get", "[transactions]")
|
|
97
|
+
TEST_CASE("transactions public blocking API: can get", "[transactions]")
|
|
98
98
|
{
|
|
99
99
|
test::utils::integration_test_guard integration;
|
|
100
100
|
|
|
@@ -118,7 +118,7 @@ TEST_CASE("can get", "[transactions]")
|
|
|
118
118
|
CHECK_FALSE(tx_err.ec());
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
TEST_CASE("get returns error if doc doesn't exist", "[transactions]")
|
|
121
|
+
TEST_CASE("transactions public blocking API: get returns error if doc doesn't exist", "[transactions]")
|
|
122
122
|
{
|
|
123
123
|
test::utils::integration_test_guard integration;
|
|
124
124
|
|
|
@@ -137,7 +137,7 @@ TEST_CASE("get returns error if doc doesn't exist", "[transactions]")
|
|
|
137
137
|
CHECK_FALSE(tx_err.ec());
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
TEST_CASE("can insert", "[transactions]")
|
|
140
|
+
TEST_CASE("transactions public blocking API: can insert", "[transactions]")
|
|
141
141
|
{
|
|
142
142
|
test::utils::integration_test_guard integration;
|
|
143
143
|
|
|
@@ -165,7 +165,7 @@ TEST_CASE("can insert", "[transactions]")
|
|
|
165
165
|
REQUIRE(final_doc.content_as<tao::json::value>() == content);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
TEST_CASE("insert has error as expected when doc already exists", "[transactions]")
|
|
168
|
+
TEST_CASE("transactions public blocking API: insert has error as expected when doc already exists", "[transactions]")
|
|
169
169
|
{
|
|
170
170
|
|
|
171
171
|
test::utils::integration_test_guard integration;
|
|
@@ -193,7 +193,7 @@ TEST_CASE("insert has error as expected when doc already exists", "[transactions
|
|
|
193
193
|
REQUIRE(final_doc.content_as<tao::json::value>() == content);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
TEST_CASE("can replace", "[transactions]")
|
|
196
|
+
TEST_CASE("transactions public blocking API: can replace", "[transactions]")
|
|
197
197
|
{
|
|
198
198
|
test::utils::integration_test_guard integration;
|
|
199
199
|
|
|
@@ -225,7 +225,7 @@ TEST_CASE("can replace", "[transactions]")
|
|
|
225
225
|
couchbase::core::utils::json::generate_binary(new_content));
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
TEST_CASE("replace fails as expected with bad cas", "[transactions]")
|
|
228
|
+
TEST_CASE("transactions public blocking API: replace fails as expected with bad cas", "[transactions]")
|
|
229
229
|
{
|
|
230
230
|
|
|
231
231
|
test::utils::integration_test_guard integration;
|
|
@@ -255,7 +255,7 @@ TEST_CASE("replace fails as expected with bad cas", "[transactions]")
|
|
|
255
255
|
REQUIRE(final_doc.content_as<tao::json::value>() == content);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
TEST_CASE("can remove", "[transactions]")
|
|
258
|
+
TEST_CASE("transactions public blocking API: can remove", "[transactions]")
|
|
259
259
|
{
|
|
260
260
|
test::utils::integration_test_guard integration;
|
|
261
261
|
|
|
@@ -280,7 +280,7 @@ TEST_CASE("can remove", "[transactions]")
|
|
|
280
280
|
REQUIRE(final_err.ec() == couchbase::errc::key_value::document_not_found);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
TEST_CASE("remove fails as expected with bad cas", "[transactions]")
|
|
283
|
+
TEST_CASE("transactions public blocking API: remove fails as expected with bad cas", "[transactions]")
|
|
284
284
|
{
|
|
285
285
|
|
|
286
286
|
test::utils::integration_test_guard integration;
|
|
@@ -307,7 +307,7 @@ TEST_CASE("remove fails as expected with bad cas", "[transactions]")
|
|
|
307
307
|
CHECK(tx_err.ec());
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
TEST_CASE("remove fails as expected with missing doc", "[transactions]")
|
|
310
|
+
TEST_CASE("transactions public blocking API: remove fails as expected with missing doc", "[transactions]")
|
|
311
311
|
{
|
|
312
312
|
test::utils::integration_test_guard integration;
|
|
313
313
|
|
|
@@ -331,7 +331,7 @@ TEST_CASE("remove fails as expected with missing doc", "[transactions]")
|
|
|
331
331
|
CHECK(tx_err.cause() == couchbase::errc::transaction_op::unknown);
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
TEST_CASE("uncaught exception in lambda will rollback without retry", "[transactions]")
|
|
334
|
+
TEST_CASE("transactions public blocking API: uncaught exception in lambda will rollback without retry", "[transactions]")
|
|
335
335
|
{
|
|
336
336
|
test::utils::integration_test_guard integration;
|
|
337
337
|
|
|
@@ -352,7 +352,7 @@ TEST_CASE("uncaught exception in lambda will rollback without retry", "[transact
|
|
|
352
352
|
CHECK(tx_err.cause() == couchbase::errc::transaction_op::unknown);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
TEST_CASE("can pass per-transaction configs", "[transactions]")
|
|
355
|
+
TEST_CASE("transactions public blocking API: can pass per-transaction configs", "[transactions]")
|
|
356
356
|
{
|
|
357
357
|
test::utils::integration_test_guard integration;
|
|
358
358
|
|
|
@@ -386,7 +386,7 @@ TEST_CASE("can pass per-transaction configs", "[transactions]")
|
|
|
386
386
|
CHECK(tx_err.ec());
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
TEST_CASE("can do simple query", "[transactions]")
|
|
389
|
+
TEST_CASE("transactions public blocking API: can do simple query", "[transactions]")
|
|
390
390
|
{
|
|
391
391
|
test::utils::integration_test_guard integration;
|
|
392
392
|
|
|
@@ -407,7 +407,7 @@ TEST_CASE("can do simple query", "[transactions]")
|
|
|
407
407
|
CHECK_FALSE(result.transaction_id.empty());
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
TEST_CASE("can do simple mutating query", "[transactions]")
|
|
410
|
+
TEST_CASE("transactions public blocking API: can do simple mutating query", "[transactions]")
|
|
411
411
|
{
|
|
412
412
|
test::utils::integration_test_guard integration;
|
|
413
413
|
|
|
@@ -430,7 +430,7 @@ TEST_CASE("can do simple mutating query", "[transactions]")
|
|
|
430
430
|
CHECK(final_doc.content_as<tao::json::value>().at("some_number") == 10);
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
TEST_CASE("some query errors don't force rollback", "[transactions]")
|
|
433
|
+
TEST_CASE("transactions public blocking API: some query errors don't force rollback", "[transactions]")
|
|
434
434
|
{
|
|
435
435
|
test::utils::integration_test_guard integration;
|
|
436
436
|
|
|
@@ -455,7 +455,7 @@ TEST_CASE("some query errors don't force rollback", "[transactions]")
|
|
|
455
455
|
CHECK(final_doc.content_as<tao::json::value>() == content);
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
TEST_CASE("some query errors do rollback", "[transactions]")
|
|
458
|
+
TEST_CASE("transactions public blocking API: some query errors do rollback", "[transactions]")
|
|
459
459
|
{
|
|
460
460
|
test::utils::integration_test_guard integration;
|
|
461
461
|
|
|
@@ -484,7 +484,7 @@ TEST_CASE("some query errors do rollback", "[transactions]")
|
|
|
484
484
|
CHECK(doc2.cas().empty());
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
-
TEST_CASE("some query errors are seen immediately", "[transactions]")
|
|
487
|
+
TEST_CASE("transactions public blocking API: some query errors are seen immediately", "[transactions]")
|
|
488
488
|
{
|
|
489
489
|
test::utils::integration_test_guard integration;
|
|
490
490
|
|
|
@@ -503,7 +503,7 @@ TEST_CASE("some query errors are seen immediately", "[transactions]")
|
|
|
503
503
|
CHECK(result.unstaging_complete);
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
-
TEST_CASE("can query from a scope", "[transactions]")
|
|
506
|
+
TEST_CASE("transactions public blocking API: can query from a scope", "[transactions]")
|
|
507
507
|
{
|
|
508
508
|
const std::string new_scope_name("newscope");
|
|
509
509
|
const std::string new_coll_name("newcoll");
|
|
@@ -529,9 +529,15 @@ TEST_CASE("can query from a scope", "[transactions]")
|
|
|
529
529
|
txn_opts());
|
|
530
530
|
CHECK_FALSE(tx_err.ec());
|
|
531
531
|
CHECK_FALSE(result.transaction_id.empty());
|
|
532
|
+
|
|
533
|
+
{
|
|
534
|
+
couchbase::core::operations::management::scope_drop_request req{ integration.ctx.bucket, new_scope_name };
|
|
535
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
|
536
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
|
537
|
+
}
|
|
532
538
|
}
|
|
533
539
|
|
|
534
|
-
TEST_CASE("can get doc from bucket not yet opened", "[transactions]")
|
|
540
|
+
TEST_CASE("transactions public blocking API: can get doc from bucket not yet opened", "[transactions]")
|
|
535
541
|
{
|
|
536
542
|
|
|
537
543
|
auto id = test::utils::uniq_id("txn");
|
|
@@ -559,7 +565,7 @@ TEST_CASE("can get doc from bucket not yet opened", "[transactions]")
|
|
|
559
565
|
});
|
|
560
566
|
}
|
|
561
567
|
|
|
562
|
-
TEST_CASE("can insert doc into bucket not yet opened", "[transactions]")
|
|
568
|
+
TEST_CASE("transactions public blocking API: can insert doc into bucket not yet opened", "[transactions]")
|
|
563
569
|
{
|
|
564
570
|
test::utils::integration_test_guard integration;
|
|
565
571
|
|
|
@@ -585,7 +591,7 @@ TEST_CASE("can insert doc into bucket not yet opened", "[transactions]")
|
|
|
585
591
|
});
|
|
586
592
|
}
|
|
587
593
|
|
|
588
|
-
TEST_CASE("can replace doc in bucket not yet opened", "[transactions]")
|
|
594
|
+
TEST_CASE("transactions public blocking API: can replace doc in bucket not yet opened", "[transactions]")
|
|
589
595
|
{
|
|
590
596
|
|
|
591
597
|
auto id = test::utils::uniq_id("txn");
|
|
@@ -620,7 +626,7 @@ TEST_CASE("can replace doc in bucket not yet opened", "[transactions]")
|
|
|
620
626
|
});
|
|
621
627
|
}
|
|
622
628
|
|
|
623
|
-
TEST_CASE("can remove doc in bucket not yet opened", "[transactions]")
|
|
629
|
+
TEST_CASE("transactions public blocking API: can remove doc in bucket not yet opened", "[transactions]")
|
|
624
630
|
{
|
|
625
631
|
|
|
626
632
|
auto id = test::utils::uniq_id("txn");
|
|
@@ -416,4 +416,33 @@ TEST_CASE("unit: connection string", "[unit]")
|
|
|
416
416
|
CHECK(couchbase::core::utils::parse_connection_string("couchbase://2001:db8:85a3:8d3:1319:8a2e:370:7348").error.value() ==
|
|
417
417
|
R"(failed to parse connection string (column: 18, trailer: "db8:85a3:8d3:1319:8a2e:370:7348"))");
|
|
418
418
|
}
|
|
419
|
+
|
|
420
|
+
SECTION("parsing warnings")
|
|
421
|
+
{
|
|
422
|
+
auto spec = couchbase::core::utils::parse_connection_string("couchbase://127.0.0.1?kv_timeout=42&foo=bar");
|
|
423
|
+
CHECK(spec.warnings == std::vector<std::string>{
|
|
424
|
+
R"(unknown parameter "foo" in connection string (value "bar"))",
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
spec = couchbase::core::utils::parse_connection_string("couchbase://127.0.0.1?enable_dns_srv=maybe&ip_protocol=yes");
|
|
428
|
+
CHECK(spec.warnings ==
|
|
429
|
+
std::vector<std::string>{
|
|
430
|
+
R"(unable to parse "enable_dns_srv" parameter in connection string (value "maybe" cannot be interpreted as a boolean))",
|
|
431
|
+
R"(unable to parse "ip_protocol" parameter in connection string (value "yes" is not a valid IP protocol preference))",
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
spec = couchbase::core::utils::parse_connection_string("couchbase://localhost:8091=http;127.0.0.1=mcd/default?enable_dns_srv=true");
|
|
435
|
+
CHECK(
|
|
436
|
+
spec.warnings ==
|
|
437
|
+
std::vector<std::string>{
|
|
438
|
+
R"(parameter "enable_dns_srv" requires single entry in bootstrap nodes list of the connection string, ignoring (value "true"))",
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
spec = couchbase::core::utils::parse_connection_string(
|
|
442
|
+
"couchbase://localhost?query_timeout=10000&kv_timeout=true&management_timeout=11000");
|
|
443
|
+
std::string warning_prefix = R"(unable to parse "kv_timeout" parameter in connection string (value "true" is not a number))";
|
|
444
|
+
CHECK(spec.warnings.at(0).substr(0, warning_prefix.size()) == warning_prefix);
|
|
445
|
+
CHECK(spec.options.query_timeout == std::chrono::milliseconds(10000));
|
|
446
|
+
CHECK(spec.options.management_timeout == std::chrono::milliseconds(11000));
|
|
447
|
+
}
|
|
419
448
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Couchbase, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#include "test_helper_integration.hxx"
|
|
19
|
+
|
|
20
|
+
#include "utils/move_only_context.hxx"
|
|
21
|
+
|
|
22
|
+
#include "core/operations/document_query.hxx"
|
|
23
|
+
|
|
24
|
+
couchbase::core::http_context
|
|
25
|
+
make_http_context(couchbase::core::topology::configuration& config)
|
|
26
|
+
{
|
|
27
|
+
static couchbase::core::query_cache query_cache{};
|
|
28
|
+
static couchbase::core::cluster_options cluster_options{};
|
|
29
|
+
std::string hostname{};
|
|
30
|
+
std::uint16_t port{};
|
|
31
|
+
couchbase::core::http_context ctx{ config, cluster_options, query_cache, hostname, port };
|
|
32
|
+
return ctx;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
TEST_CASE("unit: query with read from replica", "[unit]")
|
|
36
|
+
{
|
|
37
|
+
couchbase::core::topology::configuration config{};
|
|
38
|
+
config.cluster_capabilities.insert(couchbase::core::cluster_capability::n1ql_read_from_replica);
|
|
39
|
+
auto ctx = make_http_context(config);
|
|
40
|
+
|
|
41
|
+
SECTION("use_replica true")
|
|
42
|
+
{
|
|
43
|
+
couchbase::core::io::http_request http_req;
|
|
44
|
+
couchbase::core::operations::query_request req{};
|
|
45
|
+
req.use_replica = true;
|
|
46
|
+
auto ec = req.encode_to(http_req, ctx);
|
|
47
|
+
REQUIRE_SUCCESS(ec);
|
|
48
|
+
auto body = couchbase::core::utils::json::parse(http_req.body);
|
|
49
|
+
REQUIRE(body.is_object());
|
|
50
|
+
REQUIRE(body.get_object().at("use_replica").get_string() == "on");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SECTION("use_replica false")
|
|
54
|
+
{
|
|
55
|
+
couchbase::core::io::http_request http_req;
|
|
56
|
+
couchbase::core::operations::query_request req{};
|
|
57
|
+
req.use_replica = false;
|
|
58
|
+
auto ec = req.encode_to(http_req, ctx);
|
|
59
|
+
REQUIRE_SUCCESS(ec);
|
|
60
|
+
auto body = couchbase::core::utils::json::parse(http_req.body);
|
|
61
|
+
REQUIRE(body.is_object());
|
|
62
|
+
REQUIRE(body.get_object().at("use_replica").get_string() == "off");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
SECTION("use_replica not set")
|
|
66
|
+
{
|
|
67
|
+
couchbase::core::io::http_request http_req;
|
|
68
|
+
couchbase::core::operations::query_request req{};
|
|
69
|
+
auto ec = req.encode_to(http_req, ctx);
|
|
70
|
+
REQUIRE_SUCCESS(ec);
|
|
71
|
+
auto body = couchbase::core::utils::json::parse(http_req.body);
|
|
72
|
+
REQUIRE(body.is_object());
|
|
73
|
+
REQUIRE_FALSE(body.get_object().count("use_replica"));
|
|
74
|
+
}
|
|
75
|
+
}
|