From c9dc9d4e99d73bca3ce3cfda2b4b4d1fbe587cc6 Mon Sep 17 00:00:00 2001 From: Duarte Nunes Date: Sat, 19 May 2018 15:43:32 +0100 Subject: [PATCH] db/view: Ignore scenario where base replica hasn't joined the ring Apache Cassandra handles a case where the node hasn't joined the ring and may consequentially have an outdated view of it. Following the same reasoning as with the previous patch, we ignore this scenario. It happens when there are range movements, and this node is bootstrapping, but there are already other mechanisms in the cluster, such as hinted handoff and dual-writing to replicas during range movements, that contribute to this update eventually making its way to the view. This patch doesn't change any behavior, but it provides the reasoning why we won't use the batchlog as Cassandra does, or the hinted handoff log as we will, to later send the update when the node is joined (note that Cassandra just sends the mutations "later", and doesn't check again for any condition or change). Signed-off-by: Duarte Nunes (cherry picked from commit ad18d535e94c50cd73c0e3085d378574c7f16716) --- db/view/view.cc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/db/view/view.cc b/db/view/view.cc index c1e089a9b6..2ae2948727 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -838,15 +838,6 @@ future<> mutate_MV(const dht::token& base_token, std::vector mutations try { - // if we haven't joined the ring, write everything to batchlog because paired replicas may be stale - final UUID batchUUID = UUIDGen.getTimeUUID(); - - if (StorageService.instance.isStarting() || StorageService.instance.isJoining() || StorageService.instance.isMoving()) - { - BatchlogManager.store(Batch.createLocal(batchUUID, FBUtilities.timestampMicros(), - mutations), writeCommitLog); - } - else { List wrappers = new ArrayList<>(mutations.size()); List nonPairedMutations = new LinkedList<>(); @@ -877,8 +868,8 @@ future<> mutate_MV(const dht::token& base_token, std::vector mutations stats.view_updates_pushed_local += is_endpoint_local; stats.view_updates_pushed_remote += updates_pushed_remote; - if (is_endpoint_local && service::get_local_storage_service().is_joined() - && pending_endpoints.empty()) { + + if (is_endpoint_local && pending_endpoints.empty()) { // Note that we start here an asynchronous apply operation, and // do not wait for it to complete. // Note also that mutate_locally(mut) copies mut (in