couchbase 4.4.2 → 4.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.
- package/BUILDING.md +182 -0
- package/CMakeLists.txt +13 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +4 -2
- package/deps/couchbase-cxx-cache/boringssl/e31ea00c1ea52052d2d78d44006cc88c80fa24a9/boringssl/src/BUILDING.md +206 -0
- package/deps/couchbase-cxx-client/CMakeLists.txt +18 -13
- package/deps/couchbase-cxx-client/README.md +2 -2
- package/deps/couchbase-cxx-client/cmake/APKBUILD.in +54 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +0 -5
- package/deps/couchbase-cxx-client/cmake/Packaging.cmake +177 -10
- package/deps/couchbase-cxx-client/cmake/RPath.cmake +10 -0
- package/deps/couchbase-cxx-client/cmake/Testing.cmake +1 -1
- package/deps/couchbase-cxx-client/cmake/VersionInfo.cmake +28 -2
- package/deps/couchbase-cxx-client/cmake/build_version.hxx.in +1 -0
- package/deps/couchbase-cxx-client/cmake/couchbase-cxx-client.spec.in +45 -6
- package/deps/couchbase-cxx-client/cmake/couchbase_cxx_client.pc.in +2 -2
- package/deps/couchbase-cxx-client/cmake/debian/changelog.in +5 -0
- package/deps/couchbase-cxx-client/cmake/debian/compat +1 -0
- package/deps/couchbase-cxx-client/cmake/debian/control +40 -0
- package/deps/couchbase-cxx-client/cmake/debian/rules +41 -0
- package/deps/couchbase-cxx-client/cmake/debian/source/format +1 -0
- package/deps/couchbase-cxx-client/core/agent_group.cxx +8 -0
- package/deps/couchbase-cxx-client/core/agent_group.hxx +4 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +16 -20
- package/deps/couchbase-cxx-client/core/bucket.hxx +12 -12
- package/deps/couchbase-cxx-client/core/cluster.cxx +44 -52
- package/deps/couchbase-cxx-client/core/cluster_agent.cxx +8 -0
- package/deps/couchbase-cxx-client/core/cluster_agent.hxx +4 -0
- package/deps/couchbase-cxx-client/core/collections_component.cxx +2 -2
- package/deps/couchbase-cxx-client/core/columnar/agent.cxx +2 -2
- package/deps/couchbase-cxx-client/core/columnar/agent.hxx +1 -1
- package/deps/couchbase-cxx-client/core/columnar/management_component.cxx +3 -3
- package/deps/couchbase-cxx-client/core/columnar/query_component.cxx +103 -45
- package/deps/couchbase-cxx-client/core/columnar/query_component.hxx +1 -0
- package/deps/couchbase-cxx-client/core/free_form_http_request.hxx +8 -0
- package/deps/couchbase-cxx-client/core/http_component.cxx +55 -24
- package/deps/couchbase-cxx-client/core/http_component.hxx +4 -0
- package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/analytics_index_manager.cxx +15 -15
- package/deps/couchbase-cxx-client/core/impl/bootstrap_error.hxx +10 -2
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/bucket_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +36 -40
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +29 -5
- package/deps/couchbase-cxx-client/core/impl/collection_manager.cxx +5 -5
- package/deps/couchbase-cxx-client/core/impl/error.cxx +24 -3
- package/deps/couchbase-cxx-client/core/impl/get_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/lookup_in_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/observe_poll.cxx +13 -5
- package/deps/couchbase-cxx-client/core/impl/observe_poll.hxx +1 -3
- package/deps/couchbase-cxx-client/core/impl/observe_seqno.hxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/query.cxx +1 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/scan_result.cxx +1 -1
- package/deps/couchbase-cxx-client/core/impl/search.cxx +2 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +12 -12
- package/deps/couchbase-cxx-client/core/io/http_command.hxx +31 -20
- package/deps/couchbase-cxx-client/core/io/http_session.cxx +5 -0
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +17 -4
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +97 -49
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +15 -14
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
- package/deps/couchbase-cxx-client/core/io/streams.cxx +256 -0
- package/deps/couchbase-cxx-client/core/io/streams.hxx +31 -155
- package/deps/couchbase-cxx-client/core/logger/configuration.hxx +5 -0
- package/deps/couchbase-cxx-client/core/logger/custom_rotating_file_sink.cxx +2 -3
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +39 -7
- package/deps/couchbase-cxx-client/core/logger/logger.hxx +7 -0
- package/deps/couchbase-cxx-client/core/meta/features.hxx +11 -0
- package/deps/couchbase-cxx-client/core/meta/version.cxx +47 -6
- package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.cxx +188 -0
- package/deps/couchbase-cxx-client/core/metrics/meter_wrapper.hxx +73 -0
- package/deps/couchbase-cxx-client/core/operations/document_analytics.cxx +23 -17
- package/deps/couchbase-cxx-client/core/operations/document_analytics.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_append.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_decrement.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_exists.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_all_replicas.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_and_lock.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_and_touch.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_any_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_get_projected.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_increment.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_insert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_mutate_in.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_prepend.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_remove.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_replace.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/document_touch.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_unlock.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_upsert.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/http_noop.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataset_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_dataverse_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_get_pending_mutations.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_index_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_connect.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_disconnect.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.cxx +23 -15
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_get_all.hxx +4 -3
- package/deps/couchbase-cxx-client/core/operations/management/analytics_link_replace.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_describe.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_flush.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/bucket_update.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/change_password.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_describe.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/cluster_developer_preview_enable.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/collection_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +4 -2
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/collections_manifest_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/eventing_deploy_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_drop_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_all_functions.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_get_status.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_pause_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_resume_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_undeploy_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/eventing_upsert_function.hxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/freeform.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.cxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/management/group_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_build_deferred.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_get_all_deferred.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/role_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_create.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.cxx +4 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/scope_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_get_stats.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +4 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +3 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_stats.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +5 -2
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_get_all.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.cxx +3 -3
- package/deps/couchbase-cxx-client/core/operations/management/user_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_drop.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.cxx +3 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_get_all.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.cxx +2 -1
- package/deps/couchbase-cxx-client/core/operations/management/view_index_upsert.hxx +1 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +37 -17
- package/deps/couchbase-cxx-client/core/platform/base64.cc +1 -1
- package/deps/couchbase-cxx-client/core/platform/random.cc +2 -0
- package/deps/couchbase-cxx-client/core/platform/uuid.h +6 -6
- package/deps/couchbase-cxx-client/core/row_streamer.cxx +1 -1
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.cc +1 -1
- package/deps/couchbase-cxx-client/core/sasl/scram-sha/stringutils.h +4 -4
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +2 -0
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +8 -0
- package/deps/couchbase-cxx-client/core/tracing/constants.hxx +3 -0
- package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.cxx +87 -0
- package/deps/couchbase-cxx-client/core/tracing/tracer_wrapper.hxx +57 -0
- package/deps/couchbase-cxx-client/core/transactions/async_attempt_context.hxx +9 -21
- package/deps/couchbase-cxx-client/core/transactions/attempt_context.hxx +6 -33
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.cxx +57 -56
- package/deps/couchbase-cxx-client/core/transactions/attempt_context_impl.hxx +17 -18
- package/deps/couchbase-cxx-client/core/transactions/staged_mutation.cxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_context.cxx +2 -2
- package/deps/couchbase-cxx-client/core/transactions/transaction_get_result.hxx +0 -20
- package/deps/couchbase-cxx-client/core/transactions/transactions.cxx +2 -2
- package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +128 -52
- package/deps/couchbase-cxx-client/couchbase/analytics_options.hxx +4 -3
- package/deps/couchbase-cxx-client/couchbase/codec/tao_json_serializer.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/common_options.hxx +16 -1
- package/deps/couchbase-cxx-client/couchbase/metrics/otel_meter.hxx +16 -20
- package/deps/couchbase-cxx-client/couchbase/mutate_in_specs.hxx +2 -2
- package/deps/couchbase-cxx-client/couchbase/query_options.hxx +4 -3
- package/deps/couchbase-cxx-client/couchbase/search_options.hxx +1 -1
- package/dist/analyticsindexmanager.d.ts +98 -14
- package/dist/analyticsindexmanager.js +452 -411
- package/dist/binding.d.ts +53 -4
- package/dist/bindingutilities.d.ts +26 -1
- package/dist/bindingutilities.js +108 -1
- package/dist/couchbase.d.ts +3 -1
- package/dist/couchbase.js +2 -0
- package/dist/rangeScan.d.ts +1 -1
- package/dist/rangeScan.js +1 -1
- package/dist/transactions.d.ts +34 -3
- package/dist/transactions.js +25 -18
- package/dist/transcoders.d.ts +68 -0
- package/dist/transcoders.js +194 -1
- package/dist/usermanager.d.ts +14 -14
- package/dist/usermanager.js +178 -228
- package/dist/utilities.js +4 -6
- package/dist/utilities_internal.js +1 -2
- package/package.json +9 -8
- package/src/binding.cpp +13 -13
- package/src/connection.cpp +22 -0
- package/src/connection.hpp +12 -0
- package/src/connection_autogen.cpp +100 -0
- package/src/jstocbpp_autogen.hpp +315 -8
- package/src/jstocbpp_transactions.hpp +1 -2
- package/tools/gen-bindings-js.js +38 -3
- package/tools/gen-bindings-json.py +575 -328
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
#include "core/io/mcbp_message.hxx"
|
|
26
26
|
#include "core/logger/logger.hxx"
|
|
27
27
|
#include "core/mcbp/codec.hxx"
|
|
28
|
+
#include "core/metrics/meter_wrapper.hxx"
|
|
28
29
|
#include "core/protocol/client_opcode.hxx"
|
|
29
30
|
#include "core/protocol/client_request.hxx"
|
|
30
31
|
#include "core/protocol/hello_feature.hxx"
|
|
31
32
|
#include "core/response_handler.hxx"
|
|
32
33
|
#include "core/service_type.hxx"
|
|
34
|
+
#include "core/tracing/tracer_wrapper.hxx"
|
|
33
35
|
#include "core/utils/movable_function.hxx"
|
|
34
36
|
#include "dispatcher.hxx"
|
|
35
37
|
#include "impl/bootstrap_state_listener.hxx"
|
|
@@ -42,10 +44,8 @@
|
|
|
42
44
|
#include "retry_orchestrator.hxx"
|
|
43
45
|
|
|
44
46
|
#include <couchbase/error_codes.hxx>
|
|
45
|
-
#include <couchbase/metrics/meter.hxx>
|
|
46
47
|
#include <couchbase/retry_reason.hxx>
|
|
47
48
|
#include <couchbase/retry_strategy.hxx>
|
|
48
|
-
#include <couchbase/tracing/request_tracer.hxx>
|
|
49
49
|
|
|
50
50
|
#include <asio/bind_executor.hpp>
|
|
51
51
|
#include <asio/error.hpp>
|
|
@@ -82,8 +82,8 @@ public:
|
|
|
82
82
|
bucket_impl(std::string client_id,
|
|
83
83
|
std::string name,
|
|
84
84
|
couchbase::core::origin origin,
|
|
85
|
-
std::shared_ptr<
|
|
86
|
-
std::shared_ptr<
|
|
85
|
+
std::shared_ptr<tracing::tracer_wrapper> tracer,
|
|
86
|
+
std::shared_ptr<metrics::meter_wrapper> meter,
|
|
87
87
|
std::vector<protocol::hello_feature> known_features,
|
|
88
88
|
std::shared_ptr<impl::bootstrap_state_listener> state_listener,
|
|
89
89
|
asio::io_context& ctx,
|
|
@@ -114,15 +114,11 @@ public:
|
|
|
114
114
|
std::optional<key_value_error_map_info> error_info)
|
|
115
115
|
{
|
|
116
116
|
// TODO(SA): copy from mcbp_command, subject to refactor later
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{ "db.operation", fmt::format("{}", req->command_) },
|
|
117
|
+
metrics::metric_attributes attrs{
|
|
118
|
+
service_type::key_value, fmt::format("{}", req->command_), ec, name_, req->scope_name_,
|
|
119
|
+
req->collection_name_,
|
|
121
120
|
};
|
|
122
|
-
meter_->
|
|
123
|
-
->record_value(std::chrono::duration_cast<std::chrono::microseconds>(
|
|
124
|
-
std::chrono::steady_clock::now() - req->dispatched_time_)
|
|
125
|
-
.count());
|
|
121
|
+
meter_->record_value(std::move(attrs), req->dispatched_time_);
|
|
126
122
|
|
|
127
123
|
if (ec == asio::error::operation_aborted) {
|
|
128
124
|
// TODO(SA): fix tracing
|
|
@@ -894,12 +890,12 @@ public:
|
|
|
894
890
|
return configured_;
|
|
895
891
|
}
|
|
896
892
|
|
|
897
|
-
[[nodiscard]] auto tracer() const -> std::shared_ptr<
|
|
893
|
+
[[nodiscard]] auto tracer() const -> std::shared_ptr<tracing::tracer_wrapper>
|
|
898
894
|
{
|
|
899
895
|
return tracer_;
|
|
900
896
|
}
|
|
901
897
|
|
|
902
|
-
[[nodiscard]] auto meter() const -> std::shared_ptr<
|
|
898
|
+
[[nodiscard]] auto meter() const -> std::shared_ptr<metrics::meter_wrapper>
|
|
903
899
|
{
|
|
904
900
|
return meter_;
|
|
905
901
|
}
|
|
@@ -952,8 +948,8 @@ private:
|
|
|
952
948
|
const std::string name_;
|
|
953
949
|
const std::string log_prefix_;
|
|
954
950
|
const origin origin_;
|
|
955
|
-
const std::shared_ptr<
|
|
956
|
-
const std::shared_ptr<
|
|
951
|
+
const std::shared_ptr<tracing::tracer_wrapper> tracer_;
|
|
952
|
+
const std::shared_ptr<metrics::meter_wrapper> meter_;
|
|
957
953
|
const std::vector<protocol::hello_feature> known_features_;
|
|
958
954
|
const std::shared_ptr<impl::bootstrap_state_listener> state_listener_;
|
|
959
955
|
mcbp::codec codec_;
|
|
@@ -985,8 +981,8 @@ private:
|
|
|
985
981
|
bucket::bucket(std::string client_id,
|
|
986
982
|
asio::io_context& ctx,
|
|
987
983
|
asio::ssl::context& tls,
|
|
988
|
-
std::shared_ptr<
|
|
989
|
-
std::shared_ptr<
|
|
984
|
+
std::shared_ptr<tracing::tracer_wrapper> tracer,
|
|
985
|
+
std::shared_ptr<metrics::meter_wrapper> meter,
|
|
990
986
|
std::string name,
|
|
991
987
|
couchbase::core::origin origin,
|
|
992
988
|
std::vector<protocol::hello_feature> known_features,
|
|
@@ -1054,13 +1050,13 @@ bucket::log_prefix() const -> const std::string&
|
|
|
1054
1050
|
}
|
|
1055
1051
|
|
|
1056
1052
|
auto
|
|
1057
|
-
bucket::tracer() const -> std::shared_ptr<
|
|
1053
|
+
bucket::tracer() const -> std::shared_ptr<tracing::tracer_wrapper>
|
|
1058
1054
|
{
|
|
1059
1055
|
return impl_->tracer();
|
|
1060
1056
|
}
|
|
1061
1057
|
|
|
1062
1058
|
auto
|
|
1063
|
-
bucket::meter() const -> std::shared_ptr<
|
|
1059
|
+
bucket::meter() const -> std::shared_ptr<metrics::meter_wrapper>
|
|
1064
1060
|
{
|
|
1065
1061
|
return impl_->meter();
|
|
1066
1062
|
}
|
|
@@ -33,14 +33,6 @@
|
|
|
33
33
|
|
|
34
34
|
namespace couchbase
|
|
35
35
|
{
|
|
36
|
-
namespace metrics
|
|
37
|
-
{
|
|
38
|
-
class meter;
|
|
39
|
-
} // namespace metrics
|
|
40
|
-
namespace tracing
|
|
41
|
-
{
|
|
42
|
-
class request_tracer;
|
|
43
|
-
} // namespace tracing
|
|
44
36
|
namespace core
|
|
45
37
|
{
|
|
46
38
|
namespace mcbp
|
|
@@ -52,6 +44,14 @@ namespace diag
|
|
|
52
44
|
class ping_collector;
|
|
53
45
|
struct diagnostics_result;
|
|
54
46
|
} // namespace diag
|
|
47
|
+
namespace tracing
|
|
48
|
+
{
|
|
49
|
+
class tracer_wrapper;
|
|
50
|
+
} // namespace tracing
|
|
51
|
+
namespace metrics
|
|
52
|
+
{
|
|
53
|
+
class meter_wrapper;
|
|
54
|
+
} // namespace metrics
|
|
55
55
|
namespace impl
|
|
56
56
|
{
|
|
57
57
|
class bootstrap_state_listener;
|
|
@@ -68,8 +68,8 @@ public:
|
|
|
68
68
|
bucket(std::string client_id,
|
|
69
69
|
asio::io_context& ctx,
|
|
70
70
|
asio::ssl::context& tls,
|
|
71
|
-
std::shared_ptr<
|
|
72
|
-
std::shared_ptr<
|
|
71
|
+
std::shared_ptr<tracing::tracer_wrapper> tracer,
|
|
72
|
+
std::shared_ptr<metrics::meter_wrapper> meter,
|
|
73
73
|
std::string name,
|
|
74
74
|
couchbase::core::origin origin,
|
|
75
75
|
std::vector<protocol::hello_feature> known_features,
|
|
@@ -200,8 +200,8 @@ public:
|
|
|
200
200
|
|
|
201
201
|
[[nodiscard]] auto name() const -> const std::string&;
|
|
202
202
|
[[nodiscard]] auto log_prefix() const -> const std::string&;
|
|
203
|
-
[[nodiscard]] auto tracer() const -> std::shared_ptr<
|
|
204
|
-
[[nodiscard]] auto meter() const -> std::shared_ptr<
|
|
203
|
+
[[nodiscard]] auto tracer() const -> std::shared_ptr<tracing::tracer_wrapper>;
|
|
204
|
+
[[nodiscard]] auto meter() const -> std::shared_ptr<metrics::meter_wrapper>;
|
|
205
205
|
[[nodiscard]] auto default_retry_strategy() const -> std::shared_ptr<couchbase::retry_strategy>;
|
|
206
206
|
[[nodiscard]] auto is_closed() const -> bool;
|
|
207
207
|
[[nodiscard]] auto is_configured() const -> bool;
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
#include "core/mcbp/queue_request.hxx"
|
|
40
40
|
#include "core/meta/version.hxx"
|
|
41
41
|
#include "core/metrics/logging_meter.hxx"
|
|
42
|
+
#include "core/metrics/meter_wrapper.hxx"
|
|
42
43
|
#include "core/metrics/noop_meter.hxx"
|
|
43
44
|
#include "core/operations/document_analytics.hxx"
|
|
44
45
|
#include "core/operations/document_append.hxx"
|
|
@@ -145,6 +146,7 @@
|
|
|
145
146
|
#include "core/topology/capabilities.hxx"
|
|
146
147
|
#include "core/tracing/noop_tracer.hxx"
|
|
147
148
|
#include "core/tracing/threshold_logging_tracer.hxx"
|
|
149
|
+
#include "core/tracing/tracer_wrapper.hxx"
|
|
148
150
|
#include "core/utils/join_strings.hxx"
|
|
149
151
|
#include "core/utils/movable_function.hxx"
|
|
150
152
|
#include "crud_component.hxx"
|
|
@@ -352,30 +354,7 @@ public:
|
|
|
352
354
|
id_,
|
|
353
355
|
couchbase::core::meta::sdk_semver(),
|
|
354
356
|
origin_.to_json());
|
|
355
|
-
|
|
356
|
-
if (nullptr != origin_.options().tracer) {
|
|
357
|
-
tracer_ = origin_.options().tracer;
|
|
358
|
-
} else {
|
|
359
|
-
if (origin_.options().enable_tracing) {
|
|
360
|
-
tracer_ = std::make_shared<tracing::threshold_logging_tracer>(
|
|
361
|
-
ctx_, origin_.options().tracing_options);
|
|
362
|
-
} else {
|
|
363
|
-
tracer_ = std::make_shared<tracing::noop_tracer>();
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
tracer_->start();
|
|
367
|
-
// ignore the metrics options if a meter was passed in.
|
|
368
|
-
if (nullptr != origin_.options().meter) {
|
|
369
|
-
meter_ = origin_.options().meter;
|
|
370
|
-
} else {
|
|
371
|
-
if (origin_.options().enable_metrics) {
|
|
372
|
-
meter_ = std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options);
|
|
373
|
-
} else {
|
|
374
|
-
meter_ = std::make_shared<metrics::noop_meter>();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
meter_->start();
|
|
378
|
-
session_manager_->set_tracer(tracer_);
|
|
357
|
+
setup_observability();
|
|
379
358
|
if (origin_.options().enable_dns_srv) {
|
|
380
359
|
std::string hostname;
|
|
381
360
|
std::string port;
|
|
@@ -433,30 +412,7 @@ public:
|
|
|
433
412
|
id_,
|
|
434
413
|
couchbase::core::meta::sdk_semver(),
|
|
435
414
|
origin_.to_json());
|
|
436
|
-
|
|
437
|
-
if (nullptr != origin_.options().tracer) {
|
|
438
|
-
tracer_ = origin_.options().tracer;
|
|
439
|
-
} else {
|
|
440
|
-
if (origin_.options().enable_tracing) {
|
|
441
|
-
tracer_ = std::make_shared<tracing::threshold_logging_tracer>(
|
|
442
|
-
ctx_, origin_.options().tracing_options);
|
|
443
|
-
} else {
|
|
444
|
-
tracer_ = std::make_shared<tracing::noop_tracer>();
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
tracer_->start();
|
|
448
|
-
// ignore the metrics options if a meter was passed in.
|
|
449
|
-
if (nullptr != origin_.options().meter) {
|
|
450
|
-
meter_ = origin_.options().meter;
|
|
451
|
-
} else {
|
|
452
|
-
if (origin_.options().enable_metrics) {
|
|
453
|
-
meter_ = std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options);
|
|
454
|
-
} else {
|
|
455
|
-
meter_ = std::make_shared<metrics::noop_meter>();
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
meter_->start();
|
|
459
|
-
session_manager_->set_tracer(tracer_);
|
|
415
|
+
setup_observability();
|
|
460
416
|
session_manager_->set_dispatch_timeout(origin_.options().dispatch_timeout);
|
|
461
417
|
// at this point we will infinitely try to connect
|
|
462
418
|
if (origin_.options().enable_dns_srv) {
|
|
@@ -493,6 +449,10 @@ public:
|
|
|
493
449
|
b = std::make_shared<bucket>(
|
|
494
450
|
id_, ctx_, tls_, tracer_, meter_, bucket_name, origin, known_features, dns_srv_tracker_);
|
|
495
451
|
buckets_.try_emplace(bucket_name, b);
|
|
452
|
+
|
|
453
|
+
// Register the tracer & the meter for config updates to track Cluster name & UUID
|
|
454
|
+
b->on_configuration_update(tracer_);
|
|
455
|
+
b->on_configuration_update(meter_);
|
|
496
456
|
}
|
|
497
457
|
}
|
|
498
458
|
if (b == nullptr) {
|
|
@@ -1092,7 +1052,7 @@ public:
|
|
|
1092
1052
|
if (cluster->session_) {
|
|
1093
1053
|
cluster->session_->ping(collector->build_reporter(), timeout);
|
|
1094
1054
|
}
|
|
1095
|
-
cluster->for_each_bucket([&collector, &timeout](auto bucket) {
|
|
1055
|
+
cluster->for_each_bucket([&collector, &timeout](const auto& bucket) {
|
|
1096
1056
|
bucket->ping(collector, timeout);
|
|
1097
1057
|
});
|
|
1098
1058
|
}
|
|
@@ -1145,7 +1105,7 @@ public:
|
|
|
1145
1105
|
}
|
|
1146
1106
|
self->retry_backoff_.cancel();
|
|
1147
1107
|
#endif
|
|
1148
|
-
self->for_each_bucket([](auto bucket) {
|
|
1108
|
+
self->for_each_bucket([](const auto& bucket) {
|
|
1149
1109
|
bucket->close();
|
|
1150
1110
|
});
|
|
1151
1111
|
self->session_manager_->close();
|
|
@@ -1221,6 +1181,38 @@ public:
|
|
|
1221
1181
|
}
|
|
1222
1182
|
|
|
1223
1183
|
private:
|
|
1184
|
+
void setup_observability()
|
|
1185
|
+
{
|
|
1186
|
+
// ignore the enable_tracing flag if a tracer was passed in
|
|
1187
|
+
if (nullptr != origin_.options().tracer) {
|
|
1188
|
+
tracer_ = tracing::tracer_wrapper::create(origin_.options().tracer);
|
|
1189
|
+
} else {
|
|
1190
|
+
if (origin_.options().enable_tracing) {
|
|
1191
|
+
tracer_ =
|
|
1192
|
+
tracing::tracer_wrapper::create(std::make_shared<tracing::threshold_logging_tracer>(
|
|
1193
|
+
ctx_, origin_.options().tracing_options));
|
|
1194
|
+
} else {
|
|
1195
|
+
tracer_ = tracing::tracer_wrapper::create(std::make_shared<tracing::noop_tracer>());
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
tracer_->start();
|
|
1199
|
+
// ignore the metrics options if a meter was passed in.
|
|
1200
|
+
if (nullptr != origin_.options().meter) {
|
|
1201
|
+
meter_ = metrics::meter_wrapper::create(origin_.options().meter);
|
|
1202
|
+
} else {
|
|
1203
|
+
if (origin_.options().enable_metrics) {
|
|
1204
|
+
meter_ = metrics::meter_wrapper::create(
|
|
1205
|
+
std::make_shared<metrics::logging_meter>(ctx_, origin_.options().metrics_options));
|
|
1206
|
+
} else {
|
|
1207
|
+
meter_ = metrics::meter_wrapper::create(std::make_shared<metrics::noop_meter>());
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
meter_->start();
|
|
1211
|
+
|
|
1212
|
+
session_manager_->set_tracer(tracer_);
|
|
1213
|
+
session_manager_->set_meter(meter_);
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1224
1216
|
std::string id_{ uuid::to_string(uuid::random()) };
|
|
1225
1217
|
asio::io_context& ctx_;
|
|
1226
1218
|
asio::executor_work_guard<asio::io_context::executor_type> work_;
|
|
@@ -1231,8 +1223,8 @@ private:
|
|
|
1231
1223
|
std::mutex buckets_mutex_{};
|
|
1232
1224
|
std::map<std::string, std::shared_ptr<bucket>> buckets_{};
|
|
1233
1225
|
couchbase::core::origin origin_{};
|
|
1234
|
-
std::shared_ptr<
|
|
1235
|
-
std::shared_ptr<
|
|
1226
|
+
std::shared_ptr<tracing::tracer_wrapper> tracer_{ nullptr };
|
|
1227
|
+
std::shared_ptr<metrics::meter_wrapper> meter_{ nullptr };
|
|
1236
1228
|
std::atomic_bool stopped_{ false };
|
|
1237
1229
|
#ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
|
|
1238
1230
|
std::shared_ptr<couchbase::core::io::cluster_config_tracker> config_tracker_{};
|
|
@@ -42,7 +42,11 @@ public:
|
|
|
42
42
|
|
|
43
43
|
auto free_form_http_request(const http_request& request,
|
|
44
44
|
free_form_http_request_callback&& callback)
|
|
45
|
+
#ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
|
|
46
|
+
-> tl::expected<std::shared_ptr<pending_operation>, error_union>
|
|
47
|
+
#else
|
|
45
48
|
-> tl::expected<std::shared_ptr<pending_operation>, std::error_code>
|
|
49
|
+
#endif
|
|
46
50
|
{
|
|
47
51
|
return http_.do_http_request(request, std::move(callback));
|
|
48
52
|
}
|
|
@@ -61,7 +65,11 @@ cluster_agent::cluster_agent(asio::io_context& io, cluster_agent_config config)
|
|
|
61
65
|
auto
|
|
62
66
|
cluster_agent::free_form_http_request(const couchbase::core::http_request& request,
|
|
63
67
|
couchbase::core::free_form_http_request_callback&& callback)
|
|
68
|
+
#ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
|
|
69
|
+
-> tl::expected<std::shared_ptr<pending_operation>, error_union>
|
|
70
|
+
#else
|
|
64
71
|
-> tl::expected<std::shared_ptr<pending_operation>, std::error_code>
|
|
72
|
+
#endif
|
|
65
73
|
{
|
|
66
74
|
return impl_->free_form_http_request(request, std::move(callback));
|
|
67
75
|
}
|
|
@@ -40,7 +40,11 @@ public:
|
|
|
40
40
|
|
|
41
41
|
auto free_form_http_request(const http_request& request,
|
|
42
42
|
free_form_http_request_callback&& callback)
|
|
43
|
+
#ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
|
|
44
|
+
-> tl::expected<std::shared_ptr<pending_operation>, error_union>;
|
|
45
|
+
#else
|
|
43
46
|
-> tl::expected<std::shared_ptr<pending_operation>, std::error_code>;
|
|
47
|
+
#endif
|
|
44
48
|
|
|
45
49
|
private:
|
|
46
50
|
std::shared_ptr<cluster_agent_impl> impl_;
|
|
@@ -430,7 +430,7 @@ collection_id_cache_entry_impl::refresh_collection_id(
|
|
|
430
430
|
self->manager_.lock()->remove(req->scope_name_, req->collection_name_);
|
|
431
431
|
auto queue = self->swap_queue();
|
|
432
432
|
queue->close();
|
|
433
|
-
return queue->drain([ec](auto r) {
|
|
433
|
+
return queue->drain([ec](const auto& r) {
|
|
434
434
|
r->try_callback({}, ec);
|
|
435
435
|
});
|
|
436
436
|
}
|
|
@@ -443,7 +443,7 @@ collection_id_cache_entry_impl::refresh_collection_id(
|
|
|
443
443
|
res.collection_id);
|
|
444
444
|
auto queue = self->swap_queue();
|
|
445
445
|
queue->close();
|
|
446
|
-
return queue->drain([self](auto r) {
|
|
446
|
+
return queue->drain([self](const auto& r) {
|
|
447
447
|
if (auto ec = self->assign_collection_id(r); ec) {
|
|
448
448
|
CB_LOG_DEBUG("failed to set collection ID \"{}.{}\" on request (OP={}): {}",
|
|
449
449
|
r->scope_name_,
|
|
@@ -49,7 +49,7 @@ public:
|
|
|
49
49
|
|
|
50
50
|
auto free_form_http_request(const http_request& request,
|
|
51
51
|
free_form_http_request_callback&& callback)
|
|
52
|
-
-> tl::expected<std::shared_ptr<pending_operation>,
|
|
52
|
+
-> tl::expected<std::shared_ptr<pending_operation>, error_union>
|
|
53
53
|
{
|
|
54
54
|
return http_.do_http_request(request, std::move(callback));
|
|
55
55
|
}
|
|
@@ -102,7 +102,7 @@ agent::agent(asio::io_context& io, couchbase::core::columnar::agent_config confi
|
|
|
102
102
|
auto
|
|
103
103
|
agent::free_form_http_request(const http_request& request,
|
|
104
104
|
free_form_http_request_callback&& callback)
|
|
105
|
-
-> tl::expected<std::shared_ptr<pending_operation>,
|
|
105
|
+
-> tl::expected<std::shared_ptr<pending_operation>, error_union>
|
|
106
106
|
{
|
|
107
107
|
return impl_->free_form_http_request(request, std::move(callback));
|
|
108
108
|
}
|
|
@@ -46,7 +46,7 @@ public:
|
|
|
46
46
|
|
|
47
47
|
auto free_form_http_request(const http_request& request,
|
|
48
48
|
free_form_http_request_callback&& callback)
|
|
49
|
-
-> tl::expected<std::shared_ptr<pending_operation>,
|
|
49
|
+
-> tl::expected<std::shared_ptr<pending_operation>, error_union>;
|
|
50
50
|
|
|
51
51
|
auto free_form_http_request_buffered(const http_request& request,
|
|
52
52
|
buffered_free_form_http_request_callback&& callback)
|
|
@@ -189,7 +189,7 @@ public:
|
|
|
189
189
|
"SELECT d.* FROM `System`.`Metadata`.`Database` AS d",
|
|
190
190
|
options.timeout,
|
|
191
191
|
};
|
|
192
|
-
return execute(std::move(req), [cb = std::move(callback)](auto raw_res, auto err) {
|
|
192
|
+
return execute(std::move(req), [cb = std::move(callback)](const auto& raw_res, auto err) {
|
|
193
193
|
if (err) {
|
|
194
194
|
cb({}, std::move(err));
|
|
195
195
|
return;
|
|
@@ -216,7 +216,7 @@ public:
|
|
|
216
216
|
if (options.ignore_if_exists) {
|
|
217
217
|
req.statement += " IF NOT EXISTS";
|
|
218
218
|
}
|
|
219
|
-
return execute(std::move(req), [cb = std::move(callback)](auto /*raw_res*/, auto err) {
|
|
219
|
+
return execute(std::move(req), [cb = std::move(callback)](const auto& /*raw_res*/, auto err) {
|
|
220
220
|
cb(std::move(err));
|
|
221
221
|
});
|
|
222
222
|
}
|
|
@@ -231,7 +231,7 @@ public:
|
|
|
231
231
|
if (options.ignore_if_not_exists) {
|
|
232
232
|
req.statement += " IF EXISTS";
|
|
233
233
|
}
|
|
234
|
-
return execute(std::move(req), [cb = std::move(callback)](auto /*raw_res*/, auto err) {
|
|
234
|
+
return execute(std::move(req), [cb = std::move(callback)](const auto& /*raw_res*/, auto err) {
|
|
235
235
|
cb(std::move(err));
|
|
236
236
|
});
|
|
237
237
|
}
|
|
@@ -79,17 +79,28 @@ public:
|
|
|
79
79
|
|
|
80
80
|
auto dispatch() -> error
|
|
81
81
|
{
|
|
82
|
-
auto op =
|
|
83
|
-
|
|
82
|
+
auto op = http_.do_http_request(
|
|
83
|
+
http_req_, [self = shared_from_this()](auto resp, error_union err) mutable {
|
|
84
84
|
std::shared_ptr<pending_operation> op;
|
|
85
85
|
{
|
|
86
86
|
const std::scoped_lock lock{ self->pending_op_mutex_ };
|
|
87
87
|
std::swap(op, self->pending_op_);
|
|
88
88
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
if (!std::holds_alternative<std::monostate>(err)) {
|
|
90
|
+
if (std::holds_alternative<impl::bootstrap_error>(err)) {
|
|
91
|
+
auto bootstrap_error = std::get<impl::bootstrap_error>(err);
|
|
92
|
+
auto message = fmt::format(
|
|
93
|
+
"Failed to execute the HTTP request for the query due to a bootstrap error. "
|
|
94
|
+
"See logs for further details. bootstrap_error.message={}",
|
|
95
|
+
bootstrap_error.error_message);
|
|
96
|
+
self->invoke_callback({}, { maybe_convert_error_code(bootstrap_error.ec), message });
|
|
97
|
+
} else {
|
|
98
|
+
auto ec = maybe_convert_error_code(std::get<std::error_code>(err));
|
|
99
|
+
if (ec == errc::timeout) {
|
|
100
|
+
return self->trigger_timeout();
|
|
101
|
+
}
|
|
102
|
+
self->invoke_callback({}, { ec, "Failed to execute the HTTP request for the query" });
|
|
103
|
+
}
|
|
93
104
|
return;
|
|
94
105
|
}
|
|
95
106
|
// op can be null if the pending_query_operation was cancelled.
|
|
@@ -101,7 +112,7 @@ public:
|
|
|
101
112
|
}
|
|
102
113
|
auto streamer = std::make_shared<row_streamer>(self->io_, resp.body(), "/results/^");
|
|
103
114
|
return streamer->start(
|
|
104
|
-
[self, streamer, resp = std::move(resp)](auto metadata_header, auto ec) mutable {
|
|
115
|
+
[self, streamer, resp = std::move(resp)](const auto& metadata_header, auto ec) mutable {
|
|
105
116
|
if (ec) {
|
|
106
117
|
self->invoke_callback({}, { maybe_convert_error_code(ec) });
|
|
107
118
|
return;
|
|
@@ -127,7 +138,27 @@ public:
|
|
|
127
138
|
pending_op_ = op.value();
|
|
128
139
|
return {};
|
|
129
140
|
}
|
|
130
|
-
|
|
141
|
+
retry_timer_.cancel();
|
|
142
|
+
deadline_.cancel();
|
|
143
|
+
error return_error{};
|
|
144
|
+
#ifdef COUCHBASE_CXX_CLIENT_COLUMNAR
|
|
145
|
+
if (std::holds_alternative<impl::bootstrap_error>(op.error())) {
|
|
146
|
+
auto bootstrap_error = std::get<impl::bootstrap_error>(op.error());
|
|
147
|
+
auto message =
|
|
148
|
+
fmt::format("Failed to create the HTTP pending operation due to a bootstrap error. "
|
|
149
|
+
"See logs for further details. bootstrap_error.message={}",
|
|
150
|
+
bootstrap_error.error_message);
|
|
151
|
+
return_error.ec = bootstrap_error.ec;
|
|
152
|
+
return_error.message = message;
|
|
153
|
+
} else {
|
|
154
|
+
return_error.ec = std::get<std::error_code>(op.error());
|
|
155
|
+
return_error.message = "Failed to create the HTTP pending operation.";
|
|
156
|
+
}
|
|
157
|
+
#else
|
|
158
|
+
return_error.ec = op.error();
|
|
159
|
+
#endif
|
|
160
|
+
invoke_callback({}, return_error);
|
|
161
|
+
return return_error;
|
|
131
162
|
}
|
|
132
163
|
|
|
133
164
|
auto start(query_callback&& callback) -> error
|
|
@@ -252,11 +283,13 @@ private:
|
|
|
252
283
|
break;
|
|
253
284
|
}
|
|
254
285
|
}
|
|
286
|
+
|
|
287
|
+
const std::chrono::milliseconds server_timeout = timeout_ + std::chrono::seconds(5);
|
|
288
|
+
payload["timeout"] = fmt::format("{}ms", server_timeout.count());
|
|
289
|
+
|
|
255
290
|
for (const auto& [key, val] : options.raw) {
|
|
256
291
|
payload[key] = utils::json::parse(val);
|
|
257
292
|
}
|
|
258
|
-
const std::chrono::milliseconds server_timeout = timeout_ + std::chrono::seconds(5);
|
|
259
|
-
payload["timeout"] = fmt::format("{}ms", server_timeout.count());
|
|
260
293
|
|
|
261
294
|
return payload;
|
|
262
295
|
}
|
|
@@ -296,7 +329,7 @@ private:
|
|
|
296
329
|
// retryable errors should be listed.
|
|
297
330
|
if (err.ec == errc::timeout && retry_info_.last_error) {
|
|
298
331
|
if (const auto* e = retry_info_.last_error.ctx.find("errors"); e != nullptr) {
|
|
299
|
-
err.ctx["last_errors"] = e;
|
|
332
|
+
err.ctx["last_errors"] = e->get_array();
|
|
300
333
|
}
|
|
301
334
|
}
|
|
302
335
|
}
|
|
@@ -334,53 +367,71 @@ private:
|
|
|
334
367
|
std::int32_t first_error_code{ 0 };
|
|
335
368
|
std::string first_error_msg{};
|
|
336
369
|
|
|
370
|
+
std::int32_t first_non_retr_error_code{ 0 };
|
|
371
|
+
std::string first_non_retr_error_msg{};
|
|
372
|
+
|
|
337
373
|
for (auto error_json : errors_json->get_array()) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
374
|
+
bool retr{ false }; // An error is assumed to not be retriable if the field is missing
|
|
375
|
+
{
|
|
376
|
+
auto* r = error_json.find("retriable");
|
|
377
|
+
if (r != nullptr) {
|
|
378
|
+
if (!r->is_boolean()) {
|
|
379
|
+
return {
|
|
380
|
+
{ errc::generic,
|
|
381
|
+
"Could not parse error from server response - 'retriable' was not boolean" }
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
retr = r->get_boolean();
|
|
385
|
+
}
|
|
348
386
|
}
|
|
349
387
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return { { errc::generic,
|
|
353
|
-
"Could not parse error from server response - could not find 'msg' field" } };
|
|
354
|
-
}
|
|
355
|
-
if (!msg->is_string()) {
|
|
356
|
-
return { { errc::generic,
|
|
357
|
-
"Could not parse error from server response - 'msg' field was not string" } };
|
|
358
|
-
}
|
|
388
|
+
// Operation is retriable iff all errors are retriable
|
|
389
|
+
res.retriable = res.retriable && retr;
|
|
359
390
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
391
|
+
std::string msg{};
|
|
392
|
+
{
|
|
393
|
+
auto* m = error_json.find("msg");
|
|
394
|
+
if (m == nullptr) {
|
|
395
|
+
return { { errc::generic,
|
|
396
|
+
"Could not parse error from server response - could not find 'msg' field" } };
|
|
397
|
+
}
|
|
398
|
+
if (!m->is_string()) {
|
|
399
|
+
return { { errc::generic,
|
|
400
|
+
"Could not parse error from server response - 'msg' field was not string" } };
|
|
401
|
+
}
|
|
402
|
+
msg = m->get_string();
|
|
370
403
|
}
|
|
371
404
|
|
|
372
|
-
std::int32_t code
|
|
373
|
-
|
|
405
|
+
std::int32_t code{};
|
|
406
|
+
{
|
|
407
|
+
auto* c = error_json.find("code");
|
|
408
|
+
if (c == nullptr) {
|
|
409
|
+
return { { errc::generic,
|
|
410
|
+
"Could not parse error from server response - could not find 'code' field" } };
|
|
411
|
+
}
|
|
412
|
+
if (!(c->is_unsigned() || c->is_signed())) {
|
|
413
|
+
return {
|
|
414
|
+
{ errc::generic,
|
|
415
|
+
"Could not parse error from server response - 'code' field was not an integer" }
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
code = c->is_signed() ? gsl::narrow_cast<std::int32_t>(c->get_signed())
|
|
419
|
+
: gsl::narrow_cast<std::int32_t>(c->get_unsigned());
|
|
420
|
+
}
|
|
374
421
|
|
|
375
422
|
tao::json::value error = {
|
|
376
423
|
{ "code", code },
|
|
377
|
-
{ "msg", msg
|
|
424
|
+
{ "msg", msg },
|
|
378
425
|
};
|
|
379
426
|
res.err.ctx["errors"].get_array().emplace_back(std::move(error));
|
|
380
427
|
|
|
381
428
|
if (first_error_code == 0) {
|
|
382
429
|
first_error_code = code;
|
|
383
|
-
first_error_msg = msg
|
|
430
|
+
first_error_msg = msg;
|
|
431
|
+
}
|
|
432
|
+
if (!retr && first_non_retr_error_code == 0) {
|
|
433
|
+
first_non_retr_error_code = code;
|
|
434
|
+
first_non_retr_error_msg = msg;
|
|
384
435
|
}
|
|
385
436
|
|
|
386
437
|
switch (code) {
|
|
@@ -396,7 +447,14 @@ private:
|
|
|
396
447
|
}
|
|
397
448
|
|
|
398
449
|
if (res.err.ec == errc::query_error) {
|
|
399
|
-
|
|
450
|
+
// If any of the errors is not retriable, report the first non-retriable code/message in the
|
|
451
|
+
// error properties
|
|
452
|
+
if (first_non_retr_error_code != 0) {
|
|
453
|
+
res.err.properties =
|
|
454
|
+
query_error_properties{ first_non_retr_error_code, first_non_retr_error_msg };
|
|
455
|
+
} else {
|
|
456
|
+
res.err.properties = query_error_properties{ first_error_code, first_error_msg };
|
|
457
|
+
}
|
|
400
458
|
}
|
|
401
459
|
|
|
402
460
|
return res;
|