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/1092f5e7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1092f5e7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1092f5e7

Branch: refs/heads/cassandra-3.11
Commit: 1092f5e717dd6a6165df21df04ee17c4a8a96eb6
Parents: c3d3e1a 1dcb313
Author: Jeff Jirsa <j...@jeffjirsa.net>
Authored: Fri Mar 17 15:26:45 2017 -0700
Committer: Jeff Jirsa <j...@jeffjirsa.net>
Committed: Fri Mar 17 15:27:18 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 .../cassandra/metrics/DroppedMessageMetrics.java   |  6 +++++-
 .../org/apache/cassandra/net/MessagingService.java | 17 ++++++++++++++++-
 .../apache/cassandra/net/MessagingServiceTest.java |  3 +++
 4 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1092f5e7/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 24e8c5f,97d8561..44321ef
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,16 -1,5 +1,17 @@@
 -3.0.13
 +3.11.0
 + * 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)
 +Merged from 3.0:
+  * Applying: Use a unique metric reservoir per test run when using 
Cassandra-wide metrics residing in MBeans (CASSANDRA-13216)
   * Propagate row deletions in 2i tables on upgrade (CASSANDRA-13320)
   * Slice.isEmpty() returns false for some empty slices (CASSANDRA-13305)
   * Add formatted row output to assertEmpty in CQL Tester (CASSANDRA-13238)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1092f5e7/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
index 2a94c9f,6d16f8b..794fa9c
--- a/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/DroppedMessageMetrics.java
@@@ -32,17 -30,13 +32,21 @@@ public class DroppedMessageMetric
      /** Number of dropped messages */
      public final Meter dropped;
  
 +    /** The dropped latency within node */
 +    public final Timer internalDroppedLatency;
 +
 +    /** The cross node dropped latency */
 +    public final Timer crossNodeDroppedLatency;
 +
      public DroppedMessageMetrics(MessagingService.Verb verb)
      {
-         MetricNameFactory factory = new DefaultNameFactory("DroppedMessage", 
verb.toString());
+         this(new DefaultNameFactory("DroppedMessage", verb.toString()));
+     }
+ 
+     public DroppedMessageMetrics(MetricNameFactory factory)
+     {
          dropped = Metrics.meter(factory.createMetricName("Dropped"));
 +        internalDroppedLatency = 
Metrics.timer(factory.createMetricName("InternalDroppedLatency"));
 +        crossNodeDroppedLatency = 
Metrics.timer(factory.createMetricName("CrossNodeDroppedLatency"));
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1092f5e7/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/net/MessagingService.java
index 25285e5,e8095d3..e377722
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@@ -70,9 -65,9 +70,10 @@@ import org.apache.cassandra.io.util.Dat
  import org.apache.cassandra.io.util.DataOutputPlus;
  import org.apache.cassandra.io.util.FileUtils;
  import org.apache.cassandra.locator.ILatencySubscriber;
+ import org.apache.cassandra.metrics.CassandraMetricsRegistry;
  import org.apache.cassandra.metrics.ConnectionMetrics;
  import org.apache.cassandra.metrics.DroppedMessageMetrics;
 +import org.apache.cassandra.metrics.MessagingMetrics;
  import org.apache.cassandra.repair.messages.RepairMessage;
  import org.apache.cassandra.security.SSLFactory;
  import org.apache.cassandra.service.*;
@@@ -431,12 -339,26 +432,26 @@@ public final class MessagingService imp
  
          DroppedMessages(Verb verb)
          {
-             this.metrics = new DroppedMessageMetrics(verb);
+             this(new DroppedMessageMetrics(verb));
+         }
+ 
+         DroppedMessages(DroppedMessageMetrics metrics)
+         {
+             this.metrics = metrics;
 -            this.droppedInternalTimeout = new AtomicInteger(0);
 -            this.droppedCrossNodeTimeout = new AtomicInteger(0);
 +            this.droppedInternal = new AtomicInteger(0);
 +            this.droppedCrossNode = new AtomicInteger(0);
          }
+     }
  
+     @VisibleForTesting
+     public void resetDroppedMessagesMap(String scope)
+     {
+         for (Verb verb : droppedMessagesMap.keySet())
+             droppedMessagesMap.put(verb, new DroppedMessages(new 
DroppedMessageMetrics(metricName -> {
+                 return new 
CassandraMetricsRegistry.MetricName("DroppedMessages", metricName, scope);
+             })));
      }
+ 
      // total dropped message counts for server lifetime
      private final Map<Verb, DroppedMessages> droppedMessagesMap = new 
EnumMap<>(Verb.class);
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1092f5e7/test/unit/org/apache/cassandra/net/MessagingServiceTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/net/MessagingServiceTest.java
index 11d17b8,3be1990..c1dcfc5
--- a/test/unit/org/apache/cassandra/net/MessagingServiceTest.java
+++ b/test/unit/org/apache/cassandra/net/MessagingServiceTest.java
@@@ -50,24 -29,13 +50,27 @@@ import static org.junit.Assert.*
  
  public class MessagingServiceTest
  {
 +    private final static long ONE_SECOND = TimeUnit.NANOSECONDS.convert(1, 
TimeUnit.SECONDS);
 +    private final static long[] bucketOffsets = new 
EstimatedHistogram(160).getBucketOffsets();
      private final MessagingService messagingService = MessagingService.test();
  
 +    @BeforeClass
 +    public static void beforeClass() throws UnknownHostException
 +    {
 +        DatabaseDescriptor.daemonInitialization();
 +        DatabaseDescriptor.setBackPressureStrategy(new 
MockBackPressureStrategy(Collections.emptyMap()));
 +        
DatabaseDescriptor.setBroadcastAddress(InetAddress.getByName("127.0.0.1"));
 +    }
 +
+     private static int metricScopeId = 0;
+ 
      @Before
 -    public void before() {
 -        
messagingService.resetDroppedMessagesMap(Integer.toString(metricScopeId++));;
 +    public void before() throws UnknownHostException
 +    {
++        
messagingService.resetDroppedMessagesMap(Integer.toString(metricScopeId++));
 +        MockBackPressureStrategy.applied = false;
 +        
messagingService.destroyConnectionPool(InetAddress.getByName("127.0.0.2"));
 +        
messagingService.destroyConnectionPool(InetAddress.getByName("127.0.0.3"));
      }
  
      @Test

Reply via email to