Fix repair race that caused gossip to block Patch by Sergey Lapukhov; Reviewed by Blake Eggleston for CASSANDRA-13849
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/49edd707 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/49edd707 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/49edd707 Branch: refs/heads/cassandra-3.11 Commit: 49edd70740e2efae3681cb79a391369bfb7de02e Parents: 58daf13 Author: Sergey Lapukhov <sergey.lapuk...@booking.com> Authored: Wed Nov 1 11:35:09 2017 +0100 Committer: Blake Eggleston <bdeggles...@gmail.com> Committed: Wed Nov 8 16:38:21 2017 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/cassandra/service/ActiveRepairService.java | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/49edd707/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 3f4f3f2..a94dbc9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.16 + * Fix repair race that caused gossip to block (CASSANDRA-13849) * Tracing interferes with digest requests when using RandomPartitioner (CASSANDRA-13964) * Add flag to disable materialized views, and warnings on creation (CASSANDRA-13959) * Don't let user drop or generally break tables in system_distributed (CASSANDRA-13813) http://git-wip-us.apache.org/repos/asf/cassandra/blob/49edd707/src/java/org/apache/cassandra/service/ActiveRepairService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/ActiveRepairService.java b/src/java/org/apache/cassandra/service/ActiveRepairService.java index b4cea79..adb6fab 100644 --- a/src/java/org/apache/cassandra/service/ActiveRepairService.java +++ b/src/java/org/apache/cassandra/service/ActiveRepairService.java @@ -280,7 +280,7 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai return neighbors; } - public synchronized UUID prepareForRepair(UUID parentRepairSession, InetAddress coordinator, Set<InetAddress> endpoints, RepairOption options, List<ColumnFamilyStore> columnFamilyStores) + public UUID prepareForRepair(UUID parentRepairSession, InetAddress coordinator, Set<InetAddress> endpoints, RepairOption options, List<ColumnFamilyStore> columnFamilyStores) { long timestamp = System.currentTimeMillis(); registerParentRepairSession(parentRepairSession, coordinator, columnFamilyStores, options.getRanges(), options.isIncremental(), timestamp, options.isGlobal()); @@ -351,7 +351,7 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai throw new RuntimeException(errorMsg); } - public void registerParentRepairSession(UUID parentRepairSession, InetAddress coordinator, List<ColumnFamilyStore> columnFamilyStores, Collection<Range<Token>> ranges, boolean isIncremental, long timestamp, boolean isGlobal) + public synchronized void registerParentRepairSession(UUID parentRepairSession, InetAddress coordinator, List<ColumnFamilyStore> columnFamilyStores, Collection<Range<Token>> ranges, boolean isIncremental, long timestamp, boolean isGlobal) { if (!registeredForEndpointChanges) { @@ -360,7 +360,10 @@ public class ActiveRepairService implements IEndpointStateChangeSubscriber, IFai registeredForEndpointChanges = true; } - parentRepairSessions.put(parentRepairSession, new ParentRepairSession(coordinator, columnFamilyStores, ranges, isIncremental, timestamp, isGlobal)); + if (!parentRepairSessions.containsKey(parentRepairSession)) + { + parentRepairSessions.put(parentRepairSession, new ParentRepairSession(coordinator, columnFamilyStores, ranges, isIncremental, timestamp, isGlobal)); + } } public Set<SSTableReader> currentlyRepairing(UUID cfId, UUID parentRepairSession) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org