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 <duarte@scylladb.com>
(cherry picked from commit ad18d535e9)
This commit is contained in:
Duarte Nunes
2018-05-19 15:43:32 +01:00
committed by Nadav Har'El
parent 859a0c2c90
commit c9dc9d4e99

View File

@@ -838,15 +838,6 @@ future<> mutate_MV(const dht::token& base_token, std::vector<mutation> 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<WriteResponseHandlerWrapper> wrappers = new ArrayList<>(mutations.size());
List<Mutation> nonPairedMutations = new LinkedList<>();
@@ -877,8 +868,8 @@ future<> mutate_MV(const dht::token& base_token, std::vector<mutation> 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