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>
This commit is contained in:
@@ -840,15 +840,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<>();
|
||||
@@ -879,8 +870,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
|
||||
|
||||
Reference in New Issue
Block a user