Repository: cassandra
Updated Branches:
  refs/heads/trunk bbc3834b1 -> 49278480d


Avoid throwing WTE during commitlog replay due to MV lock contention

Patch by Tyler Hobbs; reviewed by Jake Luciani for CASSANDRA-11891


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

Branch: refs/heads/trunk
Commit: 5794fb3556a07a662a8a79cfd692eaa459e9066b
Parents: 764f3d3
Author: Tyler Hobbs <tylerlho...@gmail.com>
Authored: Thu May 26 11:28:09 2016 -0500
Committer: Tyler Hobbs <tylerlho...@gmail.com>
Committed: Thu May 26 11:28:09 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                    |  2 ++
 src/java/org/apache/cassandra/db/Keyspace.java | 12 +++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5794fb35/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 75ce90d..97893c9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 3.0.7
+ * Avoid WriteTimeoutExceptions during commit log replay due to materialized
+   view lock contention (CASSANDRA-11891)
  * Prevent OOM failures on SSTable corruption, improve tests for corruption 
detection (CASSANDRA-9530)
  * Use CFS.initialDirectories when clearing snapshots (CASSANDRA-11705)
  * Allow compaction strategies to disable early open (CASSANDRA-11754)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5794fb35/src/java/org/apache/cassandra/db/Keyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Keyspace.java 
b/src/java/org/apache/cassandra/db/Keyspace.java
index 5865364..8b23186 100644
--- a/src/java/org/apache/cassandra/db/Keyspace.java
+++ b/src/java/org/apache/cassandra/db/Keyspace.java
@@ -423,7 +423,8 @@ public class Keyspace
 
             if (lock == null)
             {
-                if ((System.currentTimeMillis() - mutation.createdAt) > 
DatabaseDescriptor.getWriteRpcTimeout())
+                // avoid throwing a WTE during commitlog replay
+                if (!isClReplay && (System.currentTimeMillis() - 
mutation.createdAt) > DatabaseDescriptor.getWriteRpcTimeout())
                 {
                     logger.trace("Could not acquire lock for {}", 
ByteBufferUtil.bytesToHex(mutation.key().getKey()));
                     Tracing.trace("Could not acquire MV lock");
@@ -436,12 +437,9 @@ public class Keyspace
                 {
                     //This view update can't happen right now. so rather than 
keep this thread busy
                     // we will re-apply ourself to the queue and try again 
later
-                    StageManager.getStage(Stage.MUTATION).execute(() -> {
-                        if (writeCommitLog)
-                            apply(mutation, true, true, isClReplay, mark);
-                        else
-                            apply(mutation, false, true, isClReplay, mark);
-                    });
+                    StageManager.getStage(Stage.MUTATION).execute(() ->
+                        apply(mutation, writeCommitLog, true, isClReplay, mark)
+                    );
 
                     return mark;
                 }

Reply via email to