use of com.palantir.atlasdb.internalschema.InternalSchemaMetadata in project atlasdb by palantir.
the class TransactionManagers method createTransactionComponents.
private TransactionComponents createTransactionComponents(@Output List<AutoCloseable> closeables, MetricsManager metricsManager, LockAndTimestampServices lockAndTimestampServices, KeyValueService keyValueService, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier) {
CoordinationService<InternalSchemaMetadata> coordinationService = getSchemaMetadataCoordinationService(metricsManager, lockAndTimestampServices, keyValueService);
TransactionSchemaManager transactionSchemaManager = new TransactionSchemaManager(coordinationService);
TransactionService transactionService = initializeCloseable(() -> AtlasDbMetrics.instrumentTimed(metricsManager.getRegistry(), TransactionService.class, TransactionServices.createTransactionService(keyValueService, transactionSchemaManager, metricsManager.getTaggedRegistry(), () -> runtimeConfigSupplier.get().internalSchema().acceptStagingReadsOnVersionThree())), closeables);
Optional<TransactionSchemaInstaller> schemaInstaller = getTransactionSchemaInstallerIfSupported(closeables, keyValueService, runtimeConfigSupplier, transactionSchemaManager);
return ImmutableTransactionComponents.builder().transactionService(transactionService).schemaInstaller(schemaInstaller).build();
}
use of com.palantir.atlasdb.internalschema.InternalSchemaMetadata in project atlasdb by palantir.
the class MetadataCoordinationServiceMetricsTest method handlesMultitenancyCorrectly.
@Test
public void handlesMultitenancyCorrectly() {
CoordinationService<InternalSchemaMetadata> otherService = mock(CoordinationService.class);
MetricsManager otherManager = MetricsManagers.createForTests();
TimestampService otherTimestampService = mock(TimestampService.class);
MetadataCoordinationServiceMetrics.registerMetrics(otherManager, otherService, otherTimestampService);
when(otherService.getLastKnownLocalValue()).thenReturn(Optional.of(ValueAndBound.of(Optional.empty(), TIMESTAMP_2)));
assertThat(getGauge(metricsManager, AtlasDbMetricNames.COORDINATION_LAST_VALID_BOUND).getValue()).isEqualTo(TIMESTAMP_1);
assertThat(getGauge(otherManager, AtlasDbMetricNames.COORDINATION_LAST_VALID_BOUND).getValue()).isEqualTo(TIMESTAMP_2);
}
use of com.palantir.atlasdb.internalschema.InternalSchemaMetadata 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);
}
use of com.palantir.atlasdb.internalschema.InternalSchemaMetadata in project atlasdb by palantir.
the class ExternalBackupPersisterTest method putAndGetSchemaMetadata.
@Test
public void putAndGetSchemaMetadata() {
InternalSchemaMetadata internalSchemaMetadata = InternalSchemaMetadata.defaultValue();
InternalSchemaMetadataState state = InternalSchemaMetadataState.of(ValueAndBound.of(internalSchemaMetadata, 100L));
externalBackupPersister.storeSchemaMetadata(ATLAS_SERVICE, state);
assertThat(externalBackupPersister.getSchemaMetadata(ATLAS_SERVICE)).contains(state);
}
use of com.palantir.atlasdb.internalschema.InternalSchemaMetadata in project atlasdb by palantir.
the class TransactionTestSetup method setUp.
@Before
public void setUp() {
timestampCache = ComparingTimestampCache.comparingOffHeapForTests(metricsManager, persistentStore);
lockService = LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build());
lockClient = LockClient.of("test_client");
keyValueService = getKeyValueService();
keyValueService.createTables(ImmutableMap.of(TEST_TABLE_THOROUGH, TableMetadata.builder().rangeScanAllowed(true).explicitCompressionBlockSizeKB(4).negativeLookups(true).sweepStrategy(SweepStrategy.THOROUGH).build().persistToBytes(), TEST_TABLE, TableMetadata.builder().rangeScanAllowed(true).explicitCompressionBlockSizeKB(4).negativeLookups(true).sweepStrategy(SweepStrategy.NOTHING).build().persistToBytes(), TEST_TABLE_SERIALIZABLE, TableMetadata.builder().rangeScanAllowed(true).explicitCompressionBlockSizeKB(4).negativeLookups(true).conflictHandler(ConflictHandler.SERIALIZABLE).sweepStrategy(SweepStrategy.NOTHING).build().persistToBytes()));
TransactionTables.createTables(keyValueService);
TransactionTables.truncateTables(keyValueService);
keyValueService.truncateTable(TEST_TABLE);
keyValueService.truncateTable(TEST_TABLE_SERIALIZABLE);
timestampService = inMemoryTimeLockRule.getTimestampService();
timestampManagementService = inMemoryTimeLockRule.getTimestampManagementService();
timelockService = inMemoryTimeLockRule.getLegacyTimelockService();
lockWatchManager = inMemoryTimeLockRule.getLockWatchManager();
CoordinationService<InternalSchemaMetadata> coordinationService = CoordinationServices.createDefault(keyValueService, timestampService, metricsManager, false);
transactionSchemaManager = new TransactionSchemaManager(coordinationService);
transactionService = createTransactionService(keyValueService, transactionSchemaManager);
conflictDetectionManager = ConflictDetectionManagers.createWithoutWarmingCache(keyValueService);
sweepStrategyManager = SweepStrategyManagers.createDefault(keyValueService);
txMgr = createAndRegisterManager();
}
Aggregations