cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #445: CASSANDRA-15569 StorageProxy updateCoordinatorWriteLatencyTableMetric can produce misleading metrics
Date Wed, 12 Feb 2020 22:13:48 GMT
dcapwell commented on a change in pull request #445: CASSANDRA-15569 StorageProxy updateCoordinatorWriteLatencyTableMetric
can produce misleading metrics
URL: https://github.com/apache/cassandra/pull/445#discussion_r378543777
 
 

 ##########
 File path: test/unit/org/apache/cassandra/metrics/TableMetricsTest.java
 ##########
 @@ -87,31 +95,39 @@ private void executeBatch(boolean isLogged, int distinctPartitions, int
statemen
 
         BatchStatement batch = new BatchStatement(batchType);
 
+        for (String table : tables)
+            populateBatch(batch, table, distinctPartitions, statementsPerPartition);
+
+        session.execute(batch);
+    }
+
+    private static void populateBatch(BatchStatement batch, String table, int distinctPartitions,
int statementsPerPartition)
+    {
+        PreparedStatement ps = session.prepare(String.format("INSERT INTO %s.%s (id, val1,
val2) VALUES (?, ?, ?);", KEYSPACE, table));
+
         for (int i=0; i<distinctPartitions; i++)
         {
             for (int j=0; j<statementsPerPartition; j++)
             {
                 batch.add(ps.bind(i, j + "a", "b"));
             }
         }
-
-        session.execute(batch);
     }
 
     @Test
     public void testRegularStatementsExecuted()
     {
         ColumnFamilyStore cfs = recreateTable();
         assertEquals(0, cfs.metric.coordinatorWriteLatency.getCount());
-        assertTrue(cfs.metric.coordinatorWriteLatency.getMeanRate() == 0);
+        assertEquals(0.0, cfs.metric.coordinatorWriteLatency.getMeanRate(), 0.0);
 
 Review comment:
   the reason for this change is `assertTrue` has really bad error messages; with `assertEquals`
we know what the mean rate will be

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message