From c67338989f17257d3be95212ca6ecb4b83009326 Mon Sep 17 00:00:00 2001 From: Paulo Motta Date: Wed, 21 Feb 2018 19:55:41 -0300 Subject: [PATCH] Write to pending endpoint when view replica is also base replica Patch by Paulo Motta; Reviewed by Zhao Yang for CASSANDRA-14251 --- CHANGES.txt | 1 + NEWS.txt | 9 +++++++++ src/java/org/apache/cassandra/service/StorageProxy.java | 7 +++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9734507c1e..ad558deeb7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.17 + * Write to pending endpoint when view replica is also base replica (CASSANDRA-14251) * Chain commit log marker potential performance regression in batch commit mode (CASSANDRA-14194) * Fully utilise specified compaction threads (CASSANDRA-14210) * Pre-create deletion log records to finish compactions quicker (CASSANDRA-12763) diff --git a/NEWS.txt b/NEWS.txt index d282b22ad6..64de28a4a1 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -42,6 +42,15 @@ restore snapshots created with the previous major version using the 'sstableloader' tool. You can upgrade the file format of your snapshots using the provided 'sstableupgrade' tool. +3.0.17 +===== + +Upgrading +--------- + - Materialized view users upgrading from 3.0.15 or later that have performed range movements (join, decommission, move, etc), + should run repair on the base tables, and subsequently on the views to ensure data affected by CASSANDRA-14251 is correctly + propagated to all replicas. + 3.0.16 ===== diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index e380a3f1ab..7a6bed477a 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -759,8 +759,11 @@ public class StorageProxy implements StorageProxyMBean continue; } - // When local node is the paired endpoint just apply the mutation locally. - if (pairedEndpoint.get().equals(FBUtilities.getBroadcastAddress()) && StorageService.instance.isJoined()) + // When local node is the endpoint we can just apply the mutation locally, + // unless there are pending endpoints, in which case we want to do an ordinary + // write so the view mutation is sent to the pending endpoint + if (pairedEndpoint.get().equals(FBUtilities.getBroadcastAddress()) && StorageService.instance.isJoined() + && pendingEndpoints.isEmpty()) try { mutation.apply(writeCommitLog);