use of com.palantir.atlasdb.keyvalue.api.CheckAndSetCompatibility in project atlasdb by palantir.
the class TransactionManagers method getTransactionSchemaInstallerIfSupported.
private static Optional<TransactionSchemaInstaller> getTransactionSchemaInstallerIfSupported(@Output List<AutoCloseable> closeables, KeyValueService keyValueService, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier, TransactionSchemaManager transactionSchemaManager) {
CheckAndSetCompatibility compatibility = keyValueService.getCheckAndSetCompatibility();
if (compatibility.supportsCheckAndSetOperations() && compatibility.supportsDetailOnFailure()) {
return Optional.of(initializeTransactionSchemaInstaller(closeables, runtimeConfigSupplier, transactionSchemaManager));
}
runtimeConfigSupplier.get().internalSchema().targetTransactionsSchemaVersion().filter(version -> version != TransactionConstants.DIRECT_ENCODING_TRANSACTIONS_SCHEMA_VERSION).ifPresent(version -> log.warn("This service seems like it has been configured to use transaction schema version {}," + " which isn't supported as your KVS doesn't support details on CAS failures" + " (typically Postgres or Oracle). We will remain with transactions1.", SafeArg.of("configuredTransactionSchemaVersion", version)));
return Optional.empty();
}
use of com.palantir.atlasdb.keyvalue.api.CheckAndSetCompatibility in project atlasdb by palantir.
the class DualWriteKeyValueServiceTest method checkAndSetCompatibilityIsBasedOnTheFirstDelegate.
@Test
public void checkAndSetCompatibilityIsBasedOnTheFirstDelegate() {
CheckAndSetCompatibility firstDelegateCompatibility = CheckAndSetCompatibility.supportedBuilder().supportsDetailOnFailure(true).consistentOnFailure(false).build();
when(delegate1.getCheckAndSetCompatibility()).thenReturn(firstDelegateCompatibility);
when(delegate2.getCheckAndSetCompatibility()).thenReturn(CheckAndSetCompatibility.unsupported());
assertThat(dualWriteService.getCheckAndSetCompatibility()).isEqualTo(firstDelegateCompatibility);
verify(delegate1).getCheckAndSetCompatibility();
verifyNoMoreInteractions(delegate1, delegate2);
}
Aggregations