From aca6e6d3ddf205e0121153cafc1a7ae265a69f73 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Tue, 6 Oct 2026 18:40:46 +0100 Subject: [PATCH 1/2] Resolve flaky test `RankIndexTest.concurrentMutationsToRankIndex` by disabling unsafe concurrency mode This updates the tset `RankIndexTest.concurrentMutationsToRankIndex` so that it does not attempt to insert multiple entries into the rank index if the concurrency manager on the store is diabled. The rank index is not currently expected to supported concurrent updates at the moment. We could attempt to better enumerate the classes of failures that concurrent updates might attempt to do, but this seems like a bit of wild-goose chase, so instead, this just modifies the scenarios for the test to avoid the case we don't support (yet). Once we do support it, we can modify the parameters back. --- .../foundationdb/indexes/RankIndexTest.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java index 7494e0c761f..3515086bc63 100644 --- a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java +++ b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java @@ -83,6 +83,7 @@ import com.google.protobuf.Message; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Named; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -334,7 +335,15 @@ void checkRanks() throws Exception { @Nonnull static Stream concurrentMutationsToRankIndex() { - return ParameterizedTestUtils.cartesianProduct(Stream.of(1, 10, 100), ParameterizedTestUtils.booleans("disableConcurrencyManagement")); + // Rank indexes don't have support for true concurrent updates, i.e., they rely on the + // store's concurrency manager preventing multiple updates to the same index. So for now, + // only run with a concurrency > 1 if the store does not disable the concurrency manager. + return Stream.of( + Arguments.of(1, Named.of("!disableConcurrencyManagement", false)), + Arguments.of(10, Named.of("!disableConcurrencyManagement", false)), + Arguments.of(100, Named.of("!disableConcurrencyManagement", false)), + Arguments.of(1, Named.of("disableConcurrencyManagement", true)) + ); } /** @@ -382,15 +391,11 @@ void concurrentMutationsToRankIndex(int concurrency, boolean disableConcurrencyM .toList(); final RecordFunction rank = Query.rank("score").getFunction(); - // Validate records are internally consistent. That is not guaranteed by the rank index at the moment, - // so if the store's concurrency manager is disabled and there were concurrent writes, so skip this check - // in that case - if (!disableConcurrencyManagement || concurrency == 1) { - try (FDBRecordContext context = openContext()) { - openRecordStore(context); - recordStore = recordStore.asBuilder().setDisableConcurrencyManagement(disableConcurrencyManagement).open(); - checkRankConcurrently(rank, sortedRecords, concurrency); - } + // Validate records are internally consistent. + try (FDBRecordContext context = openContext()) { + openRecordStore(context); + recordStore = recordStore.asBuilder().setDisableConcurrencyManagement(disableConcurrencyManagement).open(); + checkRankConcurrently(rank, sortedRecords, concurrency); } // Rebuild the index and try again. This time, the index should be corrected and return the right information try (FDBRecordContext context = openContext()) { From 61090dd5b62cfb29fd20951dfc8398f18be84ec3 Mon Sep 17 00:00:00 2001 From: Alec Grieser Date: Wed, 7 Oct 2026 10:27:40 +0100 Subject: [PATCH 2/2] remove unused import --- .../record/provider/foundationdb/indexes/RankIndexTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java index 3515086bc63..70b74204e88 100644 --- a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java +++ b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java @@ -71,7 +71,6 @@ import com.apple.foundationdb.record.query.plan.plans.RecordQueryPlan; import com.apple.foundationdb.record.util.pair.Pair; import com.apple.foundationdb.tuple.Tuple; -import com.apple.test.ParameterizedTestUtils; import com.apple.test.Tags; import com.google.common.collect.Collections2; import com.google.common.collect.HashMultiset;