Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 317AC200BC8 for ; Wed, 19 Oct 2016 02:32:40 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3084F160AF7; Wed, 19 Oct 2016 00:32:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7F1CC160AFB for ; Wed, 19 Oct 2016 02:32:39 +0200 (CEST) Received: (qmail 77981 invoked by uid 500); 19 Oct 2016 00:32:38 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 77965 invoked by uid 99); 19 Oct 2016 00:32:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 00:32:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 17A15E098D; Wed, 19 Oct 2016 00:32:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jjirsa@apache.org To: commits@cassandra.apache.org Date: Wed, 19 Oct 2016 00:32:39 -0000 Message-Id: <9a8b1ad3ec8c44af9fc2e4951669417f@git.apache.org> In-Reply-To: <420317a62c7741b4b43c6043d1e61005@git.apache.org> References: <420317a62c7741b4b43c6043d1e61005@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] cassandra git commit: Record CAS contention for write timeouts in prepare phase archived-at: Wed, 19 Oct 2016 00:32:40 -0000 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 Authored: Sat Sep 10 18:35:37 2016 +0100 Committer: Jeff Jirsa 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 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))); }