[ 
https://issues.apache.org/jira/browse/CASSANDRA-18710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17786446#comment-17786446
 ] 

Jacek Lewandowski commented on CASSANDRA-18710:
-----------------------------------------------

The problem with small flush affecting the test case in question can be easily 
reliably reproduced by adding the following delays:

in DiskSizeMetricsTest:
{code:java}
private void insertN(String keyspace, ColumnFamilyStore cfs, int n, long base) 
throws Throwable
{
    for (int i = 0; i < n; i++)
    {
        Thread.sleep(1);  // <------------ HERE
        executeFormattedQuery(formatQuery(keyspace, "INSERT INTO %s (pk) VALUES 
(?)"), base + i);
    }

    // flush to write the sstable
    cfs.forceBlockingFlush();
}
{code}

in CQLTester:
{code:java}
@After
public void afterTest() throws Throwable
{
    dropPerTestKeyspace();
...
    // We want to clean up after the test, but dropping a table is rather long 
so just do that asynchronously
    ScheduledExecutors.optionalTasks.execute(new Runnable()
    {
        public void run()
        {
            try
            {
                Thread.sleep(500); // <----------------- HERE
                for (int i = tablesToDrop.size() - 1; i >= 0; i--)
                    schemaChange(String.format("DROP TABLE IF EXISTS %s.%s", 
KEYSPACE, tablesToDrop.get(i)));
{code}

Then run the whole test class (not just the test case)


> Test failure: 
> org.apache.cassandra.io.DiskSpaceMetricsTest.testFlushSize-.jdk17 (from 
> org.apache.cassandra.io.DiskSpaceMetricsTest-.jdk17)
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-18710
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18710
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/unit
>            Reporter: Ekaterina Dimitrova
>            Assignee: Jacek Lewandowski
>            Priority: Normal
>             Fix For: 5.0-beta, 5.0.x, 5.x
>
>         Attachments: org.apache.cassandra.io.DiskSpaceMetricsTest.txt
>
>
> Seen here:
> [https://ci-cassandra.apache.org/job/Cassandra-trunk/1644/testReport/org.apache.cassandra.io/DiskSpaceMetricsTest/testFlushSize__jdk17/]
> h3.  
> {code:java}
> Error Message
> expected:<7200.0> but was:<1367.83970468544>
> Stacktrace
> junit.framework.AssertionFailedError: expected:<7200.0> but 
> was:<1367.83970468544> at 
> org.apache.cassandra.io.DiskSpaceMetricsTest.testFlushSize(DiskSpaceMetricsTest.java:119)
>  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method) at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>  at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to