int writeToDefaultCellCommitedAt(SweepQueueTable queueWriter, long startTs, long commitTs, TableReference tableRef) { putTimestampIntoTransactionTable(startTs, commitTs); return write(queueWriter, startTs, DEFAULT_CELL, false, tableRef); }
int writeToDefaultCellCommitted(SweepQueueTable queueWriter, long timestamp, TableReference tableRef) { return writeToCellCommitted(queueWriter, timestamp, DEFAULT_CELL, tableRef); }
List<WriteInfo> writeToCellsInFixedShard(SweepQueueTable writer, long ts, int number, TableReference tableRef) { List<WriteInfo> result = new ArrayList<>(); for (long i = 0; i < number; i++) { Cell cell = getCellWithFixedHash(i); result.add(WriteInfo.write(tableRef, cell, ts)); } putTimestampIntoTransactionTable(ts, ts); writer.enqueue(result); return result; }
@Before public void setup() { super.setup(); metrics = TargetedSweepMetrics.create(metricsManager, mock(TimelockService.class), spiedKvs, 1); sweepableCells = new SweepableCells(spiedKvs, partitioner, metrics, txnService); shardCons = writeToDefaultCellCommitted(sweepableCells, TS, TABLE_CONS); shardThor = writeToDefaultCellCommitted(sweepableCells, TS2, TABLE_THOR); }
int writeToDefaultCellUncommitted(SweepQueueTable queueWriter, long ts, TableReference tableRef) { return write(queueWriter, ts, DEFAULT_CELL, false, tableRef); }
@Before public void setup() { numShards = DEFAULT_SHARDS; unreadableTs = SweepQueueUtils.TS_COARSE_GRANULARITY * 5; immutableTs = SweepQueueUtils.TS_COARSE_GRANULARITY * 5; metricsManager = MetricsManagers.createForTests(); timestampsSupplier = new SpecialTimestampsSupplier(() -> unreadableTs, () -> immutableTs); spiedKvs = spy(new SafeTableClearerKeyValueService( timestampsSupplier::getImmutableTimestamp, new InMemoryKeyValueService(true))); spiedKvs.createTable(TABLE_CONS, metadataBytes(TableMetadataPersistence.SweepStrategy.CONSERVATIVE)); spiedKvs.createTable(TABLE_THOR, metadataBytes(TableMetadataPersistence.SweepStrategy.THOROUGH)); spiedKvs.createTable(TABLE_NOTH, metadataBytes(TableMetadataPersistence.SweepStrategy.NOTHING)); partitioner = new WriteInfoPartitioner(spiedKvs, () -> numShards); txnService = TransactionServices.createV1TransactionService(spiedKvs); }
@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); }
int writeToCellCommitted(SweepQueueTable queueWriter, long timestamp, Cell cell, TableReference tableRef) { putTimestampIntoTransactionTable(timestamp, timestamp); return write(queueWriter, timestamp, cell, false, tableRef); }
@Before @Override public void setup() { super.setup(); progress = new ShardProgress(spiedKvs); sweepableTimestamps = new SweepableTimestamps(spiedKvs, partitioner); shardCons = writeToDefaultCellCommitted(sweepableTimestamps, TS, TABLE_CONS); shardThor = writeToDefaultCellCommitted(sweepableTimestamps, TS2, TABLE_THOR); }
int writeToDefaultCellAborted(SweepQueueTable queueWriter, long timestamp, TableReference tableRef) { putTimestampIntoTransactionTable(timestamp, TransactionConstants.FAILED_COMMIT_TS); return write(queueWriter, timestamp, DEFAULT_CELL, false, tableRef); }
int putTombstoneToDefaultCommitted(SweepQueueTable queueWriter, long timestamp, TableReference tableRef) { putTimestampIntoTransactionTable(timestamp, timestamp); return write(queueWriter, timestamp, DEFAULT_CELL, true, tableRef); }