diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-10-09 15:24:46 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2019-10-10 10:40:52 +0000 |
commit | 9c0b9c858723df9bb2e5ba19490d97b1aff8fa0d (patch) | |
tree | c36dff4e8ddfebbeb53fd14232143260fd213c16 /storage | |
parent | 8725dfd9eb00f7272e4d95e63ea3acb8ccae1e29 (diff) |
Always process Get replies to avoid racing with reconfigs
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor.h | 2 | ||||
-rw-r--r-- | storage/src/vespa/storage/distributor/externaloperationhandler.cpp | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h index 1a3a22d28a8..9fd055023e2 100644 --- a/storage/src/vespa/storage/distributor/distributor.h +++ b/storage/src/vespa/storage/distributor/distributor.h @@ -328,7 +328,7 @@ private: DistributorHostInfoReporter _hostInfoReporter; std::unique_ptr<OwnershipTransferSafeTimePointCalculator> _ownershipSafeTimeCalc; bool _must_send_updated_host_info; - bool _use_btree_database; + const bool _use_btree_database; }; } // distributor diff --git a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp index 3267d455b45..ecf02ad3c30 100644 --- a/storage/src/vespa/storage/distributor/externaloperationhandler.cpp +++ b/storage/src/vespa/storage/distributor/externaloperationhandler.cpp @@ -351,11 +351,18 @@ IMPL_MSG_COMMAND_H(ExternalOperationHandler, CreateVisitor) } bool ExternalOperationHandler::try_handle_message_outside_main_thread(const std::shared_ptr<api::StorageMessage>& msg) { - if (!concurrent_gets_enabled()) { - return false; - } const auto type_id = msg->getType().getId(); if (type_id == api::MessageType::GET_ID) { + // Only do this check for Get _requests_ to avoid the following case: + // 1) Stale reads are initially enabled and a Get request is received + // 2) A Get is sent to the content node(s) + // 3) Stale reads are disabled via config + // 4) Get-reply from content node is disregarded since concurrent reads are no longer allowed + // 5) We've effectively leaked a Get operation, and the client will time out + // TODO consider having stale reads _not_ be a live config instead! + if (!concurrent_gets_enabled()) { + return false; + } auto op = try_generate_get_operation(std::dynamic_pointer_cast<api::GetCommand>(msg)); if (op) { std::lock_guard g(_non_main_thread_ops_mutex); |