Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

[Fix develop] Fix a potential deadlock in SweepQueueReader #5225

Merged
merged 3 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.palantir.atlasdb.sweep.metrics.TargetedSweepMetrics;
import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter;
import com.palantir.atlasdb.sweep.queue.SweepQueue;
import com.palantir.atlasdb.sweep.queue.SweepQueueReader.ReadBatchingRuntimeContext;
import com.palantir.atlasdb.sweep.queue.SweepQueueReader;
import com.palantir.atlasdb.sweep.queue.TargetedSweeper;
import com.palantir.atlasdb.transaction.api.Transaction;
import com.palantir.atlasdb.transaction.impl.AbstractSerializableTransactionTest;
Expand Down Expand Up @@ -74,7 +74,7 @@ protected MultiTableSweepQueueWriter getSweepQueueWriterInitialized() {
keyValueService,
timelockService,
() -> 128,
ReadBatchingRuntimeContext.DEFAULT);
SweepQueueReader.DEFAULT_READ_BATCHING_RUNTIME_CONTEXT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ SweepBatchWithPartitionInfo getNextBatchToSweep(ShardAndStrategy shardStrategy,
return accumulator.toSweepBatch();
}

public static final ReadBatchingRuntimeContext DEFAULT_READ_BATCHING_RUNTIME_CONTEXT =
ReadBatchingRuntimeContext.builder()
.maximumPartitions(() -> 1)
.cellsThreshold(() -> SweepQueueUtils.SWEEP_BATCH_SIZE)
.build();

@Immutable
public interface ReadBatchingRuntimeContext {
ReadBatchingRuntimeContext DEFAULT = ReadBatchingRuntimeContext.builder()
.maximumPartitions(() -> 1)
.cellsThreshold(() -> SweepQueueUtils.SWEEP_BATCH_SIZE)
.build();

IntSupplier maximumPartitions();

Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-5225.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Fix a potential class initialization deadlock in SweepQueueReader
links:
- https://github.com/palantir/atlasdb/pull/5225