You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test failure in RankIndexTest::repeatedRankQuery #482
During one pull request build, at least one PR unrelated to rank indexes has encountered an error performing the RankIndexTest::repeatedRankQuery test. Here's the test output:
com.apple.foundationdb.record.provider.foundationdb.RankIndexTest > repeatedRankQuery() FAILED
org.opentest4j.AssertionFailedError: expected: <[achilles, patroclus, hector, patroclus, hector, hector, achilles, hector, achilles, hector, patroclus]> but was: <[achilles, patroclus, hector, patroclus, hector, hector, achilles, hector, achilles, hector, patroclus, achilles, hector]>
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:52)
at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:186)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:181)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:486)
at com.apple.foundationdb.record.provider.foundationdb.RankIndexTest.repeatedRankQuery(RankIndexTest.java:746)
I suspect that there's something subtle going on in the RankedSet. This is classified here as a test failing, but it could also be the sign of some subtle race condition rather than a testing failure.
I managed to reproduce this locally. I then reopened the store after the test failed, and it fails reliably, so it is whatever is in the index.
For reference the code that inserts these record looks like:
Yeah, so it looks like the test failure during the query was caused by a corrupt index, and the index is corrupted because the ranked set is not thread safe. This is only a problem if you have multiple keys being inserted with the same grouping key, so our (somewhat contrived) example of a FanOut index on a field with no grouping keys is sufficient. Hopefully, most real use cases on a FanOut index are doing something like adding a grouping column. However, if they didn't they might need to rebuild their indexes.
Activity
alecgrieser commentedon Mar 24, 2019
I suspect that there's something subtle going on in the
RankedSet. This is classified here as a test failing, but it could also be the sign of some subtle race condition rather than a testing failure.MMcM commentedon Mar 25, 2020
Happened again with #870
ScottDugas commentedon Apr 20, 2020
I managed to reproduce this locally. I then reopened the store after the test failed, and it fails reliably, so it is whatever is in the index.
For reference the code that inserts these record looks like:
Code: (for reference)
When I open it back up and scan the index/records in different ways I get:
By Value:
By Rank: (rank value manually added)
Records:
Which results in the assertion error:
ScottDugas commentedon Apr 20, 2020
I ran the ranked set consistency checker, but I'm not sure how to interpret it, adding it here for others' benefit:
alecgrieser commentedon Apr 20, 2020
That certainly looks bad. Like L1 and L5 disagree with all the intermediate levels
alecgrieser commentedon Apr 20, 2020
Oh,
RankIndexMaintainerqueues its ranked index updates in parallel, and that operation isn't thread safe (on the same ranked set).alecgrieser commentedon Apr 21, 2020
Yeah, so it looks like the test failure during the query was caused by a corrupt index, and the index is corrupted because the ranked set is not thread safe. This is only a problem if you have multiple keys being inserted with the same grouping key, so our (somewhat contrived) example of a
FanOutindex on a field with no grouping keys is sufficient. Hopefully, most real use cases on aFanOutindex are doing something like adding a grouping column. However, if they didn't they might need to rebuild their indexes.Fixes FoundationDB#482: Test failure in RankIndexTest::repeatedRankQuery
A repro for FoundationDB#482
A repro for FoundationDB#482
Merge pull request #914 from alecgrieser/00482-rank-index-concurrent-…