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

Andrés de la Peña commented on CASSANDRA-13963:
-----------------------------------------------

[Here|https://github.com/apache/cassandra/compare/trunk...adelapena:13963-trunk]
 is a patch solving the problem.

It seems that the call to [{{TestingIndex.shouldFailCreate = 
false;}}|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java#L466]
 is done right after creating the index configured to fail, without waiting for 
the finalization of the build task. If we are not lucky the index initalization 
task can start after disabling the configured fail. In such case, the two calls 
to {{assertFalse(cfs.indexManager.isIndexQueryable(index))}} can either succeed 
because the index build task hasn't started yet (not because it has failed), or 
fail because the task has successfully finished without the configured 
initialization task failure.

The unit tests usually use 
[{{CQLTester.waitForIndex}}|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/cql3/CQLTester.java#L709-L737]
 method to wait for the finalization of index builds. In that case, since we 
are making the initialization to fail, we can't rely on this method, so the 
patch adds a new 
[{{CQLTester.waitForIndexBuilds}}|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/cql3/CQLTester.java#L709-L737]
 method to wait for the finalization of index build tasks independently of 
their results and the marking procedure. This method is in {{CQLTester}} 
instead of {{SecondaryIndexManagerTest}} because I think it's suitable to be 
used by other tests. 

> SecondaryIndexManagerTest.indexWithfailedInitializationIsNotQueryableAfterPartialRebuild
>  is flaky
> -------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13963
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13963
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Secondary Indexes, Testing
>            Reporter: Andrés de la Peña
>            Assignee: Andrés de la Peña
>            Priority: Minor
>             Fix For: 4.x
>
>
> The unit test 
> [SecondaryIndexManagerTest.indexWithfailedInitializationIsNotQueryableAfterPartialRebuild|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/index/SecondaryIndexManagerTest.java#L460-L476]
>  is flaky. Apart from [the CI results showing a 3% 
> flakiness|http://cassci.datastax.com/view/All_Jobs/job/trunk_utest/2430/testReport/org.apache.cassandra.index/SecondaryIndexManagerTest/indexWithfailedInitializationIsNotQueryableAfterPartialRebuild/],
>  the test failure can be locally reproduced just running the test multiple 
> times. In my case, it fails 2-5 times for each 1000 executions.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to