Search in sources :

Example 1 with ReadOnlyTransactionSchemaManager

use of com.palantir.atlasdb.internalschema.ReadOnlyTransactionSchemaManager in project atlasdb by palantir.

the class TransactionServices method createReadOnlyTransactionServiceIgnoresUncommittedTransactionsDoesNotRollBack.

public static TransactionService createReadOnlyTransactionServiceIgnoresUncommittedTransactionsDoesNotRollBack(KeyValueService keyValueService, MetricsManager metricsManager) {
    if (keyValueService.supportsCheckAndSet()) {
        CoordinationService<InternalSchemaMetadata> coordinationService = CoordinationServices.createDefault(keyValueService, () -> {
            throw new SafeIllegalStateException("Attempted to get a timestamp from a read-only" + " transaction service! This is probably a product bug. Please contact" + " support.");
        }, metricsManager, false);
        ReadOnlyTransactionSchemaManager readOnlyTransactionSchemaManager = new ReadOnlyTransactionSchemaManager(coordinationService);
        return new PreStartHandlingTransactionService(new SplitKeyDelegatingTransactionService<>(readOnlyTransactionSchemaManager::getTransactionsSchemaVersion, ImmutableMap.of(1, createV1TransactionService(keyValueService))));
    }
    return createV1TransactionService(keyValueService);
}
Also used : InternalSchemaMetadata(com.palantir.atlasdb.internalschema.InternalSchemaMetadata) ReadOnlyTransactionSchemaManager(com.palantir.atlasdb.internalschema.ReadOnlyTransactionSchemaManager) SafeIllegalStateException(com.palantir.logsafe.exceptions.SafeIllegalStateException)

Aggregations

InternalSchemaMetadata (com.palantir.atlasdb.internalschema.InternalSchemaMetadata)1 ReadOnlyTransactionSchemaManager (com.palantir.atlasdb.internalschema.ReadOnlyTransactionSchemaManager)1 SafeIllegalStateException (com.palantir.logsafe.exceptions.SafeIllegalStateException)1