Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


  [ant:checkstyle] [ERROR] /home/runner/work/fdb-record-layer/fdb-record-layer/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java:74:8: Unused import - com.apple.test.ParameterizedTestUtils. [UnusedImports]
  > Task :fdb-record-layer-core:checkstyleMandatory
  
  > Task :fdb-record-layer-core:checkstyleMandatory FAILED
  [ant:checkstyle] [ERROR] /home/runner/work/fdb-record-layer/fdb-record-layer/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/indexes/RankIndexTest.java:74:8: Unused import - com.apple.test.ParameterizedTestUtils. [UnusedImports]

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -83,6 +82,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;
Expand Down Expand Up @@ -334,7 +334,15 @@ void checkRanks() throws Exception {

@Nonnull
static Stream<Arguments> 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))
);
}

/**
Expand Down Expand Up @@ -382,15 +390,11 @@ void concurrentMutationsToRankIndex(int concurrency, boolean disableConcurrencyM
.toList();
final RecordFunction<Long> 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()) {
Expand Down
Loading