Skip to content

Commit 9422def

Browse files
Matt-Wozavsej
authored andcommitted
Fix feature not available exception
1 parent edde841 commit 9422def

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

core/impl/lookup_in_all_replicas.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ initiate_lookup_in_all_replicas_operation(std::shared_ptr<cluster> core,
6161
core->with_bucket_configuration(
6262
bucket_name,
6363
[core, r = std::move(request), h = std::move(handler)](std::error_code ec, const core::topology::configuration& config) mutable {
64+
if (!config.supports_subdoc_read_replica()) {
65+
ec = errc::common::feature_not_available;
66+
}
67+
6468
if (ec) {
6569
std::optional<std::string> first_error_path{};
6670
std::optional<std::size_t> first_error_index{};

core/impl/lookup_in_any_replica.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ initiate_lookup_in_any_replica_operation(std::shared_ptr<cluster> core,
6060
core->with_bucket_configuration(
6161
bucket_name,
6262
[core, r = std::move(request), h = std::move(handler)](std::error_code ec, const core::topology::configuration& config) mutable {
63+
if (!config.supports_subdoc_read_replica()) {
64+
ec = errc::common::feature_not_available;
65+
}
6366
if (ec) {
6467
std::optional<std::string> first_error_path{};
6568
std::optional<std::size_t> first_error_index{};

core/impl/lookup_in_replica.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@
2323
namespace couchbase::core::impl
2424
{
2525
std::error_code
26-
lookup_in_replica_request::encode_to(lookup_in_replica_request::encoded_request_type& encoded, mcbp_context&& context)
26+
lookup_in_replica_request::encode_to(lookup_in_replica_request::encoded_request_type& encoded, mcbp_context&& /* context */)
2727
{
28-
if (!context.config->supports_subdoc_read_replica()) {
29-
return errc::common::feature_not_available;
30-
}
3128
for (std::size_t i = 0; i < specs.size(); ++i) {
3229
specs[i].original_index_ = i;
3330
}

core/operations/document_lookup_in_all_replicas.hxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ struct lookup_in_all_replicas_request {
7373
id.bucket(),
7474
[core, id = id, timeout = timeout, specs = specs, parent_span = parent_span, h = std::forward<Handler>(handler)](
7575
std::error_code ec, const topology::configuration& config) mutable {
76+
if (!config.supports_subdoc_read_replica()) {
77+
ec = errc::common::feature_not_available;
78+
}
79+
7680
if (ec) {
7781
std::optional<std::string> first_error_path{};
7882
std::optional<std::size_t> first_error_index{};

core/operations/document_lookup_in_any_replica.hxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ struct lookup_in_any_replica_request {
5757
id.bucket(),
5858
[core, id = id, timeout = timeout, specs = specs, parent_span = parent_span, h = std::forward<Handler>(handler)](
5959
std::error_code ec, const topology::configuration& config) mutable {
60+
if (!config.supports_subdoc_read_replica()) {
61+
ec = errc::common::feature_not_available;
62+
}
63+
6064
if (ec) {
6165
std::optional<std::string> first_error_path{};
6266
std::optional<std::size_t> first_error_index{};

0 commit comments

Comments
 (0)