maedhroz commented on code in PR #3543:
URL: https://github.com/apache/cassandra/pull/3543#discussion_r1778950576
##########
test/unit/org/apache/cassandra/metrics/DecayingEstimatedHistogramReservoirTest.java:
##########
@@ -604,6 +616,110 @@ public void testSize()
assertEquals(2, toSnapshot.apply(histogram).size());
}
+ /**
+ * This looks for invalid percentiles that are unchanged for too long
to expose the CASSANDRA-19365 race
+ * condition between rescale and update. The idea is to update a
histogram from multiple threads and observe
+ * if the reported p99 doesn't get stuck at a low value or p50 at a
high value due to update with high weight
+ * being inserted after the buckets are rescaled.
+ * <p>
+ * The load has 95% of 42, and 5% of the time it's 1109. Despite that
the histogram may be convinced for a long
+ * time that p99 is 42 or that p50 is 1109. The reason may be seen in
the snapshot dump, where after rescale
+ * the bucket values may get very big due to the race condition and
too big weight of the inserted samples.
+ * The values were picked to match bucket boundaries, but that's only
for aesthetics.
+ * <p>
+ * In production the rescale happens every 30 minutes. In this test
time we're pushing time to run faster,
+ * roughly 1000 times faster to hit the race condition in a reasonable
time.
+ */
+ @Test
+ public void testConcurrentUpdateAndRescale() throws
InterruptedException
+ {
+ int UPDATE_THREADS = 60;
+ int maxTestDurationMillis = 60_000;
Review Comment:
Two 60-second tests (w/ parameterization) is a fair amount of overhead.
Would it be possible to get most of the value out of this with something
slightly shorter...30 seconds perhaps?
--
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]