use of com.palantir.atlasdb.transaction.api.TransactionManager in project atlasdb by palantir.
the class TransactionManagerTest method shouldConflictIfImmutableTimestampLockExpiresEvenIfNoWritesOnThoroughSweptTable.
@Test
public void shouldConflictIfImmutableTimestampLockExpiresEvenIfNoWritesOnThoroughSweptTable() {
TimelockService timelock = mock(TimelockService.class);
LockService mockLockService = mock(LockService.class);
TransactionManager txnManagerWithMocks = new SerializableTransactionManager(keyValueService, timelock, mockLockService, transactionService, () -> AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS, conflictDetectionManager, sweepStrategyManager, NoOpCleaner.INSTANCE, TimestampTrackerImpl.createNoOpTracker(), () -> AtlasDbConstants.DEFAULT_TIMESTAMP_CACHE_SIZE, false, () -> AtlasDbConstants.DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS, AbstractTransactionTest.GET_RANGES_THREAD_POOL_SIZE, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, MultiTableSweepQueueWriter.NO_OP);
when(timelock.getFreshTimestamp()).thenReturn(1L);
when(timelock.lockImmutableTimestamp(any())).thenReturn(LockImmutableTimestampResponse.of(2L, LockToken.of(UUID.randomUUID())));
assertThatThrownBy(() -> txnManagerWithMocks.runTaskThrowOnConflict(txn -> {
get(txn, TEST_TABLE_THOROUGH, "row1", "col1");
return null;
})).isInstanceOf(TransactionFailedRetriableException.class);
}
use of com.palantir.atlasdb.transaction.api.TransactionManager in project atlasdb by palantir.
the class TransactionManagersTest method timelockServiceStatusReturnsHealthyWithoutRequest.
@Test
public void timelockServiceStatusReturnsHealthyWithoutRequest() {
TransactionManager tm = TransactionManagers.createInMemory(GenericTestSchema.getSchema());
assertTrue(tm.getTimelockServiceStatus().isHealthy());
}
use of com.palantir.atlasdb.transaction.api.TransactionManager in project atlasdb by palantir.
the class TransactionManagersTest method timelockServiceStatusReturnsHealthyAfterSuccessfulRequests.
@Test
public void timelockServiceStatusReturnsHealthyAfterSuccessfulRequests() {
TransactionManager tm = TransactionManagers.createInMemory(GenericTestSchema.getSchema());
tm.getUnreadableTimestamp();
assertTrue(tm.getTimelockServiceStatus().isHealthy());
}
use of com.palantir.atlasdb.transaction.api.TransactionManager in project atlasdb by palantir.
the class KeyValueServiceMigrator method cleanup.
/**
* On success, delete the checkpoint table.
*/
public void cleanup() {
TransactionManager txManager = toTransactionManager;
GeneralTaskCheckpointer checkpointer = new GeneralTaskCheckpointer(checkpointTable, toKvs, txManager);
processMessage("Deleting checkpoint table...", KvsMigrationMessageLevel.INFO);
checkpointer.deleteCheckpoints();
processMessage("Migration complete.", KvsMigrationMessageLevel.INFO);
}
use of com.palantir.atlasdb.transaction.api.TransactionManager in project atlasdb by palantir.
the class StreamStoreBenchmarks method loadLargeStream.
@Benchmark
@Threads(1)
@Warmup(time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(time = 30, timeUnit = TimeUnit.SECONDS)
public void loadLargeStream(StreamingTable table) throws IOException {
long id = table.getLargeStreamId();
TransactionManager transactionManager = table.getTransactionManager();
StreamTestTableFactory tables = StreamTestTableFactory.of();
ValueStreamStore store = ValueStreamStore.of(transactionManager, tables);
try (InputStream inputStream = transactionManager.runTaskThrowOnConflict(txn -> store.loadStream(txn, id))) {
byte[] firstBytes = new byte[16];
int read = inputStream.read(firstBytes);
assertThat(read, is(16));
assertArrayEquals(table.getLargeStreamFirstBytes(), firstBytes);
}
}
Aggregations