Search in sources :

Example 1 with TimestampBoundStore

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);
}
Also used : DelegatingManagedTimestampService(com.palantir.atlasdb.timelock.paxos.DelegatingManagedTimestampService) TimestampBoundStore(com.palantir.timestamp.TimestampBoundStore) PaxosTimestampBoundStore(com.palantir.atlasdb.timelock.paxos.PaxosTimestampBoundStore) PaxosTimestampBoundStore(com.palantir.atlasdb.timelock.paxos.PaxosTimestampBoundStore) PersistentTimestampService(com.palantir.timestamp.PersistentTimestampService)

Example 2 with TimestampBoundStore

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
    }
}
Also used : MultipleRunningTimestampServiceError(com.palantir.timestamp.MultipleRunningTimestampServiceError) TimestampBoundStore(com.palantir.timestamp.TimestampBoundStore) Test(org.junit.Test)

Example 3 with TimestampBoundStore

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());
}
Also used : TimestampBoundStore(com.palantir.timestamp.TimestampBoundStore) Test(org.junit.Test)

Example 4 with TimestampBoundStore

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());
}
Also used : TimestampBoundStore(com.palantir.timestamp.TimestampBoundStore) Test(org.junit.Test)

Example 5 with TimestampBoundStore

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);
}
Also used : TimestampBoundStore(com.palantir.timestamp.TimestampBoundStore) Test(org.junit.Test)

Aggregations

TimestampBoundStore (com.palantir.timestamp.TimestampBoundStore)7 Test (org.junit.Test)4 DelegatingManagedTimestampService (com.palantir.atlasdb.timelock.paxos.DelegatingManagedTimestampService)1 PaxosTimestampBoundStore (com.palantir.atlasdb.timelock.paxos.PaxosTimestampBoundStore)1 MultipleRunningTimestampServiceError (com.palantir.timestamp.MultipleRunningTimestampServiceError)1 PersistentTimestampService (com.palantir.timestamp.PersistentTimestampService)1