@Test public void sweepDeletesValuesWrittenOnPreCommitConditionFailure() { useOneSweepQueueShard(); long startTs = putWriteAndFailOnPreCommitConditionReturningStartTimestamp(SINGLE_WRITE); serializableTxManager.setUnreadableTimestamp(startTs + 1); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(0)); assertNoEntryForCellInKvs(TABLE_CONS, TEST_CELL); }
@Test public void sweepThrowsAwayWritesForDroppedTables() { useOneSweepQueueShard(); writeInTransactionAndGetStartTimestamp(SINGLE_WRITE); Long startTimestamp = writeInTransactionAndGetStartTimestamp(SINGLE_WRITE); keyValueService.dropTable(TABLE_CONS); serializableTxManager.setUnreadableTimestamp(startTimestamp + 1); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(0)); }
@Test public void sweepHandlesEmptyNamespace() { useOneSweepQueueShard(); WriteReference write = WriteReference.write(TABLE_NONAMESPACE, TEST_CELL); writeInTransactionAndGetStartTimestamp(write); long timestamp = writeInTransactionAndGetStartTimestamp(write); serializableTxManager.setUnreadableTimestamp(timestamp + 1); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(0)); }
@Test public void sweepRetainsLatestVersion() { useOneSweepQueueShard(); writeInTransactionAndGetStartTimestamp(SINGLE_WRITE); putWriteAndFailOnPreCommitConditionReturningStartTimestamp(SINGLE_WRITE); long freshCommittedTs = writeInTransactionAndGetStartTimestamp(SINGLE_WRITE); putWriteAndFailOnPreCommitConditionReturningStartTimestamp(SINGLE_DELETE); long freshFailedTs = putWriteAndFailOnPreCommitConditionReturningStartTimestamp(SINGLE_WRITE); serializableTxManager.setUnreadableTimestamp(freshFailedTs + 1); sweepQueue.sweepNextBatch(ShardAndStrategy.conservative(0)); assertLatestEntryForCellInKvsAtTimestamp(TABLE_CONS, TEST_CELL, freshCommittedTs); assertOnlySentinelBeforeTs(TABLE_CONS, TEST_CELL, freshCommittedTs); }
@Test public void sweepDeletesAllIfLatestCommittedTombstoneInThorough() { useOneSweepQueueShard(); WriteReference writeToThorough = WriteReference.write(TABLE_THOR, TEST_CELL); WriteReference tombstoneToThorough = WriteReference.tombstone(TABLE_THOR, TEST_CELL); long firstStart = writeInTransactionAndGetStartTimestamp(writeToThorough); long secondStart = writeInTransactionAndGetStartTimestamp(tombstoneToThorough); assertLatestEntryBeforeTsIs(Long.MAX_VALUE, TABLE_THOR, TEST_CELL, PtBytes.EMPTY_BYTE_ARRAY, secondStart); assertLatestEntryBeforeTsIs(secondStart, TABLE_THOR, TEST_CELL, TEST_DATA, firstStart); serializableTxManager.setUnreadableTimestamp(secondStart + 1); sweepQueue.sweepNextBatch(ShardAndStrategy.thorough(0)); assertNoEntryForCellInKvs(TABLE_THOR, TEST_CELL); }