use of com.palantir.atlasdb.timelock.api.Namespace in project atlasdb by palantir.
the class MultiNodePaxosTimeLockServerIntegrationTest method sanityCheckMultiClientGetCommitTimestampsAgainstConjureTimelockService.
@Test
public void sanityCheckMultiClientGetCommitTimestampsAgainstConjureTimelockService() {
TestableTimelockServer leader = cluster.currentLeaderFor(client.namespace());
// Multi client batched TimeLock endpoints do not support multi-leader mode on TimeLock
Assume.assumeFalse(leader.isMultiLeader());
MultiClientConjureTimelockService multiClientService = leader.multiClientService();
Set<String> expectedNamespaces = ImmutableSet.of("alta", "mp");
Map<Namespace, GetCommitTimestampsResponse> multiClientResponses = multiClientService.getCommitTimestampsForClients(AUTH_HEADER, defaultGetCommitTimestampsRequests(expectedNamespaces));
assertSanityOfNamespacesServed(expectedNamespaces, multiClientResponses);
// Whether we hit the multi client endpoint or conjureTimelockService endpoint(services one client in one
// call), for a namespace, the underlying service to process the request is the same
multiClientResponses.forEach((namespace, responseFromBatchedEndpoint) -> {
GetCommitTimestampsResponse conjureGetCommitTimestampResponse = leader.client(namespace.get()).namespacedConjureTimelockService().getCommitTimestamps(defaultCommitTimestampRequest());
assertThat(conjureGetCommitTimestampResponse.getLockWatchUpdate().logId()).isEqualTo(responseFromBatchedEndpoint.getLockWatchUpdate().logId());
assertThat(conjureGetCommitTimestampResponse.getInclusiveLower()).as("timestamps should contiguously increase per namespace if there are no elections.").isEqualTo(responseFromBatchedEndpoint.getInclusiveUpper() + 1);
});
}
use of com.palantir.atlasdb.timelock.api.Namespace in project atlasdb by palantir.
the class MultiNodePaxosTimeLockServerIntegrationTest method sanityCheckMultiClientLeaderTimeAgainstConjureTimelockService.
@Test
public void sanityCheckMultiClientLeaderTimeAgainstConjureTimelockService() {
TestableTimelockServer leader = cluster.currentLeaderFor(client.namespace());
// Multi client batched TimeLock endpoints do not support multi-leader mode on TimeLock
Assume.assumeFalse(leader.isMultiLeader());
Set<Namespace> expectedNamespaces = ImmutableSet.of(Namespace.of("alpha"), Namespace.of("beta"));
LeaderTimes leaderTimes = assertSanityAndGetLeaderTimes(leader, expectedNamespaces);
// Whether we hit the multi client endpoint or conjureTimelockService endpoint(services one client in one
// call), for a namespace, the underlying service to process the request is the same
leaderTimes.getLeaderTimes().forEach((namespace, leaderTime) -> {
LeaderTime conjureTimelockServiceLeaderTime = leader.client(namespace.get()).namespacedConjureTimelockService().leaderTime();
assertThat(conjureTimelockServiceLeaderTime.id()).isEqualTo(leaderTime.id());
});
}
use of com.palantir.atlasdb.timelock.api.Namespace in project atlasdb by palantir.
the class ExternalBackupPersister method storeCompletedBackup.
@Override
public void storeCompletedBackup(CompletedBackup completedBackup) {
Namespace namespace = completedBackup.getNamespace();
writeToFile(namespace, getImmutableTimestampFile(namespace), completedBackup.getImmutableTimestamp());
writeToFile(namespace, getBackupTimestampFile(namespace), completedBackup.getBackupStartTimestamp());
writeToFile(namespace, getFastForwardTimestampFile(namespace), completedBackup.getBackupEndTimestamp());
}
use of com.palantir.atlasdb.timelock.api.Namespace in project atlasdb by palantir.
the class ExternalBackupPersister method storeImmutableTimestamp.
@Override
public void storeImmutableTimestamp(InProgressBackupToken inProgressBackupToken) {
Namespace namespace = inProgressBackupToken.getNamespace();
writeToFile(namespace, getImmutableTimestampFile(namespace), inProgressBackupToken.getImmutableTimestamp());
}
use of com.palantir.atlasdb.timelock.api.Namespace in project atlasdb by palantir.
the class AtlasRestoreServiceTest method cannotRestoreTwiceToSameNamespace.
@Test
public void cannotRestoreTwiceToSameNamespace() {
Namespace severeData = Namespace.of("severe-data");
storeCompletedBackup(severeData);
Namespace corruption = Namespace.of("corruption");
RestoreRequest firstRequest = RestoreRequest.builder().oldNamespace(WITH_BACKUP).newNamespace(corruption).build();
RestoreRequest secondRequest = RestoreRequest.builder().oldNamespace(severeData).newNamespace(corruption).build();
Set<RestoreRequest> requests = ImmutableSet.of(firstRequest, secondRequest);
assertThatThrownBy(() -> atlasRestoreService.prepareRestore(requests, BACKUP_ID)).isInstanceOf(SafeIllegalArgumentException.class).hasMessageContaining("severe data corruption");
}
Aggregations