[ 
https://issues.apache.org/jira/browse/CASSANDRA-16714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksandr Sorokoumov updated CASSANDRA-16714:
---------------------------------------------
    Test and Documentation Plan: 
{{SlidingTimeRateTest}} fails if the executor runs with a higher thread count, 
and the run is lucky enough to get a near-uniform work distribution.

I was able to reproduce the issue by decreasing {{updates}} to 10000 and adding 
a sleep statement after {{rate.update(1)}}:
{noformat}
            executor.submit(() -> {
                threadCnt.computeIfAbsent(Thread.currentThread().getId(), (n) 
-> new AtomicInteger())
                         .incrementAndGet();
                time.sleep(1, TimeUnit.MILLISECONDS);
                rate.update(1);
                try
                {
                    Thread.sleep(2);
                }
                catch (InterruptedException ie) {}
            });
{noformat}

In the snippet above I've also added a per-thread increment to measure work 
distribution. The results are:

Without sleep (test passes):
{noformat}
{16=1752, 17=1441, 18=420, 19=1434, 20=468, 21=1259, 22=582, 23=568, 24=670, 
13=387, 14=508, 15=511}
{noformat}

With sleep (test fails):
{noformat}
{16=833, 17=834, 18=835, 19=833, 20=833, 21=833, 22=833, 23=833, 24=834, 
13=833, 14=833, 15=833}
{noformat}

As a result of the uniform work distribution, concurrent updates hit same 
timestamp more frequently which in turn makes the test run quicker in 
{{TestTimeSource}} terms with more hits per timestamp. 

I suggest to set thread pool size to, say, 4 as well as to increase tolerated 
delta to 150. The former will limit the impact of the work distribution effect  
while the latter sets more realistic boundaries on the possible values 
([patch|https://github.com/apache/cassandra/compare/trunk...Gerrrr:16714-3.11?expand=1]).
 
                         Status: Patch Available  (was: In Progress)

> Fix org.apache.cassandra.utils.SlidingTimeRateTest.testConcurrentUpdateAndGet
> -----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-16714
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16714
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/unit
>            Reporter: Ekaterina Dimitrova
>            Assignee: Aleksandr Sorokoumov
>            Priority: Normal
>             Fix For: 3.11.x
>
>
> Fix org.apache.cassandra.utils.SlidingTimeRateTest.testConcurrentUpdateAndGet 
> in Cassandra 3.11 
> [https://jenkins-cm4.apache.org/job/Cassandra-3.11/174/testReport/junit/org.apache.cassandra.utils/SlidingTimeRateTest/testConcurrentUpdateAndGet_cdc/]
> We should also propagate the fix to 4.0 where the utility class and the tests 
> also exist but they are not currently in use so to remove the noise the tests 
> are currently skipped from running at the moment. For reference - 
> CASSANDRA-16713
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to