You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jj...@apache.org on 2017/04/19 16:01:08 UTC

[1/6] cassandra git commit: Interrupt replaying hints on decommission

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 3110d27dd -> 5089e74ef
  refs/heads/cassandra-3.11 9c54d02f7 -> 5f6445480
  refs/heads/trunk 08c216d12 -> 9b1295e41


Interrupt replaying hints on decommission

Patch by Jeff Jirsa; Reviewed by Aleksey Yeschenko for CASSANDRA-13308


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5089e74e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5089e74e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5089e74e

Branch: refs/heads/cassandra-3.0
Commit: 5089e74ef4a0eaeb1c439d57f074de1c496421f2
Parents: 3110d27
Author: Jeff Jirsa <jj...@apple.com>
Authored: Wed Apr 19 08:26:02 2017 -0700
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Wed Apr 19 08:57:45 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/hints/HintsDispatchExecutor.java    |  8 ++++++++
 src/java/org/apache/cassandra/hints/HintsDispatcher.java |  9 +++++++--
 src/java/org/apache/cassandra/hints/HintsService.java    | 11 ++++++-----
 4 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 918c46b..e55d4cb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 3.0.14
  * Handling partially written hint files (CASSANDRA-12728) 
+ * Interrupt replaying hints on decommission (CASSANDRA-13308)
 
 3.0.13
  * Make reading of range tombstones more reliable (CASSANDRA-12811)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
index 333232d..58b30bd 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
@@ -117,6 +117,14 @@ final class HintsDispatchExecutor
         }
     }
 
+    void interruptDispatch(UUID hostId)
+    {
+        Future future = scheduledDispatches.remove(hostId);
+
+        if (null != future)
+            future.cancel(true);
+    }
+
     private final class TransferHintsTask implements Runnable
     {
         private final HintsCatalog catalog;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatcher.java b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
index d7a3515..351b3fa 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Function;
 
 import com.google.common.util.concurrent.RateLimiter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.gms.FailureDetector;
@@ -42,6 +44,8 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
  */
 final class HintsDispatcher implements AutoCloseable
 {
+    private static final Logger logger = LoggerFactory.getLogger(HintsDispatcher.class);
+
     private enum Action { CONTINUE, ABORT }
 
     private final HintsReader reader;
@@ -181,7 +185,7 @@ final class HintsDispatcher implements AutoCloseable
 
     private static final class Callback implements IAsyncCallbackWithFailure
     {
-        enum Outcome { SUCCESS, TIMEOUT, FAILURE }
+        enum Outcome { SUCCESS, TIMEOUT, FAILURE, INTERRUPTED }
 
         private final long start = System.nanoTime();
         private final SimpleCondition condition = new SimpleCondition();
@@ -198,7 +202,8 @@ final class HintsDispatcher implements AutoCloseable
             }
             catch (InterruptedException e)
             {
-                throw new AssertionError(e);
+                logger.warn("Hint dispatch was interrupted", e);
+                return Outcome.INTERRUPTED;
             }
 
             return timedOut ? Outcome.TIMEOUT : outcome;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsService.java b/src/java/org/apache/cassandra/hints/HintsService.java
index 5a32786..9cd4ed3 100644
--- a/src/java/org/apache/cassandra/hints/HintsService.java
+++ b/src/java/org/apache/cassandra/hints/HintsService.java
@@ -287,10 +287,11 @@ public final class HintsService implements HintsServiceMBean
     /**
      * Cleans up hints-related state after a node with id = hostId left.
      *
-     * Dispatcher should stop itself (isHostAlive() will start returning false for the leaving host), but we'll wait for
-     * completion anyway.
+     * Dispatcher can not stop itself (isHostAlive() can not start returning false for the leaving host because this
+     * method is called by the same thread as gossip, which blocks gossip), so we can't simply wait for
+     * completion.
      *
-     * We should also flush the buffer is there are any thints for the node there, and close the writer (if any),
+     * We should also flush the buffer if there are any hints for the node there, and close the writer (if any),
      * so that we don't leave any hint files lying around.
      *
      * Once that is done, we can simply delete all hint files and remove the host id from the catalog.
@@ -319,8 +320,8 @@ public final class HintsService implements HintsServiceMBean
             throw new RuntimeException(e);
         }
 
-        // wait for the current dispatch session to end (if any), so that the currently dispatched file gets removed
-        dispatchExecutor.completeDispatchBlockingly(store);
+        // interrupt the current dispatch session to end (if any), so that the currently dispatched file gets removed
+        dispatchExecutor.interruptDispatch(store.hostId);
 
         // delete all the hints files and remove the HintsStore instance from the map in the catalog
         catalog.exciseStore(hostId);


[6/6] cassandra git commit: Merge branch 'cassandra-3.11' into trunk

Posted by jj...@apache.org.
Merge branch 'cassandra-3.11' into trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9b1295e4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9b1295e4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9b1295e4

Branch: refs/heads/trunk
Commit: 9b1295e419b93a194b2270e5b31b689d3ab05dd2
Parents: 08c216d 5f64454
Author: Jeff Jirsa <je...@jeffjirsa.net>
Authored: Wed Apr 19 08:58:55 2017 -0700
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Wed Apr 19 08:59:29 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/hints/HintsDispatchExecutor.java    |  8 ++++++++
 src/java/org/apache/cassandra/hints/HintsDispatcher.java |  9 +++++++--
 src/java/org/apache/cassandra/hints/HintsService.java    | 11 ++++++-----
 4 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b1295e4/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 13df7e6,92ecb39..c742570
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -80,7 -24,9 +80,8 @@@
   * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
   * Address message coalescing regression (CASSANDRA-12676)
   * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417)
 - * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
  Merged from 3.0:
+  * Interrupt replaying hints on decommission (CASSANDRA-13308)
   * Handling partially written hint files (CASSANDRA-12728)
   * Fix NPE issue in StorageService (CASSANDRA-13060)
   * Make reading of range tombstones more reliable (CASSANDRA-12811)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b1295e4/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9b1295e4/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/hints/HintsDispatcher.java
index 4a08540,c432553..323eeb1
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@@ -26,8 -26,9 +26,10 @@@ import java.util.function.BooleanSuppli
  import java.util.function.Function;
  
  import com.google.common.util.concurrent.RateLimiter;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
  
 +import org.apache.cassandra.db.monitoring.ApproximateTime;
  import org.apache.cassandra.exceptions.RequestFailureReason;
  import org.apache.cassandra.metrics.HintsServiceMetrics;
  import org.apache.cassandra.net.IAsyncCallbackWithFailure;


[3/6] cassandra git commit: Interrupt replaying hints on decommission

Posted by jj...@apache.org.
Interrupt replaying hints on decommission

Patch by Jeff Jirsa; Reviewed by Aleksey Yeschenko for CASSANDRA-13308


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5089e74e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5089e74e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5089e74e

Branch: refs/heads/trunk
Commit: 5089e74ef4a0eaeb1c439d57f074de1c496421f2
Parents: 3110d27
Author: Jeff Jirsa <jj...@apple.com>
Authored: Wed Apr 19 08:26:02 2017 -0700
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Wed Apr 19 08:57:45 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/hints/HintsDispatchExecutor.java    |  8 ++++++++
 src/java/org/apache/cassandra/hints/HintsDispatcher.java |  9 +++++++--
 src/java/org/apache/cassandra/hints/HintsService.java    | 11 ++++++-----
 4 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 918c46b..e55d4cb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 3.0.14
  * Handling partially written hint files (CASSANDRA-12728) 
+ * Interrupt replaying hints on decommission (CASSANDRA-13308)
 
 3.0.13
  * Make reading of range tombstones more reliable (CASSANDRA-12811)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
index 333232d..58b30bd 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
@@ -117,6 +117,14 @@ final class HintsDispatchExecutor
         }
     }
 
+    void interruptDispatch(UUID hostId)
+    {
+        Future future = scheduledDispatches.remove(hostId);
+
+        if (null != future)
+            future.cancel(true);
+    }
+
     private final class TransferHintsTask implements Runnable
     {
         private final HintsCatalog catalog;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatcher.java b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
index d7a3515..351b3fa 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Function;
 
 import com.google.common.util.concurrent.RateLimiter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.gms.FailureDetector;
@@ -42,6 +44,8 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
  */
 final class HintsDispatcher implements AutoCloseable
 {
+    private static final Logger logger = LoggerFactory.getLogger(HintsDispatcher.class);
+
     private enum Action { CONTINUE, ABORT }
 
     private final HintsReader reader;
@@ -181,7 +185,7 @@ final class HintsDispatcher implements AutoCloseable
 
     private static final class Callback implements IAsyncCallbackWithFailure
     {
-        enum Outcome { SUCCESS, TIMEOUT, FAILURE }
+        enum Outcome { SUCCESS, TIMEOUT, FAILURE, INTERRUPTED }
 
         private final long start = System.nanoTime();
         private final SimpleCondition condition = new SimpleCondition();
@@ -198,7 +202,8 @@ final class HintsDispatcher implements AutoCloseable
             }
             catch (InterruptedException e)
             {
-                throw new AssertionError(e);
+                logger.warn("Hint dispatch was interrupted", e);
+                return Outcome.INTERRUPTED;
             }
 
             return timedOut ? Outcome.TIMEOUT : outcome;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsService.java b/src/java/org/apache/cassandra/hints/HintsService.java
index 5a32786..9cd4ed3 100644
--- a/src/java/org/apache/cassandra/hints/HintsService.java
+++ b/src/java/org/apache/cassandra/hints/HintsService.java
@@ -287,10 +287,11 @@ public final class HintsService implements HintsServiceMBean
     /**
      * Cleans up hints-related state after a node with id = hostId left.
      *
-     * Dispatcher should stop itself (isHostAlive() will start returning false for the leaving host), but we'll wait for
-     * completion anyway.
+     * Dispatcher can not stop itself (isHostAlive() can not start returning false for the leaving host because this
+     * method is called by the same thread as gossip, which blocks gossip), so we can't simply wait for
+     * completion.
      *
-     * We should also flush the buffer is there are any thints for the node there, and close the writer (if any),
+     * We should also flush the buffer if there are any hints for the node there, and close the writer (if any),
      * so that we don't leave any hint files lying around.
      *
      * Once that is done, we can simply delete all hint files and remove the host id from the catalog.
@@ -319,8 +320,8 @@ public final class HintsService implements HintsServiceMBean
             throw new RuntimeException(e);
         }
 
-        // wait for the current dispatch session to end (if any), so that the currently dispatched file gets removed
-        dispatchExecutor.completeDispatchBlockingly(store);
+        // interrupt the current dispatch session to end (if any), so that the currently dispatched file gets removed
+        dispatchExecutor.interruptDispatch(store.hostId);
 
         // delete all the hints files and remove the HintsStore instance from the map in the catalog
         catalog.exciseStore(hostId);


[5/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by jj...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5f644548
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5f644548
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5f644548

Branch: refs/heads/cassandra-3.11
Commit: 5f6445480341fbcbf15cdf36f4dda5f1b1a93102
Parents: 9c54d02 5089e74
Author: Jeff Jirsa <je...@jeffjirsa.net>
Authored: Wed Apr 19 08:58:02 2017 -0700
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Wed Apr 19 08:58:45 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/hints/HintsDispatchExecutor.java    |  8 ++++++++
 src/java/org/apache/cassandra/hints/HintsDispatcher.java |  9 +++++++--
 src/java/org/apache/cassandra/hints/HintsService.java    | 11 ++++++-----
 4 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 1757266,e55d4cb..92ecb39
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,33 -1,8 +1,34 @@@
 -3.0.14
 - * Handling partially written hint files (CASSANDRA-12728) 
 +3.11.0
 + * V5 protocol flags decoding broken (CASSANDRA-13443)
 + * Use write lock not read lock for removing sstables from compaction strategies. (CASSANDRA-13422)
 + * Use corePoolSize equal to maxPoolSize in JMXEnabledThreadPoolExecutors (CASSANDRA-13329)
 + * Avoid rebuilding SASI indexes containing no values (CASSANDRA-12962)
 + * Add charset to Analyser input stream (CASSANDRA-13151)
 + * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
 + * cdc column addition strikes again (CASSANDRA-13382)
 + * Fix static column indexes (CASSANDRA-13277)
 + * DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
 + * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370)
 + * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247)
 + * Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317)
 + * Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366)
 + * Support unaligned memory access for AArch64 (CASSANDRA-13326)
 + * Improve SASI range iterator efficiency on intersection with an empty range (CASSANDRA-12915).
 + * Fix equality comparisons of columns using the duration type (CASSANDRA-13174)
 + * Obfuscate password in stress-graphs (CASSANDRA-12233)
 + * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
 + * nodetool stopdaemon errors out (CASSANDRA-13030)
 + * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
 + * Fix primary index calculation for SASI (CASSANDRA-12910)
 + * More fixes to the TokenAllocator (CASSANDRA-12990)
 + * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
 + * Address message coalescing regression (CASSANDRA-12676)
 + * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417)
 + * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
 +Merged from 3.0:
+  * Interrupt replaying hints on decommission (CASSANDRA-13308)
 -
 -3.0.13
 + * Handling partially written hint files (CASSANDRA-12728)
 + * Fix NPE issue in StorageService (CASSANDRA-13060)
   * Make reading of range tombstones more reliable (CASSANDRA-12811)
   * Fix startup problems due to schema tables not completely flushed (CASSANDRA-12213)
   * Fix view builder bug that can filter out data on restart (CASSANDRA-13405)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/hints/HintsDispatcher.java
index 3ac77a3,351b3fa..c432553
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@@ -26,9 -26,11 +26,11 @@@ import java.util.function.BooleanSuppli
  import java.util.function.Function;
  
  import com.google.common.util.concurrent.RateLimiter;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
  
 -import org.apache.cassandra.config.DatabaseDescriptor;
 -import org.apache.cassandra.gms.FailureDetector;
 +import org.apache.cassandra.exceptions.RequestFailureReason;
 +import org.apache.cassandra.metrics.HintsServiceMetrics;
  import org.apache.cassandra.net.IAsyncCallbackWithFailure;
  import org.apache.cassandra.net.MessageIn;
  import org.apache.cassandra.net.MessagingService;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/src/java/org/apache/cassandra/hints/HintsService.java
----------------------------------------------------------------------


[4/6] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by jj...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5f644548
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5f644548
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5f644548

Branch: refs/heads/trunk
Commit: 5f6445480341fbcbf15cdf36f4dda5f1b1a93102
Parents: 9c54d02 5089e74
Author: Jeff Jirsa <je...@jeffjirsa.net>
Authored: Wed Apr 19 08:58:02 2017 -0700
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Wed Apr 19 08:58:45 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/hints/HintsDispatchExecutor.java    |  8 ++++++++
 src/java/org/apache/cassandra/hints/HintsDispatcher.java |  9 +++++++--
 src/java/org/apache/cassandra/hints/HintsService.java    | 11 ++++++-----
 4 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 1757266,e55d4cb..92ecb39
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,33 -1,8 +1,34 @@@
 -3.0.14
 - * Handling partially written hint files (CASSANDRA-12728) 
 +3.11.0
 + * V5 protocol flags decoding broken (CASSANDRA-13443)
 + * Use write lock not read lock for removing sstables from compaction strategies. (CASSANDRA-13422)
 + * Use corePoolSize equal to maxPoolSize in JMXEnabledThreadPoolExecutors (CASSANDRA-13329)
 + * Avoid rebuilding SASI indexes containing no values (CASSANDRA-12962)
 + * Add charset to Analyser input stream (CASSANDRA-13151)
 + * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
 + * cdc column addition strikes again (CASSANDRA-13382)
 + * Fix static column indexes (CASSANDRA-13277)
 + * DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
 + * unittest CipherFactoryTest failed on MacOS (CASSANDRA-13370)
 + * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247)
 + * Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317)
 + * Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366)
 + * Support unaligned memory access for AArch64 (CASSANDRA-13326)
 + * Improve SASI range iterator efficiency on intersection with an empty range (CASSANDRA-12915).
 + * Fix equality comparisons of columns using the duration type (CASSANDRA-13174)
 + * Obfuscate password in stress-graphs (CASSANDRA-12233)
 + * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
 + * nodetool stopdaemon errors out (CASSANDRA-13030)
 + * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
 + * Fix primary index calculation for SASI (CASSANDRA-12910)
 + * More fixes to the TokenAllocator (CASSANDRA-12990)
 + * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
 + * Address message coalescing regression (CASSANDRA-12676)
 + * Delete illegal character from StandardTokenizerImpl.jflex (CASSANDRA-13417)
 + * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307)
 +Merged from 3.0:
+  * Interrupt replaying hints on decommission (CASSANDRA-13308)
 -
 -3.0.13
 + * Handling partially written hint files (CASSANDRA-12728)
 + * Fix NPE issue in StorageService (CASSANDRA-13060)
   * Make reading of range tombstones more reliable (CASSANDRA-12811)
   * Fix startup problems due to schema tables not completely flushed (CASSANDRA-12213)
   * Fix view builder bug that can filter out data on restart (CASSANDRA-13405)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/hints/HintsDispatcher.java
index 3ac77a3,351b3fa..c432553
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@@ -26,9 -26,11 +26,11 @@@ import java.util.function.BooleanSuppli
  import java.util.function.Function;
  
  import com.google.common.util.concurrent.RateLimiter;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
  
 -import org.apache.cassandra.config.DatabaseDescriptor;
 -import org.apache.cassandra.gms.FailureDetector;
 +import org.apache.cassandra.exceptions.RequestFailureReason;
 +import org.apache.cassandra.metrics.HintsServiceMetrics;
  import org.apache.cassandra.net.IAsyncCallbackWithFailure;
  import org.apache.cassandra.net.MessageIn;
  import org.apache.cassandra.net.MessagingService;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5f644548/src/java/org/apache/cassandra/hints/HintsService.java
----------------------------------------------------------------------


[2/6] cassandra git commit: Interrupt replaying hints on decommission

Posted by jj...@apache.org.
Interrupt replaying hints on decommission

Patch by Jeff Jirsa; Reviewed by Aleksey Yeschenko for CASSANDRA-13308


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5089e74e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5089e74e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5089e74e

Branch: refs/heads/cassandra-3.11
Commit: 5089e74ef4a0eaeb1c439d57f074de1c496421f2
Parents: 3110d27
Author: Jeff Jirsa <jj...@apple.com>
Authored: Wed Apr 19 08:26:02 2017 -0700
Committer: Jeff Jirsa <je...@jeffjirsa.net>
Committed: Wed Apr 19 08:57:45 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../apache/cassandra/hints/HintsDispatchExecutor.java    |  8 ++++++++
 src/java/org/apache/cassandra/hints/HintsDispatcher.java |  9 +++++++--
 src/java/org/apache/cassandra/hints/HintsService.java    | 11 ++++++-----
 4 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 918c46b..e55d4cb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 3.0.14
  * Handling partially written hint files (CASSANDRA-12728) 
+ * Interrupt replaying hints on decommission (CASSANDRA-13308)
 
 3.0.13
  * Make reading of range tombstones more reliable (CASSANDRA-12811)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
index 333232d..58b30bd 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
@@ -117,6 +117,14 @@ final class HintsDispatchExecutor
         }
     }
 
+    void interruptDispatch(UUID hostId)
+    {
+        Future future = scheduledDispatches.remove(hostId);
+
+        if (null != future)
+            future.cancel(true);
+    }
+
     private final class TransferHintsTask implements Runnable
     {
         private final HintsCatalog catalog;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsDispatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsDispatcher.java b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
index d7a3515..351b3fa 100644
--- a/src/java/org/apache/cassandra/hints/HintsDispatcher.java
+++ b/src/java/org/apache/cassandra/hints/HintsDispatcher.java
@@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Function;
 
 import com.google.common.util.concurrent.RateLimiter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.gms.FailureDetector;
@@ -42,6 +44,8 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
  */
 final class HintsDispatcher implements AutoCloseable
 {
+    private static final Logger logger = LoggerFactory.getLogger(HintsDispatcher.class);
+
     private enum Action { CONTINUE, ABORT }
 
     private final HintsReader reader;
@@ -181,7 +185,7 @@ final class HintsDispatcher implements AutoCloseable
 
     private static final class Callback implements IAsyncCallbackWithFailure
     {
-        enum Outcome { SUCCESS, TIMEOUT, FAILURE }
+        enum Outcome { SUCCESS, TIMEOUT, FAILURE, INTERRUPTED }
 
         private final long start = System.nanoTime();
         private final SimpleCondition condition = new SimpleCondition();
@@ -198,7 +202,8 @@ final class HintsDispatcher implements AutoCloseable
             }
             catch (InterruptedException e)
             {
-                throw new AssertionError(e);
+                logger.warn("Hint dispatch was interrupted", e);
+                return Outcome.INTERRUPTED;
             }
 
             return timedOut ? Outcome.TIMEOUT : outcome;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5089e74e/src/java/org/apache/cassandra/hints/HintsService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/HintsService.java b/src/java/org/apache/cassandra/hints/HintsService.java
index 5a32786..9cd4ed3 100644
--- a/src/java/org/apache/cassandra/hints/HintsService.java
+++ b/src/java/org/apache/cassandra/hints/HintsService.java
@@ -287,10 +287,11 @@ public final class HintsService implements HintsServiceMBean
     /**
      * Cleans up hints-related state after a node with id = hostId left.
      *
-     * Dispatcher should stop itself (isHostAlive() will start returning false for the leaving host), but we'll wait for
-     * completion anyway.
+     * Dispatcher can not stop itself (isHostAlive() can not start returning false for the leaving host because this
+     * method is called by the same thread as gossip, which blocks gossip), so we can't simply wait for
+     * completion.
      *
-     * We should also flush the buffer is there are any thints for the node there, and close the writer (if any),
+     * We should also flush the buffer if there are any hints for the node there, and close the writer (if any),
      * so that we don't leave any hint files lying around.
      *
      * Once that is done, we can simply delete all hint files and remove the host id from the catalog.
@@ -319,8 +320,8 @@ public final class HintsService implements HintsServiceMBean
             throw new RuntimeException(e);
         }
 
-        // wait for the current dispatch session to end (if any), so that the currently dispatched file gets removed
-        dispatchExecutor.completeDispatchBlockingly(store);
+        // interrupt the current dispatch session to end (if any), so that the currently dispatched file gets removed
+        dispatchExecutor.interruptDispatch(store.hostId);
 
         // delete all the hints files and remove the HintsStore instance from the map in the catalog
         catalog.exciseStore(hostId);