use of com.palantir.timestamp.TimestampBoundStore in project atlasdb by palantir.
the class PaxosTimestampCreator method createManagedPaxosTimestampService.
private ManagedTimestampService createManagedPaxosTimestampService(PaxosProposer proposer, String client, List<PaxosAcceptor> acceptors, List<PaxosLearner> learners) {
// TODO (jkong): live reload ping
TimestampBoundStore boundStore = instrument(TimestampBoundStore.class, new PaxosTimestampBoundStore(proposer, paxosResource.getPaxosLearner(client), ImmutableList.copyOf(acceptors), ImmutableList.copyOf(learners), paxosRuntime.get().maximumWaitBeforeProposalMs()), client);
PersistentTimestampService persistentTimestampService = PersistentTimestampServiceImpl.create(boundStore);
return new DelegatingManagedTimestampService(persistentTimestampService, persistentTimestampService);
}
use of com.palantir.timestamp.TimestampBoundStore in project atlasdb by palantir.
the class CassandraTimestampIntegrationTest method testMultipleThrows.
@Test
public void testMultipleThrows() {
TimestampBoundStore ts = CassandraTimestampBoundStore.create(kv);
TimestampBoundStore ts2 = CassandraTimestampBoundStore.create(kv);
long limit = ts.getUpperLimit();
Assert.assertEquals(limit, ts2.getUpperLimit());
ts.storeUpperLimit(limit + 10);
Assert.assertEquals(limit + 10, ts.getUpperLimit());
Assert.assertEquals(limit + 10, ts2.getUpperLimit());
ts.storeUpperLimit(limit + 20);
try {
ts2.storeUpperLimit(limit + 20);
Assert.fail();
} catch (MultipleRunningTimestampServiceError e) {
// expected
}
Assert.assertEquals(limit + 20, ts.getUpperLimit());
Assert.assertEquals(limit + 20, ts2.getUpperLimit());
ts.storeUpperLimit(limit + 30);
Assert.assertEquals(limit + 30, ts.getUpperLimit());
try {
ts2.storeUpperLimit(limit + 40);
Assert.fail();
} catch (MultipleRunningTimestampServiceError e) {
// expected
}
}
use of com.palantir.timestamp.TimestampBoundStore in project atlasdb by palantir.
the class CassandraTimestampIntegrationTest method testBounds.
@Test
public void testBounds() {
TimestampBoundStore ts = CassandraTimestampBoundStore.create(kv);
long limit = ts.getUpperLimit();
ts.storeUpperLimit(limit + 10);
Assert.assertEquals(limit + 10, ts.getUpperLimit());
ts.storeUpperLimit(limit + 20);
Assert.assertEquals(limit + 20, ts.getUpperLimit());
ts.storeUpperLimit(limit + 30);
Assert.assertEquals(limit + 30, ts.getUpperLimit());
}
use of com.palantir.timestamp.TimestampBoundStore in project atlasdb by palantir.
the class CassandraTimestampIntegrationTest method resilientToMultipleStoreUpperLimitBeforeGet.
@Test
public void resilientToMultipleStoreUpperLimitBeforeGet() {
TimestampBoundStore ts = CassandraTimestampBoundStore.create(kv);
long limit = ts.getUpperLimit();
ts.storeUpperLimit(limit + 10);
ts.storeUpperLimit(limit + 20);
Assert.assertEquals(limit + 20, ts.getUpperLimit());
}
use of com.palantir.timestamp.TimestampBoundStore in project atlasdb by palantir.
the class CassandraTimestampStoreInvalidatorIntegrationTest method canBackupAndRestoreTimestampTable.
@Test
public void canBackupAndRestoreTimestampTable() {
TimestampBoundStore timestampBoundStore = CassandraTimestampBoundStore.create(kv);
long limit = timestampBoundStore.getUpperLimit();
timestampBoundStore.storeUpperLimit(limit + ONE_MILLION);
invalidator.backupAndInvalidate();
invalidator.revalidateFromBackup();
assertThat(timestampBoundStore.getUpperLimit()).isEqualTo(limit + ONE_MILLION);
}
Aggregations