netudima commented on code in PR #4841:
URL: https://github.com/apache/cassandra/pull/4841#discussion_r3323705820
##########
test/unit/org/apache/cassandra/metrics/TableMetricsTest.java:
##########
@@ -213,6 +213,65 @@ public void testPreparedStatementsExecuted()
assertGreaterThan(cfs.metric.coordinatorWriteLatency.getMeanRate(), 0);
}
+ @Test
+ public void testRowsMutatedCounter()
+ {
+ ColumnFamilyStore cfs = recreateTable();
+ assertEquals(0, cfs.metric.rowsMutated.getCount());
+
+ // Each INSERT touches exactly one row
+ session.execute(String.format("INSERT INTO %s.%s (id, val1, val2)
VALUES (1, 'a', 'b')", KEYSPACE, TABLE));
+ assertEquals(1, cfs.metric.rowsMutated.getCount());
+
+ session.execute(String.format("INSERT INTO %s.%s (id, val1, val2)
VALUES (2, 'c', 'd')", KEYSPACE, TABLE));
+ assertEquals(2, cfs.metric.rowsMutated.getCount());
+
+ // Batch of 3 rows — counter should jump by 3
+ executeBatch(false, 3, 1);
+ assertEquals(5, cfs.metric.rowsMutated.getCount());
+
+ assertRowsContains(cluster, session.execute("SELECT * FROM
system_metrics.table_group"),
Review Comment:
nit: we can make an utility method for this repeating logic to make it more
compact and readable
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]