cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jji...@apache.org
Subject [2/3] cassandra git commit: Record CAS contention for write timeouts in prepare phase
Date Wed, 19 Oct 2016 00:32:39 GMT
Record CAS contention for write timeouts in prepare phase

Patch by Christopher Batey; Reviewed by Edward Capriolo for CASSANDRA-12626


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

Branch: refs/heads/trunk
Commit: 3bf043e4e4790b0d6ef5cfe12ff80f813945a302
Parents: 747a62f
Author: Christopher Batey <christopher.batey@gmail.com>
Authored: Sat Sep 10 18:35:37 2016 +0100
Committer: Jeff Jirsa <jeff.jirsa@crowdstrike.com>
Committed: Tue Oct 18 17:27:42 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 src/java/org/apache/cassandra/service/StorageProxy.java | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3bf043e4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a5b0add..dc98ca7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -84,6 +84,7 @@
  * Remove pre-startup check for open JMX port (CASSANDRA-12074)
  * Remove compaction Severity from DynamicEndpointSnitch (CASSANDRA-11738)
  * Restore resumable hints delivery (CASSANDRA-11960)
+ * Properly report LWT contention (CASSANDRA-12626)
 Merged from 3.0:
  * Improve avg aggregate functions (CASSANDRA-12417)
  * Preserve quoted reserved keyword column names in MV creation (CASSANDRA-11803)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3bf043e4/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index 5ad19e0..529e4e3 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -321,14 +321,19 @@ public class StorageProxy implements StorageProxyMBean
         }
         finally
         {
-            if(contentions > 0)
-                casWriteMetrics.contention.update(contentions);
+            recordCasContention(contentions);
             final long latency = System.nanoTime() - startTimeForMetrics;
             casWriteMetrics.addNano(latency);
             writeMetricsMap.get(consistencyForPaxos).addNano(latency);
         }
     }
 
+    private static void recordCasContention(int contentions)
+    {
+        if(contentions > 0)
+            casWriteMetrics.contention.update(contentions);
+    }
+
     private static Predicate<InetAddress> sameDCPredicateFor(final String dc)
     {
         final IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
@@ -439,6 +444,7 @@ public class StorageProxy implements StorageProxyMBean
                     }
                     catch (WriteTimeoutException e)
                     {
+                        recordCasContention(contentions);
                         // We're still doing preparation for the paxos rounds, so we want
to use the CAS (see CASSANDRA-8672)
                         throw new WriteTimeoutException(WriteType.CAS, e.consistency, e.received,
e.blockFor);
                     }
@@ -473,6 +479,7 @@ public class StorageProxy implements StorageProxyMBean
             return Pair.create(ballot, contentions);
         }
 
+        recordCasContention(contentions);
         throw new WriteTimeoutException(WriteType.CAS, consistencyForPaxos, 0, consistencyForPaxos.blockFor(Keyspace.open(metadata.ksName)));
     }
 


Mime
View raw message