mirror of https://github.com/apache/cassandra
Record CAS contention for write timeouts in prepare phase
Patch by Christopher Batey; Reviewed by Edward Capriolo for CASSANDRA-12626
This commit is contained in:
parent
747a62f607
commit
3bf043e4e4
|
|
@ -84,6 +84,7 @@
|
||||||
* Remove pre-startup check for open JMX port (CASSANDRA-12074)
|
* Remove pre-startup check for open JMX port (CASSANDRA-12074)
|
||||||
* Remove compaction Severity from DynamicEndpointSnitch (CASSANDRA-11738)
|
* Remove compaction Severity from DynamicEndpointSnitch (CASSANDRA-11738)
|
||||||
* Restore resumable hints delivery (CASSANDRA-11960)
|
* Restore resumable hints delivery (CASSANDRA-11960)
|
||||||
|
* Properly report LWT contention (CASSANDRA-12626)
|
||||||
Merged from 3.0:
|
Merged from 3.0:
|
||||||
* Improve avg aggregate functions (CASSANDRA-12417)
|
* Improve avg aggregate functions (CASSANDRA-12417)
|
||||||
* Preserve quoted reserved keyword column names in MV creation (CASSANDRA-11803)
|
* Preserve quoted reserved keyword column names in MV creation (CASSANDRA-11803)
|
||||||
|
|
|
||||||
|
|
@ -321,14 +321,19 @@ public class StorageProxy implements StorageProxyMBean
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if(contentions > 0)
|
recordCasContention(contentions);
|
||||||
casWriteMetrics.contention.update(contentions);
|
|
||||||
final long latency = System.nanoTime() - startTimeForMetrics;
|
final long latency = System.nanoTime() - startTimeForMetrics;
|
||||||
casWriteMetrics.addNano(latency);
|
casWriteMetrics.addNano(latency);
|
||||||
writeMetricsMap.get(consistencyForPaxos).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)
|
private static Predicate<InetAddress> sameDCPredicateFor(final String dc)
|
||||||
{
|
{
|
||||||
final IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
|
final IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
|
||||||
|
|
@ -439,6 +444,7 @@ public class StorageProxy implements StorageProxyMBean
|
||||||
}
|
}
|
||||||
catch (WriteTimeoutException e)
|
catch (WriteTimeoutException e)
|
||||||
{
|
{
|
||||||
|
recordCasContention(contentions);
|
||||||
// We're still doing preparation for the paxos rounds, so we want to use the CAS (see CASSANDRA-8672)
|
// 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);
|
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);
|
return Pair.create(ballot, contentions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recordCasContention(contentions);
|
||||||
throw new WriteTimeoutException(WriteType.CAS, consistencyForPaxos, 0, consistencyForPaxos.blockFor(Keyspace.open(metadata.ksName)));
|
throw new WriteTimeoutException(WriteType.CAS, consistencyForPaxos, 0, consistencyForPaxos.blockFor(Keyspace.open(metadata.ksName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue