@Override public void initialize(TransactionManager txManager) { initializeWithoutRunning(txManager); runInBackground(); }
@Before public void setup() { super.setup(); sweepQueue = TargetedSweeper.createUninitializedForTest(() -> 1); sweepQueue.initializeWithoutRunning( timestampsSupplier, mock(TimelockService.class), kvs, txService, mock(TargetedSweepFollower.class)); }
private TargetedSweeper getSingleShardSweeper() { TargetedSweeper sweeper = TargetedSweeper.createUninitializedForTest(() -> 1); sweeper.initializeWithoutRunning( timestampsSupplier, mock(TimelockService.class), spiedKvs, txnService, mock(TargetedSweepFollower.class)); return sweeper; }
@Test public void initializingWithUninitializedKvsThrows() { KeyValueService uninitializedKvs = mock(KeyValueService.class); when(uninitializedKvs.isInitialized()).thenReturn(false); TargetedSweeper sweeper = TargetedSweeper.createUninitializedForTest(null); assertThatThrownBy(() -> sweeper.initializeWithoutRunning( null, mock(TimelockService.class), uninitializedKvs, txnService, mock(TargetedSweepFollower.class))) .isInstanceOf(IllegalStateException.class); }
private TargetedSweeper initializeAndGet(TargetedSweeper sweeper, TransactionManager txManager) { sweeper.initializeWithoutRunning( new SpecialTimestampsSupplier(txManager::getImmutableTimestamp, txManager::getImmutableTimestamp), txManager.getTimelockService(), txManager.getKeyValueService(), TransactionServices.createForTesting( txManager.getKeyValueService(), txManager.getTimestampService(), false), new TargetedSweepFollower(ImmutableList.of(FOLLOWER), txManager)); sweeper.runInBackground(); return sweeper; }
private void createAndInitializeSweepersAndWaitForOneBackgroundIteration(int sweepers, int shards, int threads, TimelockService stickyLockService) throws InterruptedException { for (int i = 0; i < sweepers; i++) { TargetedSweeper sweeperInstance = TargetedSweeper .createUninitialized(metricsManager, () -> true, () -> shards, threads, 0, ImmutableList.of()); sweeperInstance.initializeWithoutRunning( timestampsSupplier, stickyLockService, spiedKvs, txnService, mockFollower); sweeperInstance.runInBackground(); } waitUntilBackgroundSweepRunsOneIteration(); }
@Before public void setup() { super.setup(); sweepQueue = TargetedSweeper.createUninitializedForTest(metricsManager, () -> enabled, () -> DEFAULT_SHARDS); mockFollower = mock(TargetedSweepFollower.class); timelockService = mock(TimelockService.class); sweepQueue.initializeWithoutRunning(timestampsSupplier, timelockService, spiedKvs, txnService, mockFollower); progress = new ShardProgress(spiedKvs); sweepableTimestamps = new SweepableTimestamps(spiedKvs, partitioner); sweepableCells = new SweepableCells(spiedKvs, partitioner, null, txnService); puncherStore = KeyValueServicePuncherStore.create(spiedKvs, false); }
public void initializeWithoutRunning(TransactionManager txManager) { initializeWithoutRunning(SpecialTimestampsSupplier.create(txManager), txManager.getTimelockService(), txManager.getKeyValueService(), TransactionServices.createTransactionService(txManager.getKeyValueService(), CoordinationServices.createDefault( txManager.getKeyValueService(), txManager.getTimestampService(), false)), new TargetedSweepFollower(followers, txManager)); }
@Override public void initialize(TransactionManager txManager) { initializeWithoutRunning(txManager); runInBackground(); }
@Before public void setup() { super.setup(); sweepQueue = TargetedSweeper.createUninitializedForTest(() -> 1); sweepQueue.initializeWithoutRunning( timestampsSupplier, mock(TimelockService.class), kvs, txService, mock(TargetedSweepFollower.class)); }
public void initializeWithoutRunning(TransactionManager txManager) { initializeWithoutRunning(SpecialTimestampsSupplier.create(txManager), txManager.getTimelockService(), txManager.getKeyValueService(), TransactionServices.createTransactionService(txManager.getKeyValueService(), CoordinationServices.createDefault( txManager.getKeyValueService(), txManager.getTimestampService(), false)), new TargetedSweepFollower(followers, txManager)); }