couchbase 4.2.1 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CMakeLists.txt +1 -0
- package/deps/couchbase-cxx-client/.gitmodules +3 -0
- package/deps/couchbase-cxx-client/.idea/misc.xml +1 -0
- package/deps/couchbase-cxx-client/.idea/vcs.xml +1 -0
- package/deps/couchbase-cxx-client/CMakeLists.txt +11 -1
- package/deps/couchbase-cxx-client/README.md +3 -3
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +4 -1
- package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +13 -1
- package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
- package/deps/couchbase-cxx-client/core/cluster.hxx +15 -5
- package/deps/couchbase-cxx-client/core/impl/build_deferred_query_indexes.cxx +17 -6
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/collection_query_index_manager.cxx +93 -0
- package/deps/couchbase-cxx-client/core/impl/configuration_profiles_registry.cxx +11 -0
- package/deps/couchbase-cxx-client/core/impl/create_query_index.cxx +119 -0
- package/deps/couchbase-cxx-client/core/impl/drop_query_index.cxx +108 -0
- package/deps/couchbase-cxx-client/core/impl/get.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/get_all_query_indexes.cxx +76 -0
- package/deps/couchbase-cxx-client/core/impl/query.cxx +5 -7
- package/deps/couchbase-cxx-client/core/impl/watch_query_indexes.cxx +168 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +15 -1
- package/deps/couchbase-cxx-client/core/logger/configuration.hxx +3 -0
- package/deps/couchbase-cxx-client/core/logger/level.hxx +21 -0
- package/deps/couchbase-cxx-client/core/logger/logger.hxx +4 -6
- package/deps/couchbase-cxx-client/core/meta/CMakeLists.txt +4 -2
- package/deps/couchbase-cxx-client/core/meta/features.hxx +31 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +67 -5
- package/deps/couchbase-cxx-client/core/meta/version.hxx +12 -1
- package/deps/couchbase-cxx-client/core/metrics/CMakeLists.txt +4 -1
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.cxx +46 -5
- package/deps/couchbase-cxx-client/core/metrics/logging_meter.hxx +10 -26
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +10 -12
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -3
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.cxx +8 -14
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +15 -8
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +7 -14
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.cxx +11 -16
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.cxx +8 -12
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +4 -3
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.cxx +21 -12
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -2
- package/deps/couchbase-cxx-client/core/origin.hxx +1 -1
- package/deps/couchbase-cxx-client/core/platform/uuid.cc +1 -2
- package/deps/couchbase-cxx-client/core/protocol/cmd_hello.hxx +5 -1
- package/deps/couchbase-cxx-client/core/query_context.hxx +79 -0
- package/deps/couchbase-cxx-client/core/tracing/CMakeLists.txt +3 -1
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.cxx +19 -4
- package/deps/couchbase-cxx-client/core/tracing/threshold_logging_tracer.hxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +10 -4
- package/deps/couchbase-cxx-client/core/transactions/atr_cleanup_entry.cxx +52 -63
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +8 -3
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +163 -126
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +24 -37
- package/deps/couchbase-cxx-client/core/transactions/forward_compat.hxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/internal/atr_cleanup_entry.hxx +51 -13
- package/deps/couchbase-cxx-client/core/transactions/internal/client_record.hxx +26 -1
- package/deps/couchbase-cxx-client/core/transactions/internal/doc_record.hxx +21 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/logging.hxx +40 -18
- package/deps/couchbase-cxx-client/core/transactions/internal/transaction_context.hxx +5 -0
- package/deps/couchbase-cxx-client/core/transactions/result.hxx +26 -0
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +48 -47
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.hxx +6 -6
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +33 -19
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +18 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_links.hxx +25 -2
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +4 -4
- package/deps/couchbase-cxx-client/core/transactions/transactions_cleanup.cxx +49 -56
- package/deps/couchbase-cxx-client/core/transactions/waitable_op_list.hxx +7 -7
- package/deps/couchbase-cxx-client/core/transactions.hxx +0 -12
- package/deps/couchbase-cxx-client/core/utils/binary.hxx +1 -1
- package/deps/couchbase-cxx-client/core/utils/keyspace.hxx +55 -0
- package/deps/couchbase-cxx-client/couchbase/build_query_index_options.hxx +12 -45
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/cluster_options.hxx +6 -7
- package/deps/couchbase-cxx-client/couchbase/collection.hxx +8 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +218 -0
- package/deps/couchbase-cxx-client/couchbase/configuration_profiles_registry.hxx +3 -0
- package/deps/couchbase-cxx-client/couchbase/create_primary_query_index_options.hxx +166 -0
- package/deps/couchbase-cxx-client/couchbase/create_query_index_options.hxx +172 -0
- package/deps/couchbase-cxx-client/couchbase/drop_primary_query_index_options.hxx +129 -0
- package/deps/couchbase-cxx-client/couchbase/drop_query_index_options.hxx +116 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/cas.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/fmt/query_scan_consistency.hxx +46 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/query_status.hxx +70 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/tls_verify_mode.hxx +46 -0
- package/deps/couchbase-cxx-client/couchbase/get_all_query_indexes_options.hxx +100 -0
- package/deps/couchbase-cxx-client/{core → couchbase}/management/query_index.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/metrics/meter.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +178 -6
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +1 -18
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +5 -2
- package/deps/couchbase-cxx-client/couchbase/tracing/request_tracer.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/async_attempt_context.hxx +11 -4
- package/deps/couchbase-cxx-client/couchbase/transactions/attempt_context.hxx +5 -3
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_keyspace.hxx +16 -0
- package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +0 -6
- package/deps/couchbase-cxx-client/couchbase/watch_query_indexes_options.hxx +115 -0
- package/deps/couchbase-cxx-client/examples/minimal.cxx +3 -1
- package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +72 -0
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +727 -310
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +4 -8
- package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +14 -0
- package/deps/couchbase-cxx-client/test/test_transaction_transaction_public_blocking_api.cxx +34 -19
- package/deps/couchbase-cxx-client/test/test_unit_transaction_logging.cxx +66 -22
- package/deps/couchbase-cxx-client/test/test_unit_utils.cxx +51 -0
- package/deps/couchbase-cxx-client/test/tools/tool_kv_loader.cxx +2 -2
- package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -0
- package/deps/couchbase-cxx-client/test/utils/wait_until.cxx +4 -4
- package/deps/couchbase-cxx-client/third_party/docopt/.travis.yml +103 -0
- package/deps/couchbase-cxx-client/third_party/docopt/CMakeLists.txt +129 -0
- package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-Boost-1.0 +23 -0
- package/deps/couchbase-cxx-client/third_party/docopt/LICENSE-MIT +23 -0
- package/deps/couchbase-cxx-client/third_party/docopt/README.rst +479 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt-config.cmake +1 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt.cpp +687 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt.h +98 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt.pc.in +9 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt_private.h +676 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt_util.h +122 -0
- package/deps/couchbase-cxx-client/third_party/docopt/docopt_value.h +341 -0
- package/deps/couchbase-cxx-client/third_party/docopt/examples/naval_fate.cpp +36 -0
- package/deps/couchbase-cxx-client/third_party/docopt/main.cpp +16 -0
- package/deps/couchbase-cxx-client/third_party/docopt/run_testcase.cpp +40 -0
- package/deps/couchbase-cxx-client/third_party/docopt/run_tests.py +72 -0
- package/deps/couchbase-cxx-client/third_party/docopt/testcases.docopt +957 -0
- package/deps/couchbase-cxx-client/tools/CMakeLists.txt +14 -0
- package/deps/couchbase-cxx-client/tools/cbc.cxx +65 -0
- package/deps/couchbase-cxx-client/tools/command.hxx +31 -0
- package/deps/couchbase-cxx-client/tools/command_registry.cxx +43 -0
- package/deps/couchbase-cxx-client/tools/command_registry.hxx +39 -0
- package/deps/couchbase-cxx-client/tools/get.cxx +267 -0
- package/deps/couchbase-cxx-client/tools/get.hxx +26 -0
- package/deps/couchbase-cxx-client/tools/query.cxx +441 -0
- package/deps/couchbase-cxx-client/tools/query.hxx +26 -0
- package/deps/couchbase-cxx-client/tools/utils.cxx +418 -0
- package/deps/couchbase-cxx-client/tools/utils.hxx +150 -0
- package/deps/couchbase-cxx-client/tools/version.cxx +82 -0
- package/deps/couchbase-cxx-client/tools/version.hxx +26 -0
- package/dist/authenticators.d.ts +2 -2
- package/dist/authenticators.js +1 -2
- package/dist/binding.d.ts +32 -16
- package/dist/cluster.js +14 -7
- package/dist/collection.d.ts +6 -0
- package/dist/collection.js +8 -0
- package/dist/queryexecutor.js +1 -1
- package/dist/queryindexmanager.d.ts +100 -4
- package/dist/queryindexmanager.js +344 -118
- package/dist/transactions.js +0 -2
- package/package.json +1 -1
- package/src/connection.cpp +2 -0
- package/src/connection.hpp +1 -0
- package/src/connection_autogen.cpp +16 -0
- package/src/jstocbpp_autogen.hpp +93 -23
- package/src/jstocbpp_basic.hpp +24 -0
- package/src/jstocbpp_transactions.hpp +0 -8
- package/tools/gen-bindings-js.js +1 -0
- package/tools/gen-bindings-json.py +4 -2
- package/deps/couchbase-cxx-client/core/transactions/logging.cxx +0 -107
@@ -27,6 +27,10 @@
|
|
27
27
|
#include "core/operations/management/search.hxx"
|
28
28
|
#include "core/operations/management/user.hxx"
|
29
29
|
#include "couchbase/cluster.hxx"
|
30
|
+
#include "couchbase/create_primary_query_index_options.hxx"
|
31
|
+
#include "couchbase/create_query_index_options.hxx"
|
32
|
+
#include "couchbase/drop_query_index_options.hxx"
|
33
|
+
#include "couchbase/watch_query_indexes_options.hxx"
|
30
34
|
|
31
35
|
static couchbase::core::operations::management::bucket_get_response
|
32
36
|
wait_for_bucket_created(test::utils::integration_test_guard& integration, const std::string& bucket_name)
|
@@ -1029,12 +1033,6 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1029
1033
|
{
|
1030
1034
|
test::utils::integration_test_guard integration;
|
1031
1035
|
|
1032
|
-
if (!integration.cluster_version().supports_collections()) {
|
1033
|
-
return;
|
1034
|
-
}
|
1035
|
-
|
1036
|
-
auto index_name = test::utils::uniq_id("index");
|
1037
|
-
|
1038
1036
|
if (integration.cluster_version().supports_bucket_management()) {
|
1039
1037
|
SECTION("primary index")
|
1040
1038
|
{
|
@@ -1049,13 +1047,82 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1049
1047
|
}
|
1050
1048
|
|
1051
1049
|
REQUIRE(!wait_for_bucket_created(integration, bucket_name).ctx.ec);
|
1050
|
+
SECTION("core API")
|
1051
|
+
{
|
1052
|
+
|
1053
|
+
{
|
1054
|
+
couchbase::core::operations::management::query_index_create_response resp;
|
1055
|
+
bool operation_completed = test::utils::wait_until([&integration, &bucket_name, &resp]() {
|
1056
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1057
|
+
req.bucket_name = bucket_name;
|
1058
|
+
req.is_primary = true;
|
1059
|
+
resp = test::utils::execute(integration.cluster, req);
|
1060
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1061
|
+
});
|
1062
|
+
REQUIRE(operation_completed);
|
1063
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
{
|
1067
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1068
|
+
req.bucket_name = bucket_name;
|
1069
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1070
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1071
|
+
REQUIRE(resp.indexes.size() == 1);
|
1072
|
+
REQUIRE(resp.indexes[0].name == "#primary");
|
1073
|
+
REQUIRE(resp.indexes[0].is_primary);
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
{
|
1077
|
+
couchbase::core::operations::management::bucket_drop_request req{ bucket_name };
|
1078
|
+
test::utils::execute(integration.cluster, req);
|
1079
|
+
}
|
1080
|
+
}
|
1081
|
+
SECTION("public api")
|
1082
|
+
{
|
1083
|
+
couchbase::cluster c(integration.cluster);
|
1084
|
+
{
|
1085
|
+
std::error_code ec;
|
1086
|
+
bool operation_completed = test::utils::wait_until([&bucket_name, &ec, &c]() {
|
1087
|
+
auto ctx = c.query_indexes().create_primary_index(bucket_name, {}).get();
|
1088
|
+
ec = ctx.ec();
|
1089
|
+
return ec != couchbase::errc::common::bucket_not_found;
|
1090
|
+
});
|
1091
|
+
REQUIRE(operation_completed);
|
1092
|
+
REQUIRE_SUCCESS(ec);
|
1093
|
+
}
|
1094
|
+
{
|
1095
|
+
auto [ctx, indexes] = c.query_indexes().get_all_indexes(bucket_name, {}).get();
|
1096
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1097
|
+
REQUIRE(indexes.size() == 1);
|
1098
|
+
REQUIRE(indexes[0].name == "#primary");
|
1099
|
+
REQUIRE(indexes[0].is_primary);
|
1100
|
+
}
|
1101
|
+
{
|
1102
|
+
auto ctx =
|
1103
|
+
c.query_indexes().watch_indexes(bucket_name, {}, couchbase::watch_query_indexes_options().watch_primary(true)).get();
|
1104
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1105
|
+
}
|
1106
|
+
{
|
1107
|
+
auto ctx = c.query_indexes().drop_primary_index(bucket_name, {}).get();
|
1108
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
}
|
1052
1113
|
|
1114
|
+
SECTION("non primary index")
|
1115
|
+
{
|
1116
|
+
SECTION("core API")
|
1117
|
+
{
|
1118
|
+
auto index_name = test::utils::uniq_id("index");
|
1053
1119
|
{
|
1054
1120
|
couchbase::core::operations::management::query_index_create_response resp;
|
1055
|
-
bool operation_completed = test::utils::wait_until([&integration, &
|
1121
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {
|
1056
1122
|
couchbase::core::operations::management::query_index_create_request req{};
|
1057
|
-
req.bucket_name =
|
1058
|
-
req.
|
1123
|
+
req.bucket_name = integration.ctx.bucket;
|
1124
|
+
req.index_name = index_name;
|
1125
|
+
req.fields = { "field", "field2 DESC", "`two words` DESC" };
|
1059
1126
|
resp = test::utils::execute(integration.cluster, req);
|
1060
1127
|
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1061
1128
|
});
|
@@ -1064,174 +1131,308 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1064
1131
|
}
|
1065
1132
|
|
1066
1133
|
{
|
1067
|
-
couchbase::core::operations::management::
|
1068
|
-
req.bucket_name =
|
1134
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1135
|
+
req.bucket_name = integration.ctx.bucket;
|
1136
|
+
req.index_name = index_name;
|
1137
|
+
req.fields = { "field" };
|
1138
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1139
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::index_exists);
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
{
|
1143
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1144
|
+
req.bucket_name = integration.ctx.bucket;
|
1145
|
+
req.index_name = index_name;
|
1146
|
+
req.fields = { "field" };
|
1147
|
+
req.ignore_if_exists = true;
|
1069
1148
|
auto resp = test::utils::execute(integration.cluster, req);
|
1070
1149
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
1071
|
-
REQUIRE(resp.indexes.size() == 1);
|
1072
|
-
REQUIRE(resp.indexes[0].name == "#primary");
|
1073
|
-
REQUIRE(resp.indexes[0].is_primary);
|
1074
1150
|
}
|
1075
1151
|
|
1076
1152
|
{
|
1077
|
-
couchbase::core::operations::management::
|
1078
|
-
|
1153
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1154
|
+
req.bucket_name = integration.ctx.bucket;
|
1155
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1156
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1157
|
+
auto index = std::find_if(
|
1158
|
+
resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1159
|
+
REQUIRE(index != resp.indexes.end());
|
1160
|
+
REQUIRE(index->name == index_name);
|
1161
|
+
REQUIRE_FALSE(index->is_primary);
|
1162
|
+
REQUIRE(index->index_key.size() == 3);
|
1163
|
+
REQUIRE(index->index_key[0] == "`field`");
|
1164
|
+
REQUIRE(index->index_key[1] == "`field2` DESC");
|
1165
|
+
REQUIRE(index->index_key[2] == "`two words` DESC");
|
1166
|
+
REQUIRE(index->bucket_name == integration.ctx.bucket);
|
1167
|
+
REQUIRE(index->state == "online");
|
1168
|
+
}
|
1169
|
+
{
|
1170
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1171
|
+
req.bucket_name = integration.ctx.bucket;
|
1172
|
+
req.index_name = index_name;
|
1173
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1174
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1079
1175
|
}
|
1080
|
-
}
|
1081
|
-
}
|
1082
1176
|
|
1083
|
-
|
1084
|
-
|
1085
|
-
{
|
1086
|
-
couchbase::core::operations::management::query_index_create_response resp;
|
1087
|
-
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {
|
1088
|
-
couchbase::core::operations::management::query_index_create_request req{};
|
1177
|
+
{
|
1178
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1089
1179
|
req.bucket_name = integration.ctx.bucket;
|
1090
1180
|
req.index_name = index_name;
|
1091
|
-
|
1092
|
-
resp
|
1093
|
-
|
1094
|
-
});
|
1095
|
-
REQUIRE(operation_completed);
|
1096
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1181
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1182
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::index_not_found);
|
1183
|
+
}
|
1097
1184
|
}
|
1098
|
-
|
1185
|
+
SECTION("public API")
|
1099
1186
|
{
|
1100
|
-
couchbase::
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1187
|
+
couchbase::cluster c(integration.cluster);
|
1188
|
+
auto index_name = test::utils::uniq_id("index");
|
1189
|
+
{
|
1190
|
+
std::error_code ec;
|
1191
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, c, &ec]() {
|
1192
|
+
auto ctx = c.query_indexes()
|
1193
|
+
.create_index(integration.ctx.bucket, index_name, { "field", "field2 DESC", "`two words` DESC" }, {})
|
1194
|
+
.get();
|
1195
|
+
ec = ctx.ec();
|
1196
|
+
return ec != couchbase::errc::common::bucket_not_found;
|
1197
|
+
});
|
1198
|
+
REQUIRE(operation_completed);
|
1199
|
+
REQUIRE_SUCCESS(ec);
|
1200
|
+
}
|
1201
|
+
{
|
1202
|
+
auto ctx = c.query_indexes().watch_indexes(integration.ctx.bucket, { index_name }, {}).get();
|
1203
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
{
|
1207
|
+
auto ctx = c.query_indexes().create_index(integration.ctx.bucket, index_name, { "field" }, {}).get();
|
1208
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::index_exists);
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
{
|
1212
|
+
auto ctx =
|
1213
|
+
c.query_indexes()
|
1214
|
+
.create_index(
|
1215
|
+
integration.ctx.bucket, index_name, { "field" }, couchbase::create_query_index_options().ignore_if_exists(true))
|
1216
|
+
.get();
|
1217
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
{
|
1221
|
+
auto [ctx, indexes] = c.query_indexes().get_all_indexes(integration.ctx.bucket, {}).get();
|
1222
|
+
auto index = std::find_if(
|
1223
|
+
indexes.begin(), indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1224
|
+
REQUIRE(index != indexes.end());
|
1225
|
+
REQUIRE(index->name == index_name);
|
1226
|
+
REQUIRE_FALSE(index->is_primary);
|
1227
|
+
REQUIRE(index->index_key.size() == 3);
|
1228
|
+
REQUIRE(index->index_key[0] == "`field`");
|
1229
|
+
REQUIRE(index->index_key[1] == "`field2` DESC");
|
1230
|
+
REQUIRE(index->index_key[2] == "`two words` DESC");
|
1231
|
+
REQUIRE(index->bucket_name == integration.ctx.bucket);
|
1232
|
+
REQUIRE(index->state == "online");
|
1233
|
+
}
|
1234
|
+
{
|
1235
|
+
auto ctx = c.query_indexes().drop_index(integration.ctx.bucket, index_name, {}).get();
|
1236
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1237
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
{
|
1241
|
+
auto ctx = c.query_indexes().drop_index(integration.ctx.bucket, index_name, {}).get();
|
1242
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1243
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::index_not_found);
|
1244
|
+
}
|
1245
|
+
{
|
1246
|
+
auto ctx =
|
1247
|
+
c.query_indexes()
|
1248
|
+
.drop_index(integration.ctx.bucket, index_name, couchbase::drop_query_index_options().ignore_if_not_exists(true))
|
1249
|
+
.get();
|
1250
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1251
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1252
|
+
}
|
1106
1253
|
}
|
1254
|
+
}
|
1107
1255
|
|
1256
|
+
SECTION("deferred index")
|
1257
|
+
{
|
1258
|
+
SECTION("public API")
|
1108
1259
|
{
|
1109
|
-
couchbase::
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1260
|
+
couchbase::cluster c(integration.cluster);
|
1261
|
+
auto index_name = test::utils::uniq_id("index");
|
1262
|
+
{
|
1263
|
+
std::error_code ec;
|
1264
|
+
bool operation_completed = test::utils::wait_until([c, &ec, &index_name, &integration]() {
|
1265
|
+
auto ctx =
|
1266
|
+
c.query_indexes()
|
1267
|
+
.create_index(
|
1268
|
+
integration.ctx.bucket, index_name, { "field" }, couchbase::create_query_index_options().build_deferred(true))
|
1269
|
+
.get();
|
1270
|
+
ec = ctx.ec();
|
1271
|
+
return ec != couchbase::errc::common::bucket_not_found;
|
1272
|
+
});
|
1273
|
+
REQUIRE(operation_completed);
|
1274
|
+
REQUIRE_SUCCESS(ec);
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
{
|
1278
|
+
auto [ctx, indexes] = c.query_indexes().get_all_indexes(integration.ctx.bucket, {}).get();
|
1279
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1280
|
+
auto index = std::find_if(
|
1281
|
+
indexes.begin(), indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1282
|
+
REQUIRE(index != indexes.end());
|
1283
|
+
REQUIRE(index->name == index_name);
|
1284
|
+
REQUIRE(index->state == "deferred");
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
{
|
1288
|
+
auto manager = couchbase::cluster(integration.cluster).query_indexes();
|
1289
|
+
auto ctx = manager.build_deferred_indexes(integration.ctx.bucket, {}).get();
|
1290
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1291
|
+
}
|
1292
|
+
{
|
1293
|
+
// now wait till it is online before proceeding
|
1294
|
+
auto operation_completed = test::utils::wait_until([&integration, &index_name, c]() {
|
1295
|
+
auto [ctx, indexes] = c.query_indexes().get_all_indexes(integration.ctx.bucket, {}).get();
|
1296
|
+
if (indexes.empty()) {
|
1297
|
+
return false;
|
1298
|
+
}
|
1299
|
+
auto index = std::find_if(
|
1300
|
+
indexes.begin(), indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1301
|
+
return index->state == "online";
|
1302
|
+
});
|
1303
|
+
REQUIRE(operation_completed);
|
1304
|
+
}
|
1116
1305
|
}
|
1117
1306
|
|
1307
|
+
SECTION("core API")
|
1118
1308
|
{
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1309
|
+
auto index_name = test::utils::uniq_id("index");
|
1310
|
+
{
|
1311
|
+
couchbase::core::operations::management::query_index_create_response resp;
|
1312
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {
|
1313
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1314
|
+
req.bucket_name = integration.ctx.bucket;
|
1315
|
+
req.index_name = index_name;
|
1316
|
+
req.fields = { "field" };
|
1317
|
+
req.deferred = true;
|
1318
|
+
resp = test::utils::execute(integration.cluster, req);
|
1319
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1320
|
+
});
|
1321
|
+
REQUIRE(operation_completed);
|
1322
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1323
|
+
}
|
1324
|
+
{
|
1325
|
+
couchbase::core::operations::management::query_index_build_deferred_request req{};
|
1326
|
+
req.bucket_name = integration.ctx.bucket;
|
1327
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1328
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
{
|
1332
|
+
test::utils::wait_until([&integration, &index_name]() {
|
1333
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1334
|
+
req.bucket_name = integration.ctx.bucket;
|
1335
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1336
|
+
if (resp.indexes.empty()) {
|
1337
|
+
return false;
|
1338
|
+
}
|
1339
|
+
auto index = std::find_if(resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) {
|
1340
|
+
return exp_index.name == index_name;
|
1341
|
+
});
|
1342
|
+
return index->state == "online";
|
1343
|
+
});
|
1344
|
+
}
|
1134
1345
|
}
|
1346
|
+
}
|
1135
1347
|
|
1348
|
+
SECTION("create missing bucket")
|
1349
|
+
{
|
1350
|
+
SECTION("core API")
|
1136
1351
|
{
|
1137
|
-
couchbase::core::operations::management::
|
1138
|
-
req.bucket_name =
|
1139
|
-
req.
|
1352
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1353
|
+
req.bucket_name = "missing_bucket";
|
1354
|
+
req.is_primary = true;
|
1140
1355
|
auto resp = test::utils::execute(integration.cluster, req);
|
1141
|
-
|
1356
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
1142
1357
|
}
|
1143
|
-
|
1358
|
+
SECTION("public API")
|
1144
1359
|
{
|
1145
|
-
couchbase::
|
1146
|
-
|
1147
|
-
|
1148
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1149
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::index_not_found);
|
1360
|
+
couchbase::cluster c(integration.cluster);
|
1361
|
+
auto ctx = c.query_indexes().create_primary_index("missing_bucket", {}).get();
|
1362
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::bucket_not_found);
|
1150
1363
|
}
|
1151
1364
|
}
|
1152
1365
|
|
1153
|
-
SECTION("
|
1366
|
+
SECTION("get missing bucket")
|
1154
1367
|
{
|
1155
|
-
|
1156
|
-
couchbase::core::operations::management::query_index_create_response resp;
|
1157
|
-
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {
|
1158
|
-
couchbase::core::operations::management::query_index_create_request req{};
|
1159
|
-
req.bucket_name = integration.ctx.bucket;
|
1160
|
-
req.index_name = index_name;
|
1161
|
-
req.fields = { "field" };
|
1162
|
-
req.deferred = true;
|
1163
|
-
resp = test::utils::execute(integration.cluster, req);
|
1164
|
-
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1165
|
-
});
|
1166
|
-
REQUIRE(operation_completed);
|
1167
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1168
|
-
}
|
1169
|
-
|
1368
|
+
SECTION("core API")
|
1170
1369
|
{
|
1171
1370
|
couchbase::core::operations::management::query_index_get_all_request req{};
|
1172
|
-
req.bucket_name =
|
1371
|
+
req.bucket_name = "missing_bucket";
|
1173
1372
|
auto resp = test::utils::execute(integration.cluster, req);
|
1174
1373
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
1175
|
-
|
1176
|
-
resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1177
|
-
REQUIRE(index != resp.indexes.end());
|
1178
|
-
REQUIRE(index->name == index_name);
|
1179
|
-
REQUIRE(index->state == "deferred");
|
1374
|
+
REQUIRE(resp.indexes.empty());
|
1180
1375
|
}
|
1181
|
-
|
1182
1376
|
SECTION("public API")
|
1183
1377
|
{
|
1184
|
-
|
1185
|
-
auto ctx =
|
1378
|
+
couchbase::cluster c(integration.cluster);
|
1379
|
+
auto [ctx, indexes] = c.query_indexes().get_all_indexes("missing_bucket", {}).get();
|
1186
1380
|
REQUIRE_SUCCESS(ctx.ec());
|
1381
|
+
REQUIRE(indexes.empty());
|
1187
1382
|
}
|
1383
|
+
}
|
1188
1384
|
|
1385
|
+
SECTION("drop missing bucket")
|
1386
|
+
{
|
1189
1387
|
SECTION("core API")
|
1190
1388
|
{
|
1191
|
-
couchbase::core::operations::management::
|
1192
|
-
req.bucket_name =
|
1389
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1390
|
+
req.bucket_name = "missing_bucket";
|
1391
|
+
req.is_primary = true;
|
1193
1392
|
auto resp = test::utils::execute(integration.cluster, req);
|
1194
|
-
|
1393
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
1394
|
+
}
|
1395
|
+
SECTION("public API")
|
1396
|
+
{
|
1397
|
+
couchbase::cluster c(integration.cluster);
|
1398
|
+
auto ctx = c.query_indexes().drop_primary_index("missing_bucket", {}).get();
|
1399
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::bucket_not_found);
|
1195
1400
|
}
|
1196
|
-
|
1197
|
-
test::utils::wait_until([&integration, &index_name]() {
|
1198
|
-
couchbase::core::operations::management::query_index_get_all_request req{};
|
1199
|
-
req.bucket_name = integration.ctx.bucket;
|
1200
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1201
|
-
if (resp.indexes.empty()) {
|
1202
|
-
return false;
|
1203
|
-
}
|
1204
|
-
auto index = std::find_if(
|
1205
|
-
resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1206
|
-
return index->state == "online";
|
1207
|
-
});
|
1208
|
-
}
|
1209
|
-
|
1210
|
-
SECTION("create missing bucket")
|
1211
|
-
{
|
1212
|
-
couchbase::core::operations::management::query_index_create_request req{};
|
1213
|
-
req.bucket_name = "missing_bucket";
|
1214
|
-
req.is_primary = true;
|
1215
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1216
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::bucket_not_found);
|
1217
1401
|
}
|
1218
1402
|
|
1219
|
-
SECTION("
|
1403
|
+
SECTION("watch missing index")
|
1220
1404
|
{
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1405
|
+
SECTION("public API")
|
1406
|
+
{
|
1407
|
+
couchbase::cluster c(integration.cluster);
|
1408
|
+
auto start = std::chrono::steady_clock::now();
|
1409
|
+
auto ctx = c.query_indexes()
|
1410
|
+
.watch_indexes(integration.ctx.bucket,
|
1411
|
+
{ "idontexist", "neitherdoI" },
|
1412
|
+
couchbase::watch_query_indexes_options()
|
1413
|
+
.timeout(std::chrono::milliseconds(10000))
|
1414
|
+
.polling_interval(std::chrono::milliseconds(1000)))
|
1415
|
+
.get();
|
1416
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::ambiguous_timeout);
|
1417
|
+
REQUIRE(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count() >= 10000);
|
1418
|
+
}
|
1226
1419
|
}
|
1227
|
-
|
1228
|
-
SECTION("drop missing bucket")
|
1420
|
+
SECTION("watch missing bucket")
|
1229
1421
|
{
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1422
|
+
SECTION("public API")
|
1423
|
+
{
|
1424
|
+
couchbase::cluster c(integration.cluster);
|
1425
|
+
auto start = std::chrono::steady_clock::now();
|
1426
|
+
auto ctx = c.query_indexes()
|
1427
|
+
.watch_indexes("missing_buckeet",
|
1428
|
+
{ "idontexist", "neitherdoI" },
|
1429
|
+
couchbase::watch_query_indexes_options()
|
1430
|
+
.timeout(std::chrono::milliseconds(10000))
|
1431
|
+
.polling_interval(std::chrono::milliseconds(1000)))
|
1432
|
+
.get();
|
1433
|
+
REQUIRE(ctx.ec() == couchbase::errc::common::ambiguous_timeout);
|
1434
|
+
REQUIRE(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count() >= 10000);
|
1435
|
+
}
|
1235
1436
|
}
|
1236
1437
|
}
|
1237
1438
|
|
@@ -1266,272 +1467,488 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1266
1467
|
REQUIRE(created);
|
1267
1468
|
}
|
1268
1469
|
|
1470
|
+
auto manager =
|
1471
|
+
couchbase::cluster(integration.cluster).bucket(integration.ctx.bucket).scope(scope_name).collection(collection_name).query_indexes();
|
1472
|
+
|
1269
1473
|
SECTION("primary index")
|
1270
1474
|
{
|
1475
|
+
SECTION("core API")
|
1271
1476
|
{
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1477
|
+
{
|
1478
|
+
couchbase::core::operations::management::query_index_create_response resp;
|
1479
|
+
bool operation_completed = test::utils::wait_until([&integration, &scope_name, &collection_name, &resp]() {
|
1480
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1481
|
+
req.bucket_name = integration.ctx.bucket;
|
1482
|
+
req.scope_name = scope_name;
|
1483
|
+
req.collection_name = collection_name;
|
1484
|
+
req.is_primary = true;
|
1485
|
+
resp = test::utils::execute(integration.cluster, req);
|
1486
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1487
|
+
});
|
1488
|
+
REQUIRE(operation_completed);
|
1489
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
{
|
1493
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1275
1494
|
req.bucket_name = integration.ctx.bucket;
|
1276
1495
|
req.scope_name = scope_name;
|
1277
1496
|
req.collection_name = collection_name;
|
1278
|
-
|
1279
|
-
resp
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1497
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1498
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1499
|
+
REQUIRE(resp.indexes.size() == 1);
|
1500
|
+
REQUIRE(resp.indexes[0].name == "#primary");
|
1501
|
+
REQUIRE(resp.indexes[0].is_primary);
|
1502
|
+
}
|
1284
1503
|
}
|
1285
|
-
|
1504
|
+
SECTION("public API")
|
1286
1505
|
{
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1506
|
+
{
|
1507
|
+
std::error_code ec;
|
1508
|
+
bool operation_completed = test::utils::wait_until([&manager, &ec]() {
|
1509
|
+
auto ctx = manager.create_primary_index({}).get();
|
1510
|
+
ec = ctx.ec();
|
1511
|
+
return ctx.ec() != couchbase::errc::common::bucket_not_found;
|
1512
|
+
});
|
1513
|
+
|
1514
|
+
REQUIRE(operation_completed);
|
1515
|
+
REQUIRE_SUCCESS(ec);
|
1516
|
+
}
|
1517
|
+
{
|
1518
|
+
auto [ctx, indexes] = manager.get_all_indexes({}).get();
|
1519
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1520
|
+
REQUIRE(indexes.size() == 1);
|
1521
|
+
REQUIRE(indexes[0].name == "#primary");
|
1522
|
+
REQUIRE(indexes[0].is_primary);
|
1523
|
+
}
|
1296
1524
|
}
|
1297
1525
|
}
|
1298
1526
|
|
1299
1527
|
SECTION("named primary index")
|
1300
1528
|
{
|
1529
|
+
SECTION("core API")
|
1301
1530
|
{
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1531
|
+
{
|
1532
|
+
couchbase::core::operations::management::query_index_create_response resp;
|
1533
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1534
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1535
|
+
req.bucket_name = integration.ctx.bucket;
|
1536
|
+
req.scope_name = scope_name;
|
1537
|
+
req.collection_name = collection_name;
|
1538
|
+
req.index_name = index_name;
|
1539
|
+
req.is_primary = true;
|
1540
|
+
resp = test::utils::execute(integration.cluster, req);
|
1541
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1542
|
+
});
|
1543
|
+
REQUIRE(operation_completed);
|
1544
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
{
|
1548
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1305
1549
|
req.bucket_name = integration.ctx.bucket;
|
1306
1550
|
req.scope_name = scope_name;
|
1307
1551
|
req.collection_name = collection_name;
|
1552
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1553
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1554
|
+
REQUIRE(resp.indexes.size() == 1);
|
1555
|
+
REQUIRE(resp.indexes[0].name == index_name);
|
1556
|
+
REQUIRE(resp.indexes[0].is_primary);
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
{
|
1560
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1561
|
+
req.bucket_name = integration.ctx.bucket;
|
1308
1562
|
req.index_name = index_name;
|
1563
|
+
req.scope_name = scope_name;
|
1309
1564
|
req.is_primary = true;
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1315
|
-
}
|
1316
|
-
|
1317
|
-
{
|
1318
|
-
couchbase::core::operations::management::query_index_get_all_request req{};
|
1319
|
-
req.bucket_name = integration.ctx.bucket;
|
1320
|
-
req.scope_name = scope_name;
|
1321
|
-
req.collection_name = collection_name;
|
1322
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1323
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1324
|
-
REQUIRE(resp.indexes.size() == 1);
|
1325
|
-
REQUIRE(resp.indexes[0].name == index_name);
|
1326
|
-
REQUIRE(resp.indexes[0].is_primary);
|
1565
|
+
req.collection_name = collection_name;
|
1566
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1567
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1568
|
+
}
|
1327
1569
|
}
|
1328
|
-
|
1570
|
+
SECTION("public API")
|
1329
1571
|
{
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1572
|
+
{
|
1573
|
+
std::error_code ec;
|
1574
|
+
auto operation_completed = test::utils::wait_until([&index_name, &manager, &ec]() {
|
1575
|
+
auto ctx = manager.create_primary_index(couchbase::create_primary_query_index_options().index_name(index_name)).get();
|
1576
|
+
ec = ctx.ec();
|
1577
|
+
return ec != couchbase::errc::common::bucket_not_found;
|
1578
|
+
});
|
1579
|
+
REQUIRE(operation_completed);
|
1580
|
+
REQUIRE_SUCCESS(ec);
|
1581
|
+
}
|
1582
|
+
{
|
1583
|
+
auto [ctx, indexes] = manager.get_all_indexes({}).get();
|
1584
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1585
|
+
REQUIRE(indexes.size() == 1);
|
1586
|
+
REQUIRE(indexes[0].name == index_name);
|
1587
|
+
REQUIRE(indexes[0].is_primary);
|
1588
|
+
}
|
1589
|
+
{
|
1590
|
+
auto ctx = manager.watch_indexes({ index_name }, {}).get();
|
1591
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1592
|
+
}
|
1593
|
+
{
|
1594
|
+
auto ctx = manager.drop_index(index_name, {}).get();
|
1595
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1596
|
+
}
|
1338
1597
|
}
|
1339
1598
|
}
|
1340
1599
|
|
1341
1600
|
SECTION("non primary index")
|
1342
1601
|
{
|
1602
|
+
SECTION("core API")
|
1343
1603
|
{
|
1344
|
-
|
1345
|
-
|
1604
|
+
|
1605
|
+
{
|
1606
|
+
couchbase::core::operations::management::query_index_create_response resp;
|
1607
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1608
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1609
|
+
req.bucket_name = integration.ctx.bucket;
|
1610
|
+
req.index_name = index_name;
|
1611
|
+
req.scope_name = scope_name;
|
1612
|
+
req.collection_name = collection_name;
|
1613
|
+
req.fields = { "field" };
|
1614
|
+
resp = test::utils::execute(integration.cluster, req);
|
1615
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1616
|
+
});
|
1617
|
+
REQUIRE(operation_completed);
|
1618
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
{
|
1346
1622
|
couchbase::core::operations::management::query_index_create_request req{};
|
1347
1623
|
req.bucket_name = integration.ctx.bucket;
|
1348
1624
|
req.index_name = index_name;
|
1349
1625
|
req.scope_name = scope_name;
|
1350
1626
|
req.collection_name = collection_name;
|
1351
1627
|
req.fields = { "field" };
|
1352
|
-
resp = test::utils::execute(integration.cluster, req);
|
1353
|
-
|
1628
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1629
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::index_exists);
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
{
|
1633
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1634
|
+
req.bucket_name = integration.ctx.bucket;
|
1635
|
+
req.index_name = index_name;
|
1636
|
+
req.scope_name = scope_name;
|
1637
|
+
req.collection_name = collection_name;
|
1638
|
+
req.fields = { "field" };
|
1639
|
+
req.ignore_if_exists = true;
|
1640
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1641
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1642
|
+
}
|
1643
|
+
|
1644
|
+
{
|
1645
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1646
|
+
req.bucket_name = integration.ctx.bucket;
|
1647
|
+
req.scope_name = scope_name;
|
1648
|
+
req.collection_name = collection_name;
|
1649
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1650
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1651
|
+
REQUIRE(resp.indexes.size() == 1);
|
1652
|
+
REQUIRE(resp.indexes[0].name == index_name);
|
1653
|
+
REQUIRE_FALSE(resp.indexes[0].is_primary);
|
1654
|
+
REQUIRE(resp.indexes[0].index_key.size() == 1);
|
1655
|
+
REQUIRE(resp.indexes[0].index_key[0] == "`field`");
|
1656
|
+
REQUIRE(resp.indexes[0].collection_name == collection_name);
|
1657
|
+
REQUIRE(resp.indexes[0].scope_name == scope_name);
|
1658
|
+
REQUIRE(resp.indexes[0].bucket_name == integration.ctx.bucket);
|
1659
|
+
REQUIRE(resp.indexes[0].state == "online");
|
1660
|
+
}
|
1661
|
+
|
1662
|
+
{
|
1663
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1664
|
+
req.bucket_name = integration.ctx.bucket;
|
1665
|
+
req.index_name = index_name;
|
1666
|
+
req.scope_name = scope_name;
|
1667
|
+
req.collection_name = collection_name;
|
1668
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1669
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1670
|
+
}
|
1671
|
+
|
1672
|
+
{
|
1673
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1674
|
+
req.bucket_name = integration.ctx.bucket;
|
1675
|
+
req.index_name = index_name;
|
1676
|
+
req.scope_name = scope_name;
|
1677
|
+
req.collection_name = collection_name;
|
1678
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1679
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::index_not_found);
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
SECTION("public API")
|
1683
|
+
{
|
1684
|
+
{
|
1685
|
+
std::error_code ec;
|
1686
|
+
auto operation_complete = test::utils::wait_until([&manager, &ec, &index_name]() {
|
1687
|
+
ec = manager.create_index(index_name, { "field" }, {}).get().ec();
|
1688
|
+
return ec != couchbase::errc::common::bucket_not_found;
|
1689
|
+
});
|
1690
|
+
REQUIRE(operation_complete);
|
1691
|
+
REQUIRE_SUCCESS(ec);
|
1692
|
+
}
|
1693
|
+
{
|
1694
|
+
REQUIRE(manager.create_index(index_name, { "field" }, {}).get().ec() == couchbase::errc::common::index_exists);
|
1695
|
+
}
|
1696
|
+
{
|
1697
|
+
REQUIRE_SUCCESS(
|
1698
|
+
manager.create_index(index_name, { "field" }, couchbase::create_query_index_options().ignore_if_exists(true)).get().ec());
|
1699
|
+
}
|
1700
|
+
{
|
1701
|
+
REQUIRE_SUCCESS(manager.watch_indexes({ index_name }, {}).get().ec());
|
1702
|
+
auto [ctx, indexes] = manager.get_all_indexes({}).get();
|
1703
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1704
|
+
REQUIRE(indexes.size() == 1);
|
1705
|
+
REQUIRE(indexes[0].name == index_name);
|
1706
|
+
REQUIRE_FALSE(indexes[0].is_primary);
|
1707
|
+
REQUIRE(indexes[0].index_key.size() == 1);
|
1708
|
+
REQUIRE(indexes[0].index_key[0] == "`field`");
|
1709
|
+
REQUIRE(indexes[0].collection_name == collection_name);
|
1710
|
+
REQUIRE(indexes[0].scope_name == scope_name);
|
1711
|
+
REQUIRE(indexes[0].bucket_name == integration.ctx.bucket);
|
1712
|
+
REQUIRE(indexes[0].state == "online");
|
1713
|
+
}
|
1714
|
+
{
|
1715
|
+
auto ctx = manager.drop_index(index_name, {}).get();
|
1716
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1717
|
+
}
|
1718
|
+
{
|
1719
|
+
REQUIRE(manager.drop_index(index_name, {}).get().ec() == couchbase::errc::common::index_not_found);
|
1720
|
+
}
|
1721
|
+
{
|
1722
|
+
REQUIRE_SUCCESS(
|
1723
|
+
manager.drop_index(index_name, couchbase::drop_query_index_options().ignore_if_not_exists(true)).get().ec());
|
1724
|
+
}
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
SECTION("deferred index")
|
1729
|
+
{
|
1730
|
+
|
1731
|
+
SECTION("public API")
|
1732
|
+
{
|
1733
|
+
{
|
1734
|
+
auto ctx =
|
1735
|
+
manager.create_index(index_name, { "field" }, couchbase::create_query_index_options().build_deferred(true)).get();
|
1736
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1737
|
+
}
|
1738
|
+
{
|
1739
|
+
auto [ctx, indexes] = manager.get_all_indexes({}).get();
|
1740
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1741
|
+
REQUIRE(indexes.size() == 1);
|
1742
|
+
REQUIRE(indexes[0].name == index_name);
|
1743
|
+
REQUIRE(indexes[0].state == "deferred");
|
1744
|
+
}
|
1745
|
+
{
|
1746
|
+
auto ctx = manager.build_deferred_indexes({}).get();
|
1747
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1748
|
+
}
|
1749
|
+
{
|
1750
|
+
auto ctx = manager.watch_indexes({ index_name }, {}).get();
|
1751
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1752
|
+
}
|
1753
|
+
}
|
1754
|
+
|
1755
|
+
SECTION("core API")
|
1756
|
+
{
|
1757
|
+
{
|
1758
|
+
couchbase::core::operations::management::query_index_create_response resp;
|
1759
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1760
|
+
couchbase::core::operations::management::query_index_create_request req{};
|
1761
|
+
req.bucket_name = integration.ctx.bucket;
|
1762
|
+
req.index_name = index_name;
|
1763
|
+
req.scope_name = scope_name;
|
1764
|
+
req.collection_name = collection_name;
|
1765
|
+
req.fields = { "field" };
|
1766
|
+
req.deferred = true;
|
1767
|
+
resp = test::utils::execute(integration.cluster, req);
|
1768
|
+
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1769
|
+
});
|
1770
|
+
REQUIRE(operation_completed);
|
1771
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
{
|
1775
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1776
|
+
req.bucket_name = integration.ctx.bucket;
|
1777
|
+
req.scope_name = scope_name;
|
1778
|
+
req.collection_name = collection_name;
|
1779
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1780
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1781
|
+
REQUIRE(resp.indexes.size() == 1);
|
1782
|
+
REQUIRE(resp.indexes[0].name == index_name);
|
1783
|
+
REQUIRE(resp.indexes[0].state == "deferred");
|
1784
|
+
}
|
1785
|
+
{
|
1786
|
+
couchbase::core::operations::management::query_index_build_deferred_request req{};
|
1787
|
+
req.bucket_name = integration.ctx.bucket;
|
1788
|
+
req.scope_name = scope_name;
|
1789
|
+
req.collection_name = collection_name;
|
1790
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1791
|
+
REQUIRE_SUCCESS(resp.ctx.ec);
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
test::utils::wait_until([&integration, scope_name, collection_name]() {
|
1795
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1796
|
+
req.bucket_name = integration.ctx.bucket;
|
1797
|
+
req.scope_name = scope_name;
|
1798
|
+
req.collection_name = collection_name;
|
1799
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1800
|
+
if (resp.indexes.empty()) {
|
1801
|
+
return false;
|
1802
|
+
}
|
1803
|
+
return resp.indexes[0].state == "online";
|
1354
1804
|
});
|
1355
|
-
REQUIRE(operation_completed);
|
1356
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1357
1805
|
}
|
1806
|
+
}
|
1358
1807
|
|
1808
|
+
SECTION("create missing collection")
|
1809
|
+
{
|
1810
|
+
SECTION("core API")
|
1359
1811
|
{
|
1360
1812
|
couchbase::core::operations::management::query_index_create_request req{};
|
1361
1813
|
req.bucket_name = integration.ctx.bucket;
|
1362
|
-
req.index_name = index_name;
|
1363
1814
|
req.scope_name = scope_name;
|
1364
|
-
req.collection_name =
|
1365
|
-
req.
|
1815
|
+
req.collection_name = "missing_collection";
|
1816
|
+
req.is_primary = true;
|
1366
1817
|
auto resp = test::utils::execute(integration.cluster, req);
|
1367
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::
|
1818
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::collection_not_found);
|
1368
1819
|
}
|
1820
|
+
SECTION("public API")
|
1821
|
+
{
|
1822
|
+
couchbase::cluster c(integration.cluster);
|
1823
|
+
auto coll = c.bucket(integration.ctx.bucket).scope(scope_name).collection("missing_collection");
|
1824
|
+
REQUIRE(coll.query_indexes().create_primary_index({}).get().ec() == couchbase::errc::common::collection_not_found);
|
1825
|
+
}
|
1826
|
+
}
|
1369
1827
|
|
1828
|
+
SECTION("create missing scope")
|
1829
|
+
{
|
1830
|
+
SECTION("core API")
|
1370
1831
|
{
|
1371
1832
|
couchbase::core::operations::management::query_index_create_request req{};
|
1372
1833
|
req.bucket_name = integration.ctx.bucket;
|
1373
|
-
req.
|
1374
|
-
req.scope_name = scope_name;
|
1834
|
+
req.scope_name = "missing_scope";
|
1375
1835
|
req.collection_name = collection_name;
|
1376
|
-
req.
|
1377
|
-
req.ignore_if_exists = true;
|
1836
|
+
req.is_primary = true;
|
1378
1837
|
auto resp = test::utils::execute(integration.cluster, req);
|
1379
|
-
|
1838
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::scope_not_found);
|
1380
1839
|
}
|
1381
|
-
|
1840
|
+
SECTION("public API")
|
1382
1841
|
{
|
1383
|
-
couchbase::
|
1384
|
-
|
1385
|
-
|
1386
|
-
req.collection_name = collection_name;
|
1387
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1388
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1389
|
-
REQUIRE(resp.indexes.size() == 1);
|
1390
|
-
REQUIRE(resp.indexes[0].name == index_name);
|
1391
|
-
REQUIRE_FALSE(resp.indexes[0].is_primary);
|
1392
|
-
REQUIRE(resp.indexes[0].index_key.size() == 1);
|
1393
|
-
REQUIRE(resp.indexes[0].index_key[0] == "`field`");
|
1394
|
-
REQUIRE(resp.indexes[0].collection_name == collection_name);
|
1395
|
-
REQUIRE(resp.indexes[0].scope_name == scope_name);
|
1396
|
-
REQUIRE(resp.indexes[0].bucket_name == integration.ctx.bucket);
|
1397
|
-
REQUIRE(resp.indexes[0].state == "online");
|
1842
|
+
couchbase::cluster c(integration.cluster);
|
1843
|
+
auto coll = c.bucket(integration.ctx.bucket).scope("missing scope").collection(collection_name);
|
1844
|
+
REQUIRE(coll.query_indexes().create_primary_index({}).get().ec() == couchbase::errc::common::scope_not_found);
|
1398
1845
|
}
|
1846
|
+
}
|
1399
1847
|
|
1848
|
+
SECTION("get missing collection")
|
1849
|
+
{
|
1850
|
+
SECTION("core API")
|
1400
1851
|
{
|
1401
|
-
couchbase::core::operations::management::
|
1852
|
+
couchbase::core::operations::management::query_index_get_all_request req{};
|
1402
1853
|
req.bucket_name = integration.ctx.bucket;
|
1403
|
-
req.index_name = index_name;
|
1404
1854
|
req.scope_name = scope_name;
|
1405
|
-
req.collection_name =
|
1855
|
+
req.collection_name = "missing_collection";
|
1406
1856
|
auto resp = test::utils::execute(integration.cluster, req);
|
1407
1857
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
1858
|
+
REQUIRE(resp.indexes.empty());
|
1408
1859
|
}
|
1409
|
-
|
1860
|
+
SECTION("public API")
|
1410
1861
|
{
|
1411
|
-
couchbase::
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1417
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::index_not_found);
|
1862
|
+
couchbase::cluster c(integration.cluster);
|
1863
|
+
auto coll = c.bucket(integration.ctx.bucket).scope(scope_name).collection("missing_collection");
|
1864
|
+
auto [ctx, indexes] = coll.query_indexes().get_all_indexes({}).get();
|
1865
|
+
REQUIRE_SUCCESS(ctx.ec());
|
1866
|
+
REQUIRE(indexes.empty());
|
1418
1867
|
}
|
1419
1868
|
}
|
1420
|
-
|
1421
|
-
SECTION("deferred index")
|
1869
|
+
SECTION("get missing scope")
|
1422
1870
|
{
|
1423
|
-
|
1424
|
-
couchbase::core::operations::management::query_index_create_response resp;
|
1425
|
-
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1426
|
-
couchbase::core::operations::management::query_index_create_request req{};
|
1427
|
-
req.bucket_name = integration.ctx.bucket;
|
1428
|
-
req.index_name = index_name;
|
1429
|
-
req.scope_name = scope_name;
|
1430
|
-
req.collection_name = collection_name;
|
1431
|
-
req.fields = { "field" };
|
1432
|
-
req.deferred = true;
|
1433
|
-
resp = test::utils::execute(integration.cluster, req);
|
1434
|
-
return resp.ctx.ec != couchbase::errc::common::bucket_not_found;
|
1435
|
-
});
|
1436
|
-
REQUIRE(operation_completed);
|
1437
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1438
|
-
}
|
1439
|
-
|
1871
|
+
SECTION("core API")
|
1440
1872
|
{
|
1441
1873
|
couchbase::core::operations::management::query_index_get_all_request req{};
|
1442
1874
|
req.bucket_name = integration.ctx.bucket;
|
1443
|
-
req.scope_name =
|
1875
|
+
req.scope_name = "missing_scope";
|
1444
1876
|
req.collection_name = collection_name;
|
1445
1877
|
auto resp = test::utils::execute(integration.cluster, req);
|
1446
1878
|
REQUIRE_SUCCESS(resp.ctx.ec);
|
1447
|
-
REQUIRE(resp.indexes.
|
1448
|
-
REQUIRE(resp.indexes[0].name == index_name);
|
1449
|
-
REQUIRE(resp.indexes[0].state == "deferred");
|
1879
|
+
REQUIRE(resp.indexes.empty());
|
1450
1880
|
}
|
1451
|
-
|
1452
1881
|
SECTION("public API")
|
1453
1882
|
{
|
1454
|
-
|
1455
|
-
auto
|
1883
|
+
couchbase::cluster c(integration.cluster);
|
1884
|
+
auto coll = c.bucket(integration.ctx.bucket).scope("missing_scope").collection(collection_name);
|
1885
|
+
auto [ctx, indexes] = coll.query_indexes().get_all_indexes({}).get();
|
1456
1886
|
REQUIRE_SUCCESS(ctx.ec());
|
1887
|
+
REQUIRE(indexes.empty());
|
1457
1888
|
}
|
1889
|
+
}
|
1458
1890
|
|
1891
|
+
SECTION("drop missing collection")
|
1892
|
+
{
|
1459
1893
|
SECTION("core API")
|
1460
1894
|
{
|
1461
|
-
couchbase::core::operations::management::
|
1895
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1462
1896
|
req.bucket_name = integration.ctx.bucket;
|
1463
1897
|
req.scope_name = scope_name;
|
1464
|
-
req.collection_name =
|
1898
|
+
req.collection_name = "missing_collection";
|
1899
|
+
req.is_primary = true;
|
1465
1900
|
auto resp = test::utils::execute(integration.cluster, req);
|
1466
|
-
|
1901
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::collection_not_found);
|
1467
1902
|
}
|
1468
|
-
|
1469
|
-
|
1470
|
-
couchbase::
|
1903
|
+
SECTION("public API")
|
1904
|
+
{
|
1905
|
+
couchbase::cluster c(integration.cluster);
|
1906
|
+
auto coll = c.bucket(integration.ctx.bucket).scope(scope_name).collection("missing_collection");
|
1907
|
+
REQUIRE(coll.query_indexes().drop_index(index_name, {}).get().ec() == couchbase::errc::common::collection_not_found);
|
1908
|
+
}
|
1909
|
+
}
|
1910
|
+
SECTION("drop missing scope")
|
1911
|
+
{
|
1912
|
+
SECTION("core API")
|
1913
|
+
{
|
1914
|
+
couchbase::core::operations::management::query_index_drop_request req{};
|
1471
1915
|
req.bucket_name = integration.ctx.bucket;
|
1472
|
-
req.scope_name =
|
1916
|
+
req.scope_name = "missing_scope";
|
1473
1917
|
req.collection_name = collection_name;
|
1918
|
+
req.is_primary = true;
|
1474
1919
|
auto resp = test::utils::execute(integration.cluster, req);
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
{
|
1484
|
-
couchbase::core::operations::management::query_index_create_request req{};
|
1485
|
-
req.bucket_name = integration.ctx.bucket;
|
1486
|
-
req.scope_name = scope_name;
|
1487
|
-
req.collection_name = "missing_collection";
|
1488
|
-
req.is_primary = true;
|
1489
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1490
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::collection_not_found);
|
1491
|
-
}
|
1492
|
-
|
1493
|
-
SECTION("create missing scope")
|
1494
|
-
{
|
1495
|
-
couchbase::core::operations::management::query_index_create_request req{};
|
1496
|
-
req.bucket_name = integration.ctx.bucket;
|
1497
|
-
req.scope_name = "missing_scope";
|
1498
|
-
req.collection_name = collection_name;
|
1499
|
-
req.is_primary = true;
|
1500
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1501
|
-
REQUIRE(resp.ctx.ec == couchbase::errc::common::scope_not_found);
|
1502
|
-
}
|
1503
|
-
|
1504
|
-
SECTION("get missing collection")
|
1505
|
-
{
|
1506
|
-
couchbase::core::operations::management::query_index_get_all_request req{};
|
1507
|
-
req.bucket_name = integration.ctx.bucket;
|
1508
|
-
req.scope_name = scope_name;
|
1509
|
-
req.collection_name = "missing_collection";
|
1510
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1511
|
-
REQUIRE_SUCCESS(resp.ctx.ec);
|
1512
|
-
REQUIRE(resp.indexes.empty());
|
1920
|
+
REQUIRE(resp.ctx.ec == couchbase::errc::common::scope_not_found);
|
1921
|
+
}
|
1922
|
+
SECTION("public API")
|
1923
|
+
{
|
1924
|
+
couchbase::cluster c(integration.cluster);
|
1925
|
+
auto coll = c.bucket(integration.ctx.bucket).scope("missing_scope").collection(collection_name);
|
1926
|
+
REQUIRE(coll.query_indexes().drop_index(index_name, {}).get().ec() == couchbase::errc::common::scope_not_found);
|
1927
|
+
}
|
1513
1928
|
}
|
1514
|
-
|
1515
|
-
SECTION("drop missing collection")
|
1929
|
+
SECTION("watch missing scope")
|
1516
1930
|
{
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1931
|
+
SECTION("public API")
|
1932
|
+
{
|
1933
|
+
couchbase::cluster c(integration.cluster);
|
1934
|
+
auto coll = c.bucket(integration.ctx.bucket).scope("missing_scope").collection(collection_name);
|
1935
|
+
REQUIRE(coll.query_indexes()
|
1936
|
+
.watch_indexes({ index_name }, couchbase::watch_query_indexes_options().timeout(std::chrono::seconds(5)))
|
1937
|
+
.get()
|
1938
|
+
.ec() == couchbase::errc::common::ambiguous_timeout);
|
1939
|
+
}
|
1524
1940
|
}
|
1525
|
-
|
1526
|
-
SECTION("drop missing scope")
|
1941
|
+
SECTION("watch missing collection")
|
1527
1942
|
{
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1943
|
+
SECTION("public API")
|
1944
|
+
{
|
1945
|
+
couchbase::cluster c(integration.cluster);
|
1946
|
+
auto coll = c.bucket(integration.ctx.bucket).scope(scope_name).collection("missing_collection");
|
1947
|
+
REQUIRE(coll.query_indexes()
|
1948
|
+
.watch_indexes({ index_name }, couchbase::watch_query_indexes_options().timeout(std::chrono::seconds(5)))
|
1949
|
+
.get()
|
1950
|
+
.ec() == couchbase::errc::common::ambiguous_timeout);
|
1951
|
+
}
|
1535
1952
|
}
|
1536
1953
|
}
|
1537
1954
|
|