From 420162f4501477187f812387d3675dcc7e0f3938 Mon Sep 17 00:00:00 2001 From: Raymond Huffman Date: Mon, 7 Oct 2024 10:17:04 -0400 Subject: [PATCH] rename TransactionKeyValueService to DataKeyValueService (#7307) rename TransactionKeyValueService to DataKeyValueService --- .palantir/revapi.yml | 124 ++++++++++++++++++ ...eService.java => DataKeyValueService.java} | 2 +- ...r.java => DataKeyValueServiceManager.java} | 4 +- ...ig.java => DataKeyValueServiceConfig.java} | 2 +- ...=> DataKeyValueServiceManagerFactory.java} | 12 +- ... => DataKeyValueServiceRuntimeConfig.java} | 2 +- .../KeyValueSnapshotReaderManagerFactory.java | 4 +- .../command/KeyValueServiceMigratorsTest.java | 4 +- .../palantir/atlasdb/AtlasDbConstants.java | 2 +- ...ava => DelegatingDataKeyValueService.java} | 6 +- ...DelegatingDataKeyValueServiceManager.java} | 16 +-- .../atlasdb/config/AtlasDbConfig.java | 4 +- .../atlasdb/config/AtlasDbRuntimeConfig.java | 4 +- .../factory/AtlasDbServiceDiscovery.java | 16 +-- .../atlasdb/factory/TransactionManagers.java | 67 +++++----- .../TransactionManagersInitializer.java | 14 +- .../services/TransactionManagerModule.java | 11 +- .../test/TestTransactionManagerModule.java | 11 +- .../persistence/CoordinationServices.java | 8 +- .../impl/ColumnRangeBatchProvider.java | 10 +- .../transaction/impl/ReadSentinelHandler.java | 12 +- .../impl/RowRangeBatchProvider.java | 13 +- .../impl/SerializableTransaction.java | 6 +- .../impl/SerializableTransactionManager.java | 44 +++---- .../transaction/impl/SnapshotTransaction.java | 64 +++++---- .../impl/SnapshotTransactionManager.java | 18 +-- ....java => TrackingDataKeyValueService.java} | 4 +- ...a => TrackingDataKeyValueServiceImpl.java} | 14 +- .../DefaultKeyValueSnapshotReader.java | 16 +-- .../DefaultKeyValueSnapshotReaderManager.java | 19 ++- .../impl/GetRowsColumnRangeIteratorTest.java | 13 +- .../impl/ReadSentinelHandlerTest.java | 6 +- ...ingDataKeyValueServiceForwardingTest.java} | 14 +- ...ckingDataKeyValueServiceReadInfoTest.java} | 28 ++-- .../atlasdb/sweep/SweepTestUtils.java | 4 +- .../AbstractSerializableTransactionTest.java | 8 +- .../impl/TestTransactionManagerImpl.java | 12 +- .../impl/TransactionTestSetup.java | 12 +- .../com/palantir/atlasdb/AtlasDbTestCase.java | 8 +- .../atlasdb/keyvalue/impl/TableTasksTest.java | 2 +- .../impl/AbstractSnapshotTransactionTest.java | 57 ++++---- ...va => FakeDataKeyValueServiceManager.java} | 12 +- ... => InvalidatableDataKeyValueService.java} | 12 +- .../SerializableTransactionManagerTest.java | 6 +- .../impl/SnapshotTransactionManagerTest.java | 19 ++- .../TestKeyValueSnapshotReaderManagers.java | 10 +- .../impl/TransactionManagerTest.java | 6 +- changelog/@unreleased/pr-7307.v2.yml | 5 + 48 files changed, 435 insertions(+), 332 deletions(-) rename atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/{TransactionKeyValueService.java => DataKeyValueService.java} (98%) rename atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/{TransactionKeyValueServiceManager.java => DataKeyValueServiceManager.java} (85%) rename atlasdb-api/src/main/java/com/palantir/atlasdb/spi/{TransactionKeyValueServiceConfig.java => DataKeyValueServiceConfig.java} (94%) rename atlasdb-api/src/main/java/com/palantir/atlasdb/spi/{TransactionKeyValueServiceManagerFactory.java => DataKeyValueServiceManagerFactory.java} (81%) rename atlasdb-api/src/main/java/com/palantir/atlasdb/spi/{TransactionKeyValueServiceRuntimeConfig.java => DataKeyValueServiceRuntimeConfig.java} (93%) rename atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/{DelegatingTransactionKeyValueService.java => DelegatingDataKeyValueService.java} (94%) rename atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/{DelegatingTransactionKeyValueServiceManager.java => DelegatingDataKeyValueServiceManager.java} (74%) rename atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/{TrackingTransactionKeyValueService.java => TrackingDataKeyValueService.java} (86%) rename atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/{TrackingTransactionKeyValueServiceImpl.java => TrackingDataKeyValueServiceImpl.java} (92%) rename atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/{TrackingTransactionKeyValueServiceForwardingTest.java => TrackingDataKeyValueServiceForwardingTest.java} (95%) rename atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/{TrackingTransactionKeyValueServiceReadInfoTest.java => TrackingDataKeyValueServiceReadInfoTest.java} (91%) rename atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/{FakeTransactionKeyValueServiceManager.java => FakeDataKeyValueServiceManager.java} (74%) rename atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/{InvalidatableTransactionKeyValueService.java => InvalidatableDataKeyValueService.java} (70%) create mode 100644 changelog/@unreleased/pr-7307.v2.yml diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml index fad4288dbe4..f096547ae7a 100644 --- a/.palantir/revapi.yml +++ b/.palantir/revapi.yml @@ -277,6 +277,130 @@ acceptedBreaks: \ ===java.util.Map===)" justification: "KeyValueSnapshotReader is a relatively new API and is not widely\ \ used" + "0.1157.0": + com.palantir.atlasdb:atlasdb-api: + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.cell.api.AutoDelegate_TransactionKeyValueService" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.cell.api.AutoDelegate_TransactionKeyValueServiceManager" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.cell.api.TransactionKeyValueService" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.spi.TransactionKeyValueServiceManagerFactory" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.class.removed" + old: "interface com.palantir.atlasdb.spi.TransactionKeyValueServiceRuntimeConfig" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.parameterTypeChanged" + old: "parameter com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManager\ + \ com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManagerFactory::createKeyValueSnapshotReaderManager(===com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager===,\ + \ com.palantir.atlasdb.transaction.service.TransactionService, boolean, com.palantir.atlasdb.transaction.api.OrphanedSentinelDeleter,\ + \ com.palantir.atlasdb.transaction.api.DeleteExecutor, com.palantir.atlasdb.util.MetricsManager)" + new: "parameter com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManager\ + \ com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManagerFactory::createKeyValueSnapshotReaderManager(===com.palantir.atlasdb.cell.api.DataKeyValueServiceManager===,\ + \ com.palantir.atlasdb.transaction.service.TransactionService, boolean, com.palantir.atlasdb.transaction.api.OrphanedSentinelDeleter,\ + \ com.palantir.atlasdb.transaction.api.DeleteExecutor, com.palantir.atlasdb.util.MetricsManager)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + com.palantir.atlasdb:atlasdb-config: + - code: "java.method.parameterTypeChanged" + old: "parameter com.palantir.atlasdb.factory.TransactionManagersInitializer\ + \ com.palantir.atlasdb.factory.TransactionManagersInitializer::createInitialTables(com.palantir.atlasdb.keyvalue.api.KeyValueService,\ + \ ===com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager===, java.util.Set,\ + \ boolean, boolean)" + new: "parameter com.palantir.atlasdb.factory.TransactionManagersInitializer\ + \ com.palantir.atlasdb.factory.TransactionManagersInitializer::createInitialTables(com.palantir.atlasdb.keyvalue.api.KeyValueService,\ + \ ===com.palantir.atlasdb.cell.api.DataKeyValueServiceManager===, java.util.Set,\ + \ boolean, boolean)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.parameterTypeChanged" + old: "parameter com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManagerFactory\ + \ com.palantir.atlasdb.factory.AtlasDbServiceDiscovery::createKeyValueSnapshotReaderManagerFactoryOfCorrectType(===com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig===)" + new: "parameter com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManagerFactory\ + \ com.palantir.atlasdb.factory.AtlasDbServiceDiscovery::createKeyValueSnapshotReaderManagerFactoryOfCorrectType(===com.palantir.atlasdb.spi.DataKeyValueServiceConfig===)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbConfig com.palantir.atlasdb.config.ImmutableAtlasDbConfig::withTransactionKeyValueService(com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbConfig com.palantir.atlasdb.config.ImmutableAtlasDbConfig::withTransactionKeyValueService(java.util.Optional)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbConfig.Builder com.palantir.atlasdb.config.ImmutableAtlasDbConfig.Builder::transactionKeyValueService(com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbConfig.Builder com.palantir.atlasdb.config.ImmutableAtlasDbConfig.Builder::transactionKeyValueService(java.util.Optional)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig::withTransactionKeyValueService(com.palantir.atlasdb.spi.TransactionKeyValueServiceRuntimeConfig)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig::withTransactionKeyValueService(java.util.Optional)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig.Builder\ + \ com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig.Builder::transactionKeyValueService(com.palantir.atlasdb.spi.TransactionKeyValueServiceRuntimeConfig)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig.Builder\ + \ com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig.Builder::transactionKeyValueService(java.util.Optional)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method com.palantir.atlasdb.spi.TransactionKeyValueServiceManagerFactory\ + \ com.palantir.atlasdb.factory.AtlasDbServiceDiscovery::createTransactionKeyValueServiceManagerFactoryOfCorrectType(com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig)" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method java.util.Optional\ + \ com.palantir.atlasdb.config.AtlasDbConfig::transactionKeyValueService()" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method java.util.Optional\ + \ com.palantir.atlasdb.config.ImmutableAtlasDbConfig::transactionKeyValueService()" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method java.util.Optional\ + \ com.palantir.atlasdb.config.AtlasDbRuntimeConfig::transactionKeyValueService()" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." + - code: "java.method.removed" + old: "method java.util.Optional\ + \ com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig::transactionKeyValueService()" + justification: "Renaming TransactionKeyValueService to DataKeyValueService is\ + \ acceptable as it is marked @Beta and unused in production." "0.770.0": com.palantir.atlasdb:atlasdb-api: - code: "java.class.removed" diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/TransactionKeyValueService.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/DataKeyValueService.java similarity index 98% rename from atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/TransactionKeyValueService.java rename to atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/DataKeyValueService.java index 4e079341fcc..01279c3d1c5 100644 --- a/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/TransactionKeyValueService.java +++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/DataKeyValueService.java @@ -40,7 +40,7 @@ * to transactions. */ @AutoDelegate -public interface TransactionKeyValueService { +public interface DataKeyValueService { Map, byte[]>> getFirstBatchForRanges( TableReference tableRef, Iterable rangeRequests, long timestamp); diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/TransactionKeyValueServiceManager.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/DataKeyValueServiceManager.java similarity index 85% rename from atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/TransactionKeyValueServiceManager.java rename to atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/DataKeyValueServiceManager.java index 9c948cf5661..4a6d77b968f 100644 --- a/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/TransactionKeyValueServiceManager.java +++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/cell/api/DataKeyValueServiceManager.java @@ -22,8 +22,8 @@ import java.util.function.LongSupplier; @AutoDelegate -public interface TransactionKeyValueServiceManager extends AutoCloseable { - TransactionKeyValueService getTransactionKeyValueService(LongSupplier timestampSupplier); +public interface DataKeyValueServiceManager extends AutoCloseable { + DataKeyValueService getDataKeyValueService(LongSupplier timestampSupplier); Optional getKeyValueService(); diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceConfig.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceConfig.java similarity index 94% rename from atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceConfig.java rename to atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceConfig.java index 425c8b9bbbf..e8bb3d0a495 100644 --- a/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceConfig.java +++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceConfig.java @@ -20,6 +20,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo.As; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "type", visible = false) -public interface TransactionKeyValueServiceConfig { +public interface DataKeyValueServiceConfig { String type(); } diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceManagerFactory.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceManagerFactory.java similarity index 81% rename from atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceManagerFactory.java rename to atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceManagerFactory.java index 594e7102e57..57a49ed71ea 100644 --- a/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceManagerFactory.java +++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceManagerFactory.java @@ -16,14 +16,14 @@ package com.palantir.atlasdb.spi; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.coordination.CoordinationService; import com.palantir.atlasdb.util.MetricsManager; import com.palantir.dialogue.clients.DialogueClients; import com.palantir.refreshable.Refreshable; /** - * Factory for creating {@link TransactionKeyValueServiceManager} instances. + * Factory for creating {@link DataKeyValueServiceManager} instances. * * Implementations have access to the coordination service to be able query their internal state at a particular * timestamp, as well as schedule changes to it at a future timestamp. @@ -33,19 +33,19 @@ * * @param type used for the coordination state. Should be a jackson-compatible POJO. */ -public interface TransactionKeyValueServiceManagerFactory { +public interface DataKeyValueServiceManagerFactory { String getType(); Class coordinationValueClass(); - TransactionKeyValueServiceManager create( + DataKeyValueServiceManager create( String namespace, DialogueClients.ReloadingFactory reloadingFactory, MetricsManager metricsManager, CoordinationService coordinationService, KeyValueServiceManager keyValueServiceManager, - TransactionKeyValueServiceConfig install, - Refreshable runtime, + DataKeyValueServiceConfig install, + Refreshable runtime, boolean initializeAsync); } diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceRuntimeConfig.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceRuntimeConfig.java similarity index 93% rename from atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceRuntimeConfig.java rename to atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceRuntimeConfig.java index 251a2714c28..9a494a1fb65 100644 --- a/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/TransactionKeyValueServiceRuntimeConfig.java +++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/DataKeyValueServiceRuntimeConfig.java @@ -19,6 +19,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = false) -public interface TransactionKeyValueServiceRuntimeConfig { +public interface DataKeyValueServiceRuntimeConfig { String type(); } diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/snapshot/KeyValueSnapshotReaderManagerFactory.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/snapshot/KeyValueSnapshotReaderManagerFactory.java index 8261796a4b3..e357f985bb8 100644 --- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/snapshot/KeyValueSnapshotReaderManagerFactory.java +++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/snapshot/KeyValueSnapshotReaderManagerFactory.java @@ -16,7 +16,7 @@ package com.palantir.atlasdb.transaction.api.snapshot; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.transaction.api.DeleteExecutor; import com.palantir.atlasdb.transaction.api.OrphanedSentinelDeleter; import com.palantir.atlasdb.transaction.service.TransactionService; @@ -26,7 +26,7 @@ public interface KeyValueSnapshotReaderManagerFactory { String getType(); KeyValueSnapshotReaderManager createKeyValueSnapshotReaderManager( - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TransactionService transactionService, boolean allowHiddenTableAccess, OrphanedSentinelDeleter orphanedSentinelDeleter, diff --git a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/KeyValueServiceMigratorsTest.java b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/KeyValueServiceMigratorsTest.java index eba69db4056..c372385c3c5 100644 --- a/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/KeyValueServiceMigratorsTest.java +++ b/atlasdb-cli/src/test/java/com/palantir/atlasdb/cli/command/KeyValueServiceMigratorsTest.java @@ -37,7 +37,7 @@ import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.TableReference; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import com.palantir.atlasdb.keyvalue.impl.TableSplittingKeyValueService; import com.palantir.atlasdb.schema.KeyValueServiceMigrator; @@ -362,7 +362,7 @@ private static AtlasDbServices createMock(KeyValueService kvs, InMemoryTimelockE TargetedSweeper sweeper = TargetedSweeper.createUninitializedForTest(kvs, () -> 1); SerializableTransactionManager txManager = SerializableTransactionManager.createForTest( metricsManager, - new DelegatingTransactionKeyValueServiceManager(kvs), + new DelegatingDataKeyValueServiceManager(kvs), timeLock.getLegacyTimelockService(), timestampService, timeLock.getLockService(), diff --git a/atlasdb-client/src/main/java/com/palantir/atlasdb/AtlasDbConstants.java b/atlasdb-client/src/main/java/com/palantir/atlasdb/AtlasDbConstants.java index 15a1a4c7579..552b41ed979 100644 --- a/atlasdb-client/src/main/java/com/palantir/atlasdb/AtlasDbConstants.java +++ b/atlasdb-client/src/main/java/com/palantir/atlasdb/AtlasDbConstants.java @@ -98,7 +98,7 @@ private AtlasDbConstants() { public static final byte[] DEFAULT_METADATA_COORDINATION_KEY = PtBytes.toBytes("m"); - public static final byte[] DEFAULT_TRANSACTION_KEY_VALUE_SERVICE_COORDINATION_KEY = PtBytes.toBytes("x"); + public static final byte[] DEFAULT_DATA_KEY_VALUE_SERVICE_COORDINATION_KEY = PtBytes.toBytes("x"); public static final long DEFAULT_TRANSACTION_LOCK_ACQUIRE_TIMEOUT_MS = 60_000; public static final int THRESHOLD_FOR_LOGGING_LARGE_NUMBER_OF_TRANSACTION_LOOKUPS = 10_000_000; diff --git a/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingTransactionKeyValueService.java b/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingDataKeyValueService.java similarity index 94% rename from atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingTransactionKeyValueService.java rename to atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingDataKeyValueService.java index 62a9481b3f7..e645f0b8a35 100644 --- a/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingTransactionKeyValueService.java +++ b/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingDataKeyValueService.java @@ -18,7 +18,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.errorprone.annotations.MustBeClosed; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection; @@ -34,11 +34,11 @@ import com.palantir.util.paging.TokenBackedBasicResultsPage; import java.util.Map; -public final class DelegatingTransactionKeyValueService implements TransactionKeyValueService { +public final class DelegatingDataKeyValueService implements DataKeyValueService { private final KeyValueService delegate; - public DelegatingTransactionKeyValueService(KeyValueService delegate) { + public DelegatingDataKeyValueService(KeyValueService delegate) { this.delegate = delegate; } diff --git a/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingTransactionKeyValueServiceManager.java b/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingDataKeyValueServiceManager.java similarity index 74% rename from atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingTransactionKeyValueServiceManager.java rename to atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingDataKeyValueServiceManager.java index 37f973b41f6..dba79ffa764 100644 --- a/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingTransactionKeyValueServiceManager.java +++ b/atlasdb-client/src/main/java/com/palantir/atlasdb/keyvalue/impl/DelegatingDataKeyValueServiceManager.java @@ -16,28 +16,28 @@ package com.palantir.atlasdb.keyvalue.impl; +import com.palantir.atlasdb.cell.api.DataKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cell.api.DdlManager; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import java.util.Optional; import java.util.function.LongSupplier; -public final class DelegatingTransactionKeyValueServiceManager implements TransactionKeyValueServiceManager { +public final class DelegatingDataKeyValueServiceManager implements DataKeyValueServiceManager { private final Optional delegate; - private final TransactionKeyValueService transactionKeyValueService; + private final DataKeyValueService dataKeyValueService; private final DdlManager ddlManager; - public DelegatingTransactionKeyValueServiceManager(KeyValueService delegate) { + public DelegatingDataKeyValueServiceManager(KeyValueService delegate) { this.delegate = Optional.of(delegate); - this.transactionKeyValueService = new DelegatingTransactionKeyValueService(delegate); + this.dataKeyValueService = new DelegatingDataKeyValueService(delegate); this.ddlManager = new DelegatingDdlManager(delegate); } @Override - public TransactionKeyValueService getTransactionKeyValueService(LongSupplier _timestampSupplier) { - return transactionKeyValueService; + public DataKeyValueService getDataKeyValueService(LongSupplier _timestampSupplier) { + return dataKeyValueService; } @Override diff --git a/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbConfig.java b/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbConfig.java index 3062597a41d..f6a52dec32d 100644 --- a/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbConfig.java +++ b/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbConfig.java @@ -26,8 +26,8 @@ import com.palantir.atlasdb.internalschema.InternalSchemaInstallConfig; import com.palantir.atlasdb.keyvalue.api.LockWatchCachingConfig; import com.palantir.atlasdb.memory.InMemoryAtlasDbConfig; +import com.palantir.atlasdb.spi.DataKeyValueServiceConfig; import com.palantir.atlasdb.spi.KeyValueServiceConfig; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig; import com.palantir.atlasdb.sweep.queue.config.TargetedSweepInstallConfig; import com.palantir.exception.NotInitializedException; import com.palantir.logsafe.DoNotLog; @@ -51,7 +51,7 @@ public abstract class AtlasDbConfig { public abstract KeyValueServiceConfig keyValueService(); @Beta - public abstract Optional transactionKeyValueService(); + public abstract Optional dataKeyValueService(); public abstract Optional leader(); diff --git a/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbRuntimeConfig.java b/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbRuntimeConfig.java index 736211e0815..3bae310949d 100644 --- a/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbRuntimeConfig.java +++ b/atlasdb-config/src/main/java/com/palantir/atlasdb/config/AtlasDbRuntimeConfig.java @@ -22,8 +22,8 @@ import com.palantir.atlasdb.compact.CompactorConfig; import com.palantir.atlasdb.internalschema.ImmutableInternalSchemaRuntimeConfig; import com.palantir.atlasdb.internalschema.InternalSchemaRuntimeConfig; +import com.palantir.atlasdb.spi.DataKeyValueServiceRuntimeConfig; import com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceRuntimeConfig; import com.palantir.atlasdb.stream.StreamStorePersistenceConfiguration; import com.palantir.atlasdb.stream.StreamStorePersistenceConfigurations; import com.palantir.atlasdb.sweep.queue.config.TargetedSweepRuntimeConfig; @@ -94,7 +94,7 @@ public long getTimestampCacheSize() { public abstract Optional keyValueService(); @Beta - public abstract Optional transactionKeyValueService(); + public abstract Optional dataKeyValueService(); /** * Runtime live-reloadable parameters for communicating with TimeLock. diff --git a/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/AtlasDbServiceDiscovery.java b/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/AtlasDbServiceDiscovery.java index 0f35f0c199f..564733538ae 100644 --- a/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/AtlasDbServiceDiscovery.java +++ b/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/AtlasDbServiceDiscovery.java @@ -18,9 +18,9 @@ import com.palantir.atlasdb.namespacedeleter.NamespaceDeleterFactory; import com.palantir.atlasdb.spi.AtlasDbFactory; +import com.palantir.atlasdb.spi.DataKeyValueServiceConfig; +import com.palantir.atlasdb.spi.DataKeyValueServiceManagerFactory; import com.palantir.atlasdb.spi.KeyValueServiceConfig; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceManagerFactory; import com.palantir.atlasdb.timestamp.DbTimeLockFactory; import com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManagerFactory; import com.palantir.logsafe.SafeArg; @@ -37,17 +37,15 @@ public static AtlasDbFactory createAtlasFactoryOfCorrectType(KeyValueServiceConf return createAtlasDbServiceOfCorrectType(config, AtlasDbFactory::getType, AtlasDbFactory.class); } - public static TransactionKeyValueServiceManagerFactory - createTransactionKeyValueServiceManagerFactoryOfCorrectType(TransactionKeyValueServiceConfig config) { + public static DataKeyValueServiceManagerFactory createDataKeyValueServiceManagerFactoryOfCorrectType( + DataKeyValueServiceConfig config) { return createAtlasDbServiceOfCorrectType( - config.type(), - TransactionKeyValueServiceManagerFactory::getType, - TransactionKeyValueServiceManagerFactory.class); + config.type(), DataKeyValueServiceManagerFactory::getType, DataKeyValueServiceManagerFactory.class); } - // TODO (jkong): A little cheaty, currently coupling usage of TKVSMF and KVSRF to be special or non-special... + // TODO (jkong): A little cheaty, currently coupling usage of DKVSMF and KVSRF to be special or non-special... public static KeyValueSnapshotReaderManagerFactory createKeyValueSnapshotReaderManagerFactoryOfCorrectType( - TransactionKeyValueServiceConfig config) { + DataKeyValueServiceConfig config) { return createAtlasDbServiceOfCorrectType( config.type(), KeyValueSnapshotReaderManagerFactory::getType, diff --git a/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagers.java b/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagers.java index 871869ad1d2..4dfb8e466e1 100644 --- a/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagers.java +++ b/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagers.java @@ -27,7 +27,7 @@ import com.palantir.atlasdb.AtlasDbMetricNames; import com.palantir.atlasdb.cache.DefaultTimestampCache; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cleaner.CleanupFollower; import com.palantir.atlasdb.cleaner.DefaultCleanerBuilder; import com.palantir.atlasdb.cleaner.Follower; @@ -58,7 +58,7 @@ import com.palantir.atlasdb.keyvalue.api.CheckAndSetCompatibility; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.TableReference; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.impl.ProfilingKeyValueService; import com.palantir.atlasdb.keyvalue.impl.SweepStatsKeyValueService; import com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService; @@ -68,13 +68,13 @@ import com.palantir.atlasdb.schema.TargetedSweepSchema; import com.palantir.atlasdb.schema.generated.SweepTableFactory; import com.palantir.atlasdb.schema.generated.TargetedSweepTableFactory; +import com.palantir.atlasdb.spi.DataKeyValueServiceConfig; +import com.palantir.atlasdb.spi.DataKeyValueServiceManagerFactory; +import com.palantir.atlasdb.spi.DataKeyValueServiceRuntimeConfig; import com.palantir.atlasdb.spi.DerivedSnapshotConfig; import com.palantir.atlasdb.spi.KeyValueServiceConfig; import com.palantir.atlasdb.spi.KeyValueServiceManager; import com.palantir.atlasdb.spi.SharedResourcesConfig; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceConfig; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceManagerFactory; -import com.palantir.atlasdb.spi.TransactionKeyValueServiceRuntimeConfig; import com.palantir.atlasdb.sweep.AdjustableSweepBatchConfigSource; import com.palantir.atlasdb.sweep.BackgroundSweeperImpl; import com.palantir.atlasdb.sweep.BackgroundSweeperPerformanceLogger; @@ -452,26 +452,26 @@ private TransactionManager serializableInternal(@Output List clos }, closeables); - TransactionKeyValueServiceManager transactionKeyValueServiceManager = initializeCloseable( - () -> config().transactionKeyValueService() - .map(transactionKeyValueServiceConfig -> createTransactionKeyValueServiceManager( - AtlasDbServiceDiscovery.createTransactionKeyValueServiceManagerFactoryOfCorrectType( - transactionKeyValueServiceConfig), + DataKeyValueServiceManager dataKeyValueServiceManager = initializeCloseable( + () -> config().dataKeyValueService() + .map(dataKeyValueServiceConfig -> createDataKeyValueServiceManager( + AtlasDbServiceDiscovery.createDataKeyValueServiceManagerFactoryOfCorrectType( + dataKeyValueServiceConfig), metricsManager, lockAndTimestampServices, internalKeyValueService, new DefaultKeyValueServiceManager(metricsManager, adapter), - transactionKeyValueServiceConfig, - runtime.map(config -> config.transactionKeyValueService() + dataKeyValueServiceConfig, + runtime.map(config -> config.dataKeyValueService() .orElseThrow(() -> new SafeIllegalArgumentException( - "TransactionKeyValueServiceRuntimeConfig must be provided"))), + "DataKeyValueServiceRuntimeConfig must be provided"))), config().initializeAsync())) - .orElseGet(() -> new DelegatingTransactionKeyValueServiceManager(internalKeyValueService)), + .orElseGet(() -> new DelegatingDataKeyValueServiceManager(internalKeyValueService)), closeables); TransactionManagersInitializer initializer = TransactionManagersInitializer.createInitialTables( internalKeyValueService, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, schemas(), config().initializeAsync(), allSafeForLogging()); @@ -542,12 +542,12 @@ private TransactionManager serializableInternal(@Output List clos createClearsTable(internalKeyValueService))); KeyValueSnapshotReaderManager keyValueSnapshotReaderManager = createKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, transactionService, sweepStrategyManager, metricsManager); + dataKeyValueServiceManager, transactionService, sweepStrategyManager, metricsManager); TransactionManager transactionManager = initializeCloseable( () -> SerializableTransactionManager.createInstrumented( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, lockAndTimestampServices.timelock(), lockAndTimestampServices.lockWatcher(), lockAndTimestampServices.managedTimestampService(), @@ -611,52 +611,51 @@ private TransactionManager serializableInternal(@Output List clos } private KeyValueSnapshotReaderManager createKeyValueSnapshotReaderManager( - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TransactionService transactionService, SweepStrategyManager sweepStrategyManager, MetricsManager metricsManager) { - Optional serviceDiscoveredFactory = config().transactionKeyValueService() + Optional serviceDiscoveredFactory = config().dataKeyValueService() .map(AtlasDbServiceDiscovery::createKeyValueSnapshotReaderManagerFactoryOfCorrectType); DeleteExecutor deleteExecutor = DefaultDeleteExecutor.createDefault( - transactionKeyValueServiceManager.getKeyValueService().orElseThrow()); + dataKeyValueServiceManager.getKeyValueService().orElseThrow()); OrphanedSentinelDeleter orphanedSentinelDeleter = new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor); return serviceDiscoveredFactory .map(factory -> factory.createKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, allowHiddenTableAccess(), orphanedSentinelDeleter, deleteExecutor, metricsManager)) .orElseGet(() -> new DefaultKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, allowHiddenTableAccess(), orphanedSentinelDeleter, deleteExecutor)); } - private TransactionKeyValueServiceManager createTransactionKeyValueServiceManager( - TransactionKeyValueServiceManagerFactory factory, + private DataKeyValueServiceManager createDataKeyValueServiceManager( + DataKeyValueServiceManagerFactory factory, MetricsManager metricsManager, LockAndTimestampServices lockAndTimestampServices, KeyValueService internalTablesKeyValueService, KeyValueServiceManager keyValueServiceManager, - TransactionKeyValueServiceConfig config, - Refreshable runtimeConfigRefreshable, + DataKeyValueServiceConfig config, + Refreshable runtimeConfigRefreshable, boolean initializeAsync) { - CoordinationService coordinationService = - CoordinationServices.createTransactionKeyValueServiceManagerCoordinator( - factory.coordinationValueClass(), - internalTablesKeyValueService, - lockAndTimestampServices.managedTimestampService(), - metricsManager, - config().initializeAsync()); + CoordinationService coordinationService = CoordinationServices.createDataKeyValueServiceManagerCoordinator( + factory.coordinationValueClass(), + internalTablesKeyValueService, + lockAndTimestampServices.managedTimestampService(), + metricsManager, + config().initializeAsync()); return factory.create( config().namespace() .orElseThrow(() -> new SafeIllegalArgumentException( - "Namespace must be set when using transactionKeyValueService")), + "Namespace must be set when using dataKeyValueService")), reloadingFactory() .withUserAgent(userAgent().addAgent(AtlasDbRemotingConstants.ATLASDB_HTTP_CLIENT_AGENT)), metricsManager, diff --git a/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagersInitializer.java b/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagersInitializer.java index d13a9283cc9..fe210bad210 100644 --- a/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagersInitializer.java +++ b/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagersInitializer.java @@ -17,7 +17,7 @@ import com.google.common.annotations.VisibleForTesting; import com.palantir.async.initializer.AsyncInitializer; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.logging.LoggingArgs; import com.palantir.atlasdb.table.description.Schema; @@ -30,18 +30,18 @@ public final class TransactionManagersInitializer extends AsyncInitializer { private KeyValueService internalKeyValueService; - private TransactionKeyValueServiceManager transactionKeyValueServiceManager; + private DataKeyValueServiceManager dataKeyValueServiceManager; private Set schemas; private final boolean allSafeForLogging; public static TransactionManagersInitializer createInitialTables( KeyValueService internalKeyValueService, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, Set schemas, boolean initializeAsync, boolean allSafeForLogging) { TransactionManagersInitializer initializer = new TransactionManagersInitializer( - internalKeyValueService, transactionKeyValueServiceManager, schemas, allSafeForLogging); + internalKeyValueService, dataKeyValueServiceManager, schemas, allSafeForLogging); initializer.initialize(initializeAsync); return initializer; } @@ -49,11 +49,11 @@ public static TransactionManagersInitializer createInitialTables( @VisibleForTesting TransactionManagersInitializer( KeyValueService internalKeyValueService, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, Set schemas, boolean allSafeForLogging) { this.internalKeyValueService = internalKeyValueService; - this.transactionKeyValueServiceManager = transactionKeyValueServiceManager; + this.dataKeyValueServiceManager = dataKeyValueServiceManager; this.schemas = schemas; this.allSafeForLogging = allSafeForLogging; } @@ -69,7 +69,7 @@ public synchronized void tryInitialize() { private void createTablesAndIndexes() { for (Schema schema : schemas) { - Schemas.createUserTablesAndIndexes(schema, transactionKeyValueServiceManager.getDdlManager()); + Schemas.createUserTablesAndIndexes(schema, dataKeyValueServiceManager.getDdlManager()); } } diff --git a/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/TransactionManagerModule.java b/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/TransactionManagerModule.java index 9839ac71cdb..6e7a8e2e190 100644 --- a/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/TransactionManagerModule.java +++ b/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/TransactionManagerModule.java @@ -18,7 +18,7 @@ import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.palantir.atlasdb.cache.DefaultTimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cleaner.CleanupFollower; import com.palantir.atlasdb.cleaner.DefaultCleanerBuilder; import com.palantir.atlasdb.cleaner.Follower; @@ -29,7 +29,7 @@ import com.palantir.atlasdb.factory.AtlasDbServiceDiscovery; import com.palantir.atlasdb.factory.LockAndTimestampServices; import com.palantir.atlasdb.keyvalue.api.KeyValueService; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.spi.AtlasDbFactory; import com.palantir.atlasdb.spi.DerivedSnapshotConfig; import com.palantir.atlasdb.spi.KeyValueServiceConfig; @@ -122,8 +122,7 @@ public SerializableTransactionManager provideTransactionManager( Cleaner cleaner, @Internal DerivedSnapshotConfig derivedSnapshotConfig, TransactionKnowledgeComponents knowledge) { - TransactionKeyValueServiceManager transactionKeyValueServiceManager = - new DelegatingTransactionKeyValueServiceManager(kvs); + DataKeyValueServiceManager dataKeyValueServiceManager = new DelegatingDataKeyValueServiceManager(kvs); DefaultDeleteExecutor deleteExecutor = new DefaultDeleteExecutor( kvs, Executors.newSingleThreadExecutor( @@ -131,7 +130,7 @@ public SerializableTransactionManager provideTransactionManager( // todo(gmaretic): should this be using a real sweep queue? return new SerializableTransactionManager( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, lts.timelock(), lts.lockWatcher(), lts.managedTimestampService(), @@ -155,7 +154,7 @@ public SerializableTransactionManager provideTransactionManager( Optional.empty(), knowledge, new DefaultKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, config.allowAccessToHiddenTables(), new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor), diff --git a/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/test/TestTransactionManagerModule.java b/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/test/TestTransactionManagerModule.java index c3177d8b628..4651ac475fa 100644 --- a/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/test/TestTransactionManagerModule.java +++ b/atlasdb-dagger/src/main/java/com/palantir/atlasdb/services/test/TestTransactionManagerModule.java @@ -18,7 +18,7 @@ import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.palantir.atlasdb.cache.DefaultTimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cleaner.CleanupFollower; import com.palantir.atlasdb.cleaner.DefaultCleanerBuilder; import com.palantir.atlasdb.cleaner.Follower; @@ -29,7 +29,7 @@ import com.palantir.atlasdb.factory.AtlasDbServiceDiscovery; import com.palantir.atlasdb.factory.LockAndTimestampServices; import com.palantir.atlasdb.keyvalue.api.KeyValueService; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.services.ServicesConfig; import com.palantir.atlasdb.spi.AtlasDbFactory; import com.palantir.atlasdb.spi.DerivedSnapshotConfig; @@ -123,13 +123,12 @@ public SerializableTransactionManager provideTransactionManager( Cleaner cleaner, @Internal DerivedSnapshotConfig derivedSnapshotConfig, TransactionKnowledgeComponents knowledge) { - TransactionKeyValueServiceManager transactionKeyValueServiceManager = - new DelegatingTransactionKeyValueServiceManager(kvs); + DataKeyValueServiceManager dataKeyValueServiceManager = new DelegatingDataKeyValueServiceManager(kvs); DefaultDeleteExecutor deleteExecutor = new DefaultDeleteExecutor(kvs, PTExecutors.newSingleThreadExecutor(true)); return new SerializableTransactionManager( metricsManager, - new DelegatingTransactionKeyValueServiceManager(kvs), + new DelegatingDataKeyValueServiceManager(kvs), lts.timelock(), lts.lockWatcher(), lts.managedTimestampService(), @@ -153,7 +152,7 @@ public SerializableTransactionManager provideTransactionManager( Optional.empty(), knowledge, new DefaultKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, config.allowAccessToHiddenTables(), new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor), diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/CoordinationServices.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/CoordinationServices.java index 57a4641cae9..ade46b9f477 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/CoordinationServices.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/internalschema/persistence/CoordinationServices.java @@ -57,14 +57,14 @@ public static CoordinationService createDefault( return wrapHidingVersionSerialization(versionedService); } - public static CoordinationService createTransactionKeyValueServiceManagerCoordinator( + public static CoordinationService createDataKeyValueServiceManagerCoordinator( Class valueClass, KeyValueService keyValueService, TimestampService timestampService, MetricsManager _metricsManager, boolean initializeAsync) { // TODO(jakubk): Add the versioning. - return new CoordinationServiceImpl<>(createTransactionKeyValueServiceManagerCoordinationStore( + return new CoordinationServiceImpl<>(createDataKeyValueServiceManagerCoordinationStore( keyValueService, timestampService::getFreshTimestamp, valueClass, initializeAsync)); } @@ -80,12 +80,12 @@ private static CoordinationStore createInternal initializeAsync); } - private static CoordinationStore createTransactionKeyValueServiceManagerCoordinationStore( + private static CoordinationStore createDataKeyValueServiceManagerCoordinationStore( KeyValueService keyValueService, LongSupplier timestampSupplier, Class clazz, boolean initializeAsync) { return KeyValueServiceCoordinationStore.create( ObjectMappers.newServerObjectMapper(), keyValueService, - AtlasDbConstants.DEFAULT_TRANSACTION_KEY_VALUE_SERVICE_COORDINATION_KEY, + AtlasDbConstants.DEFAULT_DATA_KEY_VALUE_SERVICE_COORDINATION_KEY, timestampSupplier, Object::equals, clazz, diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ColumnRangeBatchProvider.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ColumnRangeBatchProvider.java index 6b3927cbb02..74c9e5a44fe 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ColumnRangeBatchProvider.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ColumnRangeBatchProvider.java @@ -17,7 +17,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.RangeRequests; @@ -33,19 +33,19 @@ import javax.annotation.Nullable; public class ColumnRangeBatchProvider implements BatchProvider> { - private final TransactionKeyValueService transactionKeyValueService; + private final DataKeyValueService dataKeyValueService; private final TableReference tableRef; private final byte[] row; private final BatchColumnRangeSelection columnRangeSelection; private final long timestamp; public ColumnRangeBatchProvider( - TransactionKeyValueService transactionKeyValueService, + DataKeyValueService dataKeyValueService, TableReference tableRef, byte[] row, BatchColumnRangeSelection columnRangeSelection, long timestamp) { - this.transactionKeyValueService = transactionKeyValueService; + this.dataKeyValueService = dataKeyValueService; this.tableRef = tableRef; this.row = row; this.columnRangeSelection = columnRangeSelection; @@ -61,7 +61,7 @@ public ClosableIterator> getBatch(int batchSize, @Nullabl BatchColumnRangeSelection newRange = BatchColumnRangeSelection.create(startCol, columnRangeSelection.getEndCol(), batchSize); Map range = - transactionKeyValueService.getRowsColumnRange(tableRef, ImmutableList.of(row), newRange, timestamp); + dataKeyValueService.getRowsColumnRange(tableRef, ImmutableList.of(row), newRange, timestamp); if (range.isEmpty()) { return ClosableIterators.wrapWithEmptyClose( ImmutableList.>of().iterator()); diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandler.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandler.java index 83173f7c182..d7fa3009c04 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandler.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandler.java @@ -17,7 +17,7 @@ package com.palantir.atlasdb.transaction.impl; import com.google.common.collect.Maps; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.api.Value; @@ -41,17 +41,17 @@ * exist situations where the read sentinel is a result of other operations running on the underlying key-value-service. */ public final class ReadSentinelHandler { - private final TransactionKeyValueService transactionKeyValueService; + private final DataKeyValueService dataKeyValueService; private final TransactionService transactionService; private final TransactionReadSentinelBehavior readSentinelBehavior; private final OrphanedSentinelDeleter orphanedSentinelDeleter; public ReadSentinelHandler( - TransactionKeyValueService transactionKeyValueService, + DataKeyValueService dataKeyValueService, TransactionService transactionService, TransactionReadSentinelBehavior readSentinelBehavior, OrphanedSentinelDeleter orphanedSentinelDeleter) { - this.transactionKeyValueService = transactionKeyValueService; + this.dataKeyValueService = dataKeyValueService; this.transactionService = transactionService; this.readSentinelBehavior = readSentinelBehavior; this.orphanedSentinelDeleter = orphanedSentinelDeleter; @@ -72,7 +72,7 @@ public Set findAndMarkOrphanedSweepSentinelsForDeletion(TableReference tab // if committed value seen, stop: the sentinel is not orphaned // if we get back -1, the sentinel is orphaned Map timestampCandidates = new HashMap<>( - transactionKeyValueService.getLatestTimestamps(table, Maps.asMap(sweepSentinels, x -> Long.MAX_VALUE))); + dataKeyValueService.getLatestTimestamps(table, Maps.asMap(sweepSentinels, x -> Long.MAX_VALUE))); Set actualOrphanedSentinels = new HashSet<>(); while (!timestampCandidates.isEmpty()) { @@ -100,7 +100,7 @@ public Set findAndMarkOrphanedSweepSentinelsForDeletion(TableReference tab Map nextTimestampCandidates = KeyedStream.stream(cellsToQuery) .filter(cellStartTimestamp -> !committedStartTimestamps.contains(cellStartTimestamp)) .collectToMap(); - timestampCandidates = transactionKeyValueService.getLatestTimestamps(table, nextTimestampCandidates); + timestampCandidates = dataKeyValueService.getLatestTimestamps(table, nextTimestampCandidates); } orphanedSentinelDeleter.scheduleSentinelsForDeletion(table, actualOrphanedSentinels); diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/RowRangeBatchProvider.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/RowRangeBatchProvider.java index eb0b676d1f5..105793447c1 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/RowRangeBatchProvider.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/RowRangeBatchProvider.java @@ -16,7 +16,7 @@ package com.palantir.atlasdb.transaction.impl; import com.google.errorprone.annotations.MustBeClosed; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.RangeRequest; import com.palantir.atlasdb.keyvalue.api.RangeRequests; import com.palantir.atlasdb.keyvalue.api.RowResult; @@ -29,17 +29,14 @@ import javax.annotation.Nullable; public class RowRangeBatchProvider implements BatchProvider> { - private final TransactionKeyValueService transactionKeyValueService; + private final DataKeyValueService dataKeyValueService; private final TableReference tableRef; private final RangeRequest range; private final long timestamp; public RowRangeBatchProvider( - TransactionKeyValueService transactionKeyValueService, - TableReference tableRef, - RangeRequest range, - long timestamp) { - this.transactionKeyValueService = transactionKeyValueService; + DataKeyValueService dataKeyValueService, TableReference tableRef, RangeRequest range, long timestamp) { + this.dataKeyValueService = dataKeyValueService; this.tableRef = tableRef; this.range = range; this.timestamp = timestamp; @@ -53,7 +50,7 @@ public ClosableIterator> getBatch(int batchSize, @Nullable byte newRange.startRowInclusive(RangeRequests.getNextStartRow(range.isReverse(), lastToken)); } newRange.batchHint(batchSize); - return transactionKeyValueService.getRange(tableRef, newRange.build(), timestamp); + return dataKeyValueService.getRange(tableRef, newRange.build(), timestamp); } @Override diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransaction.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransaction.java index d25c856255c..83515891647 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransaction.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransaction.java @@ -37,7 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.cleaner.NoOpCleaner; import com.palantir.atlasdb.cleaner.api.Cleaner; import com.palantir.atlasdb.debug.ConflictTracer; @@ -146,7 +146,7 @@ public class SerializableTransaction extends SnapshotTransaction { public SerializableTransaction( MetricsManager metricsManager, - TransactionKeyValueService keyValueService, + DataKeyValueService keyValueService, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TransactionService transactionService, @@ -915,7 +915,7 @@ private NavigableMap getReadsInRange(TableReference table, RangeRe private Transaction getReadOnlyTransaction(final long commitTs) { return new SnapshotTransaction( metricsManager, - transactionKeyValueService, + dataKeyValueService, timelockService, lockWatchManager, defaultTransactionService, diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManager.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManager.java index c0a988fb133..b9e4c062b75 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManager.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManager.java @@ -20,7 +20,7 @@ import com.palantir.async.initializer.Callback; import com.palantir.atlasdb.cache.DefaultTimestampCache; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cleaner.api.Cleaner; import com.palantir.atlasdb.debug.ConflictTracer; import com.palantir.atlasdb.keyvalue.api.watch.LockWatchManagerInternal; @@ -67,7 +67,7 @@ public class SerializableTransactionManager extends SnapshotTransactionManager { public static class InitializeCheckingWrapper implements AutoDelegate_TransactionManager { private final TransactionManager txManager; - private final TransactionKeyValueServiceManager transactionKeyValueServiceManager; + private final DataKeyValueServiceManager dataKeyValueServiceManager; private final Supplier initializationPrerequisite; private final Callback callback; @@ -78,12 +78,12 @@ public static class InitializeCheckingWrapper implements AutoDelegate_Transactio InitializeCheckingWrapper( TransactionManager manager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, Supplier initializationPrerequisite, Callback callback, ScheduledExecutorService initializer) { this.txManager = manager; - this.transactionKeyValueServiceManager = transactionKeyValueServiceManager; + this.dataKeyValueServiceManager = dataKeyValueServiceManager; this.initializationPrerequisite = initializationPrerequisite; this.callback = callback; this.executorService = initializer; @@ -169,7 +169,7 @@ private boolean isInitializedInternal() { // TransactionManagers.create; however, this is not required for the TransactionManager to fulfil // requests (note that it is not accessible from any TransactionManager implementation), so we omit // checking here whether it is initialized. - return transactionKeyValueServiceManager.isInitialized() + return dataKeyValueServiceManager.isInitialized() && txManager.getTimelockService().isInitialized() && txManager.getTimestampService().isInitialized() && txManager.getCleaner().isInitialized() @@ -226,7 +226,7 @@ private enum State { public static TransactionManager createInstrumented( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TimestampManagementService timestampManagementService, @@ -253,7 +253,7 @@ public static TransactionManager createInstrumented( KeyValueSnapshotReaderManager keyValueSnapshotReaderManager) { return create( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, timelockService, lockWatchManager, timestampManagementService, @@ -285,7 +285,7 @@ public static TransactionManager createInstrumented( public static TransactionManager create( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TimestampManagementService timestampManagementService, @@ -312,7 +312,7 @@ public static TransactionManager create( KeyValueSnapshotReaderManager keyValueSnapshotReaderManager) { return create( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, timelockService, lockWatchManager, timestampManagementService, @@ -343,7 +343,7 @@ public static TransactionManager create( public static TransactionManager create( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TimestampManagementService timestampManagementService, @@ -371,7 +371,7 @@ public static TransactionManager create( KeyValueSnapshotReaderManager keyValueSnapshotReaderManager) { return create( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, timelockService, lockWatchManager, timestampManagementService, @@ -402,7 +402,7 @@ public static TransactionManager create( private static TransactionManager create( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TimestampManagementService timestampManagementService, @@ -431,7 +431,7 @@ private static TransactionManager create( KeyValueSnapshotReaderManager keyValueSnapshotReaderManager) { TransactionManager transactionManager = new SerializableTransactionManager( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, timelockService, lockWatchManager, timestampManagementService, @@ -448,7 +448,7 @@ private static TransactionManager create( sweepQueueWriter, // TODO(jakubk): This will be updated in further PRs as it needs to use the same API as sweep. DefaultDeleteExecutor.createDefault( - transactionKeyValueServiceManager.getKeyValueService().orElseThrow()), + dataKeyValueServiceManager.getKeyValueService().orElseThrow()), validateLocksOnReads, transactionConfig, conflictTracer, @@ -469,7 +469,7 @@ private static TransactionManager create( return initializeAsync ? new InitializeCheckingWrapper( transactionManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, initializationPrerequisite, callback, initializer) @@ -478,7 +478,7 @@ private static TransactionManager create( public static SerializableTransactionManager createForTest( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService legacyTimeLockService, TimestampManagementService timestampManagementService, LockService lockService, @@ -493,10 +493,10 @@ public static SerializableTransactionManager createForTest( MultiTableSweepQueueWriter sweepQueue, TransactionKnowledgeComponents knowledge) { DeleteExecutor deleteExecutor = DefaultDeleteExecutor.createDefault( - transactionKeyValueServiceManager.getKeyValueService().orElseThrow()); + dataKeyValueServiceManager.getKeyValueService().orElseThrow()); return new SerializableTransactionManager( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, legacyTimeLockService, lockWatchManager, timestampManagementService, @@ -519,7 +519,7 @@ public static SerializableTransactionManager createForTest( Optional.empty(), knowledge, new DefaultKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, false, new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor), @@ -528,7 +528,7 @@ public static SerializableTransactionManager createForTest( public SerializableTransactionManager( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TimestampManagementService timestampManagementService, @@ -553,7 +553,7 @@ public SerializableTransactionManager( KeyValueSnapshotReaderManager keyValueSnapshotReaderManager) { super( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, timelockService, lockWatchManager, timestampManagementService, @@ -587,7 +587,7 @@ protected CallbackAwareTransaction createTransaction( PreCommitCondition preCommitCondition) { return new SerializableTransaction( metricsManager, - transactionKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier), + dataKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier), timelockService, lockWatchManager, transactionService, diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java index 57202ef647d..753d481ed34 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java @@ -49,7 +49,7 @@ import com.palantir.atlasdb.AtlasDbMetricNames; import com.palantir.atlasdb.AtlasDbPerformanceConstants; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.cleaner.api.Cleaner; import com.palantir.atlasdb.debug.ConflictTracer; import com.palantir.atlasdb.encoding.PtBytes; @@ -115,8 +115,8 @@ import com.palantir.atlasdb.transaction.expectations.ExpectationsMetrics; import com.palantir.atlasdb.transaction.impl.ImmutableTimestampLockManager.SummarizedLockCheckResult; import com.palantir.atlasdb.transaction.impl.expectations.CellCountValidator; -import com.palantir.atlasdb.transaction.impl.expectations.TrackingTransactionKeyValueService; -import com.palantir.atlasdb.transaction.impl.expectations.TrackingTransactionKeyValueServiceImpl; +import com.palantir.atlasdb.transaction.impl.expectations.TrackingDataKeyValueService; +import com.palantir.atlasdb.transaction.impl.expectations.TrackingDataKeyValueServiceImpl; import com.palantir.atlasdb.transaction.impl.metrics.DefaultKeyValueSnapshotMetricRecorder; import com.palantir.atlasdb.transaction.impl.metrics.SnapshotTransactionMetricFactory; import com.palantir.atlasdb.transaction.impl.metrics.TableLevelMetricsController; @@ -253,7 +253,7 @@ private enum State { protected final TimelockService timelockService; protected final LockWatchManagerInternal lockWatchManager; - final TrackingTransactionKeyValueService transactionKeyValueService; + final TrackingDataKeyValueService dataKeyValueService; final TransactionService defaultTransactionService; private final AsyncTransactionService immediateTransactionService; private final Cleaner cleaner; @@ -327,7 +327,7 @@ private enum State { */ /* package */ SnapshotTransaction( MetricsManager metricsManager, - TransactionKeyValueService delegateTransactionKeyValueService, + DataKeyValueService delegateDataKeyValueService, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TransactionService transactionService, @@ -357,8 +357,7 @@ private enum State { this.metricsManager = metricsManager; this.lockWatchManager = lockWatchManager; this.conflictTracer = conflictTracer; - this.transactionKeyValueService = - new TrackingTransactionKeyValueServiceImpl(delegateTransactionKeyValueService); + this.dataKeyValueService = new TrackingDataKeyValueServiceImpl(delegateDataKeyValueService); this.timelockService = timelockService; this.defaultTransactionService = transactionService; this.immediateTransactionService = TransactionServices.synchronousAsAsyncTransactionService(transactionService); @@ -403,7 +402,7 @@ private enum State { preCommitRequirementValidator, validateLocksOnReads, sweepStrategyManager, transactionConfig); this.commitTimestampLoader = commitTimestampLoader; this.readSentinelHandler = new ReadSentinelHandler( - transactionKeyValueService, + dataKeyValueService, transactionService, readSentinelBehavior, new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor)); @@ -542,7 +541,7 @@ public Iterator> getRowsColumnRange( } ImmutableList stableRows = ImmutableList.copyOf(rows); hasReads = true; - RowColumnRangeIterator rawResults = transactionKeyValueService.getRowsColumnRange( + RowColumnRangeIterator rawResults = dataKeyValueService.getRowsColumnRange( tableRef, stableRows, columnRangeSelection, batchHint, getStartTimestamp()); if (!rawResults.hasNext()) { // we can't skip checks for range scans @@ -564,8 +563,7 @@ public Map>> getRowsColumnRangeIterator } hasReads = true; ImmutableSortedMap rawResults = ImmutableSortedMap.copyOf( - transactionKeyValueService.getRowsColumnRange( - tableRef, rows, columnRangeSelection, getStartTimestamp()), + dataKeyValueService.getRowsColumnRange(tableRef, rows, columnRangeSelection, getStartTimestamp()), PtBytes.BYTES_COMPARATOR); ImmutableSortedMap>> postFilteredResults = Streams.stream(rows) .collect(ImmutableSortedMap.toImmutableSortedMap(PtBytes.BYTES_COMPARATOR, row -> row, row -> { @@ -604,8 +602,8 @@ public Iterator> getSortedColumns( BatchColumnRangeSelection perBatchSelection = BatchColumnRangeSelection.create( batchColumnRangeSelection.getStartCol(), batchColumnRangeSelection.getEndCol(), batchSize); - Map rawResults = transactionKeyValueService.getRowsColumnRange( - tableRef, distinctRows, perBatchSelection, getStartTimestamp()); + Map rawResults = + dataKeyValueService.getRowsColumnRange(tableRef, distinctRows, perBatchSelection, getStartTimestamp()); return scopeToTransaction( getPostFilteredSortedColumns(tableRef, batchColumnRangeSelection, distinctRows, rawResults)); @@ -778,7 +776,7 @@ private ClosableIterator> getRowColumnRangePostFiltered( BatchColumnRangeSelection columnRangeSelection, RowColumnRangeIterator rawIterator) { ColumnRangeBatchProvider batchProvider = new ColumnRangeBatchProvider( - transactionKeyValueService, tableRef, row, columnRangeSelection, getStartTimestamp()); + dataKeyValueService, tableRef, row, columnRangeSelection, getStartTimestamp()); return GetRowsColumnRangeIterator.iterator( batchProvider, rawIterator, @@ -916,8 +914,8 @@ public SortedMap> getRowsIgnoringLocalWrites( } hasReads = true; - Map rawResults = new HashMap<>( - transactionKeyValueService.getRows(tableRef, rows, ColumnSelection.all(), getStartTimestamp())); + Map rawResults = + new HashMap<>(dataKeyValueService.getRows(tableRef, rows, ColumnSelection.all(), getStartTimestamp())); // can't skip lock check as we don't know how many cells to expect for the column selection validatePreCommitRequirementsOnNonExhaustiveReadIfNecessary(tableRef, getStartTimestamp()); @@ -1113,7 +1111,7 @@ public Iterable>> getRanges( .getTimer("processedRangeMillis") .time(); Map, byte[]>> firstPages = - transactionKeyValueService.getFirstBatchForRanges(tableRef, input, getStartTimestamp()); + dataKeyValueService.getFirstBatchForRanges(tableRef, input, getStartTimestamp()); // can't skip lock check for range scans validatePreCommitRequirementsOnNonExhaustiveReadIfNecessary(tableRef, getStartTimestamp()); @@ -1412,7 +1410,7 @@ private List> postFilterEmptyValues( protected ClosableIterator> postFilterIterator( TableReference tableRef, RangeRequest range, int preFilterBatchSize, Function transformer) { RowRangeBatchProvider batchProvider = - new RowRangeBatchProvider(transactionKeyValueService, tableRef, range, getStartTimestamp()); + new RowRangeBatchProvider(dataKeyValueService, tableRef, range, getStartTimestamp()); BatchSizeIncreasingIterator> results = new BatchSizeIncreasingIterator<>(batchProvider, preFilterBatchSize, null); Iterator>> batchedPostFiltered = new AbstractIterator>>() { @@ -1519,14 +1517,14 @@ private int estimateSize(List> rangeRows) { private Collection> getWithPostFilteringSync( TableReference tableRef, Map rawResults, Function transformer) { return AtlasFutures.getUnchecked(getWithPostFilteringAsync( - tableRef, rawResults, transformer, transactionKeyValueService, immediateTransactionService)); + tableRef, rawResults, transformer, dataKeyValueService, immediateTransactionService)); } private ListenableFuture>> getWithPostFilteringAsync( TableReference tableRef, Map rawResults, Function transformer, - TransactionKeyValueService asyncKeyValueService, + DataKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { long bytes = 0; for (Map.Entry entry : rawResults.entrySet()) { @@ -1577,7 +1575,7 @@ private ListenableFuture>> getWithPostFilterin Map resultsToPostFilter, Collection> resultsAccumulator, Function transformer, - TransactionKeyValueService asyncKeyValueService, + DataKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { return Futures.transformAsync( Futures.immediateFuture(resultsToPostFilter), @@ -1618,7 +1616,7 @@ private ListenableFuture> getWithPostFilteringInternal( Map rawResults, @Output Collection> resultsCollector, Function transformer, - TransactionKeyValueService asyncKeyValueService, + DataKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { Set orphanedSentinels = readSentinelHandler.findAndMarkOrphanedSweepSentinelsForDeletion(tableRef, rawResults); @@ -1642,7 +1640,7 @@ private ListenableFuture> collectCellsToPostFilter( Map rawResults, @Output Collection> resultsCollector, Function transformer, - TransactionKeyValueService asyncKeyValueService, + DataKeyValueService asyncKeyValueService, Set orphanedSentinels, LongLongMap commitTimestamps) { Map keysToReload = Maps.newHashMapWithExpectedSize(0); @@ -2023,7 +2021,7 @@ private void commitWrites(TransactionService transactionService) { // Write to the key value service. We must do this before getting the commit timestamp - otherwise // we risk another transaction starting at a timestamp after our commit timestamp not seeing our writes. - timedAndTraced("commitWrite", () -> transactionKeyValueService.multiPut(writes, getStartTimestamp())); + timedAndTraced("commitWrite", () -> dataKeyValueService.multiPut(writes, getStartTimestamp())); // Now that all writes are done, get the commit timestamp // We must do this before we check that our locks are still valid to ensure that other transactions that @@ -2042,14 +2040,12 @@ private void commitWrites(TransactionService transactionService) { // Not timed as this is generally an asynchronous operation. traced("microsForPunch", () -> cleaner.punch(commitTimestamp)); - // Check the transactional key-value-service is still the source of truth at the commit timestamp. + // Check the data key-value-service is still the source of truth at the commit timestamp. // This can take place anytime before the actual commit (the putUnlessExists). However, situations - // in which the transaction key-value-service is invalid may also affect subsequent checks, and we + // in which the data key-value-service is invalid may also affect subsequent checks, and we // would prefer for these to be flagged explicitly as such. // Timed; this may in some implementations end up requiring external RPCs or database calls. - timedAndTraced( - "transactionKvsValidityCheck", - () -> throwIfTransactionKeyValueServiceNoLongerValid(commitTimestamp)); + timedAndTraced("dataKvsValidityCheck", () -> throwIfDataKeyValueServiceNoLongerValid(commitTimestamp)); // Serializable transactions need to check their reads haven't changed, by reading again at // commitTs + 1. This must happen before the lock check for thorough tables, because the lock check @@ -2092,8 +2088,8 @@ private void commitWrites(TransactionService transactionService) { }); } - private void throwIfTransactionKeyValueServiceNoLongerValid(long commitTimestamp) { - if (!transactionKeyValueService.isValid(commitTimestamp)) { + private void throwIfDataKeyValueServiceNoLongerValid(long commitTimestamp) { + if (!dataKeyValueService.isValid(commitTimestamp)) { throw new SafeTransactionFailedRetriableException( "Transaction key value service is no longer valid", SafeArg.of("startTimestamp", getStartTimestamp()), @@ -2212,7 +2208,7 @@ private void throwIfValueChangedConflict( Map oldValues = getIgnoringLocalWrites(tableRef, cellToTs.keySet()); Map conflictingValues = - AtlasFutures.getUnchecked(transactionKeyValueService.getAsync(tableRef, cellToTs)); + AtlasFutures.getUnchecked(dataKeyValueService.getAsync(tableRef, cellToTs)); Set conflictingCells = new HashSet<>(); for (Map.Entry cellEntry : cellToTs.entrySet()) { @@ -2278,7 +2274,7 @@ protected Map detectWriteAlreadyCommittedInternal( @Output Set dominatingWrites, TransactionService transactionService) { long startTs = getStartTimestamp(); - Map rawResults = transactionKeyValueService.getLatestTimestamps(tableRef, keysToLoad); + Map rawResults = dataKeyValueService.getLatestTimestamps(tableRef, keysToLoad); LongLongMap commitTimestamps = AtlasFutures.getUnchecked(commitTimestampLoader.getCommitTimestampsNonBlockingForValidation( tableRef, LongLists.immutable.ofAll(rawResults.values()))); @@ -2665,7 +2661,7 @@ public long getAgeMillis() { @Override public TransactionReadInfo getReadInfo() { - return transactionKeyValueService.getOverallReadInfo(); + return dataKeyValueService.getOverallReadInfo(); } @Override diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManager.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManager.java index 870a1ce961d..0db399f10f7 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManager.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManager.java @@ -24,8 +24,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Streams; import com.palantir.atlasdb.cache.TimestampCache; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cell.api.DdlManager; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; import com.palantir.atlasdb.cleaner.NoOpCleaner; import com.palantir.atlasdb.cleaner.api.Cleaner; import com.palantir.atlasdb.debug.ConflictTracer; @@ -89,7 +89,7 @@ private static final int NUM_RETRIES = 10; final MetricsManager metricsManager; - final TransactionKeyValueServiceManager transactionKeyValueServiceManager; + final DataKeyValueServiceManager dataKeyValueServiceManager; final TransactionService transactionService; final TimelockService timelockService; final LockWatchManagerInternal lockWatchManager; @@ -120,7 +120,7 @@ protected SnapshotTransactionManager( MetricsManager metricsManager, - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TimelockService timelockService, LockWatchManagerInternal lockWatchManager, TimestampManagementService timestampManagementService, @@ -147,7 +147,7 @@ protected SnapshotTransactionManager( this.lockWatchManager = lockWatchManager; TimestampTracker.instrumentTimestamps(metricsManager, timelockService, cleaner); this.metricsManager = metricsManager; - this.transactionKeyValueServiceManager = transactionKeyValueServiceManager; + this.dataKeyValueServiceManager = dataKeyValueServiceManager; this.timelockService = timelockService; this.timestampManagementService = timestampManagementService; this.lockService = lockService; @@ -317,7 +317,7 @@ protected CallbackAwareTransaction createTransaction( Optional immutableTimestampLock = Optional.of(immutableTsLock); return new SnapshotTransaction( metricsManager, - transactionKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier), + dataKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier), timelockService, lockWatchManager, transactionService, @@ -365,7 +365,7 @@ private T runTaskWithCond Optional immutableTimestampLock = Optional.empty(); SnapshotTransaction transaction = new SnapshotTransaction( metricsManager, - transactionKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier), + dataKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier), timelockService, NoOpLockWatchManager.create(), transactionService, @@ -426,7 +426,7 @@ public void close() { SafeShutdownRunner.createWithCachedThreadpool(Duration.ofSeconds(20))) { shutdownRunner.shutdownSafely(super::close); shutdownRunner.shutdownSafely(cleaner::close); - shutdownRunner.shutdownSafely(transactionKeyValueServiceManager::close); + shutdownRunner.shutdownSafely(dataKeyValueServiceManager::close); shutdownRunner.shutdownSafely(deleteExecutor::close); shutdownRunner.shutdownSafely(() -> shutdownExecutor(getRangesExecutor)); shutdownRunner.shutdownSafely(this::closeLockServiceIfPossible); @@ -528,14 +528,14 @@ public Cleaner getCleaner() { @Override public KeyValueService getKeyValueService() { - return transactionKeyValueServiceManager + return dataKeyValueServiceManager .getKeyValueService() .orElseThrow(() -> new SafeIllegalStateException("KeyValueService is not supported")); } @Override public DdlManager getDdlManager() { - return transactionKeyValueServiceManager.getDdlManager(); + return dataKeyValueServiceManager.getDdlManager(); } @Override diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueService.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueService.java similarity index 86% rename from atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueService.java rename to atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueService.java index 1d102a1d6e2..ff8effd88f0 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueService.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueService.java @@ -17,11 +17,11 @@ package com.palantir.atlasdb.transaction.impl.expectations; import com.google.common.collect.ImmutableMap; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.transaction.api.expectations.TransactionReadInfo; -public interface TrackingTransactionKeyValueService extends TransactionKeyValueService { +public interface TrackingDataKeyValueService extends DataKeyValueService { TransactionReadInfo getOverallReadInfo(); ImmutableMap getReadInfoByTable(); diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceImpl.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceImpl.java similarity index 92% rename from atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceImpl.java rename to atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceImpl.java index 016a9a10e31..caa54495315 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceImpl.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceImpl.java @@ -20,8 +20,8 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; -import com.palantir.atlasdb.cell.api.AutoDelegate_TransactionKeyValueService; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.AutoDelegate_DataKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection; @@ -40,17 +40,17 @@ import java.util.function.ToLongFunction; import one.util.streamex.EntryStream; -public final class TrackingTransactionKeyValueServiceImpl - implements AutoDelegate_TransactionKeyValueService, TrackingTransactionKeyValueService { - private final TransactionKeyValueService delegate; +public final class TrackingDataKeyValueServiceImpl + implements AutoDelegate_DataKeyValueService, TrackingDataKeyValueService { + private final DataKeyValueService delegate; private final KeyValueServiceDataTracker tracker = new KeyValueServiceDataTracker(); - public TrackingTransactionKeyValueServiceImpl(TransactionKeyValueService delegate) { + public TrackingDataKeyValueServiceImpl(DataKeyValueService delegate) { this.delegate = delegate; } @Override - public TransactionKeyValueService delegate() { + public DataKeyValueService delegate() { return delegate; } diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReader.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReader.java index 3fd2d5cf393..a48cc39a9f7 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReader.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReader.java @@ -25,7 +25,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.palantir.atlasdb.AtlasDbConstants; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.futures.AtlasFutures; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.ColumnSelection; @@ -76,7 +76,7 @@ public final class DefaultKeyValueSnapshotReader implements KeyValueSnapshotRead // TODO (jkong): Move canonical value of constant here, once post-filtering is removed from SnapshotTransaction private static final int MAX_POST_FILTERING_ITERATIONS = SnapshotTransaction.MAX_POST_FILTERING_ITERATIONS; - private final TransactionKeyValueService transactionKeyValueService; + private final DataKeyValueService dataKeyValueService; private final TransactionService transactionService; private final CommitTimestampLoader commitTimestampLoader; private final boolean allowHiddenTableAccess; @@ -87,7 +87,7 @@ public final class DefaultKeyValueSnapshotReader implements KeyValueSnapshotRead private final KeyValueSnapshotMetricRecorder metricRecorder; public DefaultKeyValueSnapshotReader( - TransactionKeyValueService transactionKeyValueService, + DataKeyValueService dataKeyValueService, TransactionService transactionService, CommitTimestampLoader commitTimestampLoader, boolean allowHiddenTableAccess, @@ -96,7 +96,7 @@ public DefaultKeyValueSnapshotReader( ReadSnapshotValidator readSnapshotValidator, DeleteExecutor deleteExecutor, KeyValueSnapshotMetricRecorder metricRecorder) { - this.transactionKeyValueService = transactionKeyValueService; + this.dataKeyValueService = dataKeyValueService; this.transactionService = transactionService; this.commitTimestampLoader = commitTimestampLoader; this.allowHiddenTableAccess = allowHiddenTableAccess; @@ -118,8 +118,8 @@ public NavigableMap> getRows( Iterable rows, ColumnSelection columnSelection, Map localWrites) { - Map rawResults = new HashMap<>(transactionKeyValueService.getRows( - tableReference, rows, columnSelection, startTimestampSupplier.getAsLong())); + Map rawResults = new HashMap<>( + dataKeyValueService.getRows(tableReference, rows, columnSelection, startTimestampSupplier.getAsLong())); // We don't need to do work postFiltering if we have a write locally. rawResults.keySet().removeAll(localWrites.keySet()); @@ -138,7 +138,7 @@ public NavigableMap> getRows( private ListenableFuture> getInternal(TableReference tableReference, Set cells) { Map timestampsByCell = Cells.constantValueMap(cells, startTimestampSupplier.getAsLong()); ListenableFuture>> postFilteredResults = Futures.transformAsync( - transactionKeyValueService.getAsync(tableReference, timestampsByCell), + dataKeyValueService.getAsync(tableReference, timestampsByCell), rawResults -> getWithPostFilteringAsync(tableReference, rawResults, Value.GET_VALUE), MoreExecutors.directExecutor()); @@ -293,7 +293,7 @@ private ListenableFuture> collectCellsToPostFilter( if (!keysToReload.isEmpty()) { // TODO (jkong): Consider removing when a decision on validating pre-commit requirements mid-read is made return Futures.transform( - transactionKeyValueService.getAsync(tableRef, keysToReload), + dataKeyValueService.getAsync(tableRef, keysToReload), nextRawResults -> { boolean allPossibleCellsReadAndPresent = nextRawResults.size() == keysToReload.size(); readSnapshotValidator.throwIfPreCommitRequirementsNotMetOnRead( diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReaderManager.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReaderManager.java index 9c81c807771..a2bdcbf07eb 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReaderManager.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/snapshot/DefaultKeyValueSnapshotReaderManager.java @@ -16,8 +16,8 @@ package com.palantir.atlasdb.transaction.impl.snapshot; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.transaction.api.DeleteExecutor; import com.palantir.atlasdb.transaction.api.OrphanedSentinelDeleter; import com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReader; @@ -26,19 +26,19 @@ import com.palantir.atlasdb.transaction.service.TransactionService; public final class DefaultKeyValueSnapshotReaderManager implements KeyValueSnapshotReaderManager { - private final TransactionKeyValueServiceManager transactionKeyValueServiceManager; + private final DataKeyValueServiceManager dataKeyValueServiceManager; private final TransactionService transactionService; private final boolean allowHiddenTableAccess; private final OrphanedSentinelDeleter orphanedSentinelDeleter; private final DeleteExecutor deleteExecutor; public DefaultKeyValueSnapshotReaderManager( - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TransactionService transactionService, boolean allowHiddenTableAccess, OrphanedSentinelDeleter orphanedSentinelDeleter, DeleteExecutor deleteExecutor) { - this.transactionKeyValueServiceManager = transactionKeyValueServiceManager; + this.dataKeyValueServiceManager = dataKeyValueServiceManager; this.transactionService = transactionService; this.allowHiddenTableAccess = allowHiddenTableAccess; this.orphanedSentinelDeleter = orphanedSentinelDeleter; @@ -47,17 +47,16 @@ public DefaultKeyValueSnapshotReaderManager( @Override public KeyValueSnapshotReader createKeyValueSnapshotReader(TransactionContext transactionContext) { - TransactionKeyValueService transactionKeyValueService = - transactionKeyValueServiceManager.getTransactionKeyValueService( - transactionContext.startTimestampSupplier()); + DataKeyValueService dataKeyValueService = + dataKeyValueServiceManager.getDataKeyValueService(transactionContext.startTimestampSupplier()); return new DefaultKeyValueSnapshotReader( - transactionKeyValueService, + dataKeyValueService, transactionService, transactionContext.commitTimestampLoader(), allowHiddenTableAccess, // TODO (jkong): The allocations here feel wasteful. Should we have a cache of some kind? new ReadSentinelHandler( - transactionKeyValueService, + dataKeyValueService, transactionService, transactionContext.transactionReadSentinelBehavior(), orphanedSentinelDeleter), diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/GetRowsColumnRangeIteratorTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/GetRowsColumnRangeIteratorTest.java index bb28da786dc..ff644c8b569 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/GetRowsColumnRangeIteratorTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/GetRowsColumnRangeIteratorTest.java @@ -29,13 +29,13 @@ import com.google.common.collect.Iterators; import com.google.common.collect.Maps; import com.google.common.collect.Streams; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.RowColumnRangeIterator; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.api.Value; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueService; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueService; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import java.nio.charset.StandardCharsets; import java.util.Iterator; @@ -59,10 +59,9 @@ public class GetRowsColumnRangeIteratorTest { public static final BatchColumnRangeSelection COLUMN_RANGE_SELECTION = BatchColumnRangeSelection.create(null, null, BATCH_SIZE); - private final TransactionKeyValueService tkvs = - new DelegatingTransactionKeyValueService(new InMemoryKeyValueService(true)); + private final DataKeyValueService dkvs = new DelegatingDataKeyValueService(new InMemoryKeyValueService(true)); private final ColumnRangeBatchProvider batchProvider = - new ColumnRangeBatchProvider(tkvs, TABLE_REFERENCE, ROW, COLUMN_RANGE_SELECTION, Long.MAX_VALUE); + new ColumnRangeBatchProvider(dkvs, TABLE_REFERENCE, ROW, COLUMN_RANGE_SELECTION, Long.MAX_VALUE); @Test public void ifBatchIsEmptyNoValidateCallsAreMade() { @@ -133,13 +132,13 @@ private Set putColumns(int numberOfColumns) { .mapToObj(i -> String.format("cell%02d", i).getBytes(StandardCharsets.UTF_8)) .map(column -> Cell.create(ROW, column)) .collect(ImmutableMap.toImmutableMap(Function.identity(), _unused -> value)); - tkvs.multiPut(Map.of(TABLE_REFERENCE, puts), 1L); + dkvs.multiPut(Map.of(TABLE_REFERENCE, puts), 1L); return puts.keySet(); } private RowColumnRangeIterator getInitialIterator() { - return tkvs.getRowsColumnRange(TABLE_REFERENCE, ImmutableList.of(ROW), COLUMN_RANGE_SELECTION, Long.MAX_VALUE) + return dkvs.getRowsColumnRange(TABLE_REFERENCE, ImmutableList.of(ROW), COLUMN_RANGE_SELECTION, Long.MAX_VALUE) .get(ROW); } diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandlerTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandlerTest.java index d668810e2f6..77ba8beef4a 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandlerTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/ReadSentinelHandlerTest.java @@ -28,7 +28,7 @@ import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.api.Value; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueService; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueService; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import com.palantir.atlasdb.transaction.api.OrphanedSentinelDeleter; import com.palantir.atlasdb.transaction.api.TransactionFailedRetriableException; @@ -66,7 +66,7 @@ public final class ReadSentinelHandlerTest { @BeforeEach public void setUp() { readSentinelHandler = new ReadSentinelHandler( - new DelegatingTransactionKeyValueService(keyValueService), + new DelegatingDataKeyValueService(keyValueService), transactionService, TransactionReadSentinelBehavior.THROW_EXCEPTION, orphanedSentinelDeleter); @@ -138,7 +138,7 @@ public void handleReadSentinelThrowsExceptionsIfConfigured() { @Test public void handleReadSentinelDoesNothingIfConfigured() { ReadSentinelHandler ignoringReadSentinelHandler = new ReadSentinelHandler( - new DelegatingTransactionKeyValueService(keyValueService), + new DelegatingDataKeyValueService(keyValueService), transactionService, TransactionReadSentinelBehavior.IGNORE, orphanedSentinelDeleter); diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceForwardingTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceForwardingTest.java similarity index 95% rename from atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceForwardingTest.java rename to atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceForwardingTest.java index c4d3308f4fc..28da9034823 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceForwardingTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceForwardingTest.java @@ -27,7 +27,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection; @@ -54,16 +54,16 @@ import org.mockito.junit.jupiter.MockitoExtension; /** - * Broadly tests that {@link TrackingTransactionKeyValueServiceImpl} methods forward delegate results using: physical equality + * Broadly tests that {@link TrackingDataKeyValueServiceImpl} methods forward delegate results using: physical equality * when relevant, and element/component physical equality when the semantics are different (methods returning * iterators or collections of iterators). * Mocks are used whenever possible. Exceptions include: types which cannot be mocked (e.g. byte arrays), * interfaces/implementations annotated with {@link org.mockito.DoNotMock} or similar (e.g. {@link Multimap}), and * when the method semantics and resulting tests impose it (e.g. methods where an iterator is wrapped can only be tested - * by equality/in-order testing of its components, {@link TrackingTransactionKeyValueServiceImpl#getCandidateCellsForSweeping}). + * by equality/in-order testing of its components, {@link TrackingDataKeyValueServiceImpl#getCandidateCellsForSweeping}). */ @ExtendWith(MockitoExtension.class) -public final class TrackingTransactionKeyValueServiceForwardingTest { +public final class TrackingDataKeyValueServiceForwardingTest { private static final long TIMESTAMP = 12L; private static final byte[] BYTES_1 = new byte[1]; private static final byte[] BYTES_2 = new byte[2]; @@ -88,13 +88,13 @@ public final class TrackingTransactionKeyValueServiceForwardingTest { private Map valueByCellMap; @Mock - private TransactionKeyValueService delegate; + private DataKeyValueService delegate; - private TrackingTransactionKeyValueService trackingKvs; + private TrackingDataKeyValueService trackingKvs; @BeforeEach public void setUp() { - trackingKvs = new TrackingTransactionKeyValueServiceImpl(delegate); + trackingKvs = new TrackingDataKeyValueServiceImpl(delegate); } @Test diff --git a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceReadInfoTest.java b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceReadInfoTest.java similarity index 91% rename from atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceReadInfoTest.java rename to atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceReadInfoTest.java index 37d6db42957..7afdc8bd065 100644 --- a/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingTransactionKeyValueServiceReadInfoTest.java +++ b/atlasdb-impl-shared/src/test/java/com/palantir/atlasdb/transaction/impl/expectations/TrackingDataKeyValueServiceReadInfoTest.java @@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.SettableFuture; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection; @@ -57,7 +57,7 @@ * Note that the range of possible sizes will be larger if we use different sizes for different tests. */ @ExtendWith(MockitoExtension.class) -public final class TrackingTransactionKeyValueServiceReadInfoTest { +public final class TrackingDataKeyValueServiceReadInfoTest { private static final String PARAMETERIZED_TEST_NAME = "size = {0}"; public static List sizes() { @@ -73,14 +73,14 @@ public static List sizes() { private RangeRequest rangeRequest; @Mock - private TransactionKeyValueService tkvs; + private DataKeyValueService dkvs; - private TrackingTransactionKeyValueService trackingKvs; + private TrackingDataKeyValueService trackingKvs; private ImmutableMap valueByCellMapOfSize; @BeforeEach public void beforeEach() { - this.trackingKvs = new TrackingTransactionKeyValueServiceImpl(tkvs); + this.trackingKvs = new TrackingDataKeyValueServiceImpl(dkvs); } @Mock @@ -93,7 +93,7 @@ public void beforeEach() { @MethodSource("sizes") public void readInfoIsCorrectAfterGetAsyncCallAndFutureConsumption(int size) { setup(size); - when(tkvs.getAsync(tableReference, timestampByCellMap)) + when(dkvs.getAsync(tableReference, timestampByCellMap)) .thenReturn(Futures.immediateFuture(valueByCellMapOfSize)); trackingKvs.getAsync(tableReference, timestampByCellMap); @@ -106,7 +106,7 @@ public void readInfoIsCorrectAfterGetAsyncCallAndFutureConsumption(int size) { public void getAsyncTracksNothingBeforeDelegateResultCompletionAndTracksReadsAfterCompletion(int size) { setup(size); SettableFuture> delegateFuture = SettableFuture.create(); - when(tkvs.getAsync(tableReference, timestampByCellMap)).thenReturn(delegateFuture); + when(dkvs.getAsync(tableReference, timestampByCellMap)).thenReturn(delegateFuture); trackingKvs.getAsync(tableReference, timestampByCellMap); // tracking nothing @@ -127,7 +127,7 @@ public void getAsyncTracksNothingBeforeDelegateResultCompletionAndTracksReadsAft @MethodSource("sizes") public void throwingGetAsyncResultTracksNothing(int size) { setup(size); - when(tkvs.getAsync(tableReference, timestampByCellMap)) + when(dkvs.getAsync(tableReference, timestampByCellMap)) .thenReturn(Futures.immediateFailedFuture(new RuntimeException())); // ignore exception @@ -147,7 +147,7 @@ public void throwingGetAsyncResultTracksNothing(int size) { public void readInfoIsCorrectAfterGetRowsCall(int size) { setup(size); ColumnSelection columnSelection = mock(ColumnSelection.class); - when(tkvs.getRows(tableReference, rows, columnSelection, TIMESTAMP)).thenReturn(valueByCellMapOfSize); + when(dkvs.getRows(tableReference, rows, columnSelection, TIMESTAMP)).thenReturn(valueByCellMapOfSize); trackingKvs.getRows(tableReference, rows, columnSelection, TIMESTAMP); @@ -159,7 +159,7 @@ public void readInfoIsCorrectAfterGetRowsCall(int size) { public void readInfoIsCorrectAfterGetRowsBatchColumnRangeCallAndIteratorsConsumption(int size) { setup(size); BatchColumnRangeSelection batchColumnRangeSelection = mock(BatchColumnRangeSelection.class); - when(tkvs.getRowsColumnRange(tableReference, rows, batchColumnRangeSelection, TIMESTAMP)) + when(dkvs.getRowsColumnRange(tableReference, rows, batchColumnRangeSelection, TIMESTAMP)) .thenReturn(TrackingKeyValueServiceTestUtils.createRowColumnRangeIteratorByByteArrayMutableMapWithSize( size)); @@ -177,7 +177,7 @@ public void readInfoIsCorrectAfterGetRowsColumnRangeCallAndIteratorConsumption(i setup(size); int cellBatchHint = 17; ColumnRangeSelection columnRangeSelection = mock(ColumnRangeSelection.class); - when(tkvs.getRowsColumnRange(tableReference, rows, columnRangeSelection, cellBatchHint, TIMESTAMP)) + when(dkvs.getRowsColumnRange(tableReference, rows, columnRangeSelection, cellBatchHint, TIMESTAMP)) .thenReturn(new LocalRowColumnRangeIterator( valueByCellMapOfSize.entrySet().iterator())); @@ -193,7 +193,7 @@ public void readInfoIsCorrectAfterGetRowsColumnRangeCallAndIteratorConsumption(i public void readInfoIsCorrectAfterGetLatestTimestampsCall(int size) { setup(size); Map timestampByCellMapOfSize = TrackingKeyValueServiceTestUtils.createLongByCellMapWithSize(size); - when(tkvs.getLatestTimestamps(tableReference, timestampByCellMap)).thenReturn(timestampByCellMapOfSize); + when(dkvs.getLatestTimestamps(tableReference, timestampByCellMap)).thenReturn(timestampByCellMapOfSize); trackingKvs.getLatestTimestamps(tableReference, timestampByCellMap); @@ -208,7 +208,7 @@ public void readInfoIsCorrectAfterGetRangeCallAndIteratorConsumption(int size) { List> backingValueRowResultListOfSize = TrackingKeyValueServiceTestUtils.createValueRowResultListWithSize(size); - when(tkvs.getRange(tableReference, rangeRequest, TIMESTAMP)) + when(dkvs.getRange(tableReference, rangeRequest, TIMESTAMP)) .thenReturn(ClosableIterators.wrapWithEmptyClose(backingValueRowResultListOfSize.iterator())); trackingKvs.getRange(tableReference, rangeRequest, TIMESTAMP).forEachRemaining(_unused -> {}); @@ -224,7 +224,7 @@ public void readInfoIsCorrectAfterGetFirstBatchForRangesCall(int size) { Map, byte[]>> pageByRangeRequestMapOfSize = TrackingKeyValueServiceTestUtils.createPageByRangeRequestMapWithSize(size); - when(tkvs.getFirstBatchForRanges(tableReference, rangeRequests, TIMESTAMP)) + when(dkvs.getFirstBatchForRanges(tableReference, rangeRequests, TIMESTAMP)) .thenReturn(pageByRangeRequestMapOfSize); trackingKvs.getFirstBatchForRanges(tableReference, rangeRequests, TIMESTAMP); diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/SweepTestUtils.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/SweepTestUtils.java index f3c65d1ffe7..ca1d626a109 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/SweepTestUtils.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/sweep/SweepTestUtils.java @@ -19,7 +19,7 @@ import com.palantir.atlasdb.cleaner.api.Cleaner; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.watch.NoOpLockWatchManager; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.schema.SweepSchema; import com.palantir.atlasdb.schema.TargetedSweepSchema; import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter; @@ -80,7 +80,7 @@ public static TransactionManager setupTxManager( TransactionKnowledgeComponents.createForTests(kvs, metricsManager.getTaggedRegistry()); TransactionManager txManager = SerializableTransactionManager.createForTest( metricsManager, - new DelegatingTransactionKeyValueServiceManager(kvs), + new DelegatingDataKeyValueServiceManager(kvs), legacyTimelockService, tsmService, lockService, diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractSerializableTransactionTest.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractSerializableTransactionTest.java index 27bce38dd7c..6a8b8239484 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractSerializableTransactionTest.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/AbstractSerializableTransactionTest.java @@ -54,7 +54,7 @@ import com.palantir.atlasdb.keyvalue.api.RowResult; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.api.watch.NoOpLockWatchManager; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.impl.KvsManager; import com.palantir.atlasdb.keyvalue.impl.TransactionManagerManager; import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter; @@ -121,7 +121,7 @@ protected TransactionManager createManager() { MultiTableSweepQueueWriter sweepQueue = getSweepQueueWriterUninitialized(); SerializableTransactionManager txManager = SerializableTransactionManager.createForTest( MetricsManagers.createForTests(), - new DelegatingTransactionKeyValueServiceManager(keyValueService), + new DelegatingDataKeyValueServiceManager(keyValueService), timelockService, timestampManagementService, lockService, @@ -153,7 +153,7 @@ private Transaction startTransactionWithOptions(TransactionOptions options) { LongSupplier startTimestampSupplier = Suppliers.ofInstance(timestampService.getFreshTimestamp())::get; return new SerializableTransaction( MetricsManagers.createForTests(), - transactionKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier), + dataKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier), timelockService, NoOpLockWatchManager.create(), transactionService, @@ -173,7 +173,7 @@ private Transaction startTransactionWithOptions(TransactionOptions options) { AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY, getSweepQueueWriterInitialized(), new DefaultDeleteExecutor( - transactionKeyValueServiceManager.getKeyValueService().orElseThrow(), + dataKeyValueServiceManager.getKeyValueService().orElseThrow(), MoreExecutors.newDirectExecutorService()), true, transactionConfigSupplier, diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TestTransactionManagerImpl.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TestTransactionManagerImpl.java index 61984357f0c..69478c7b491 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TestTransactionManagerImpl.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TestTransactionManagerImpl.java @@ -19,13 +19,13 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cleaner.NoOpCleaner; import com.palantir.atlasdb.debug.ConflictTracer; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.impl.AssertLockedKeyValueService; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter; import com.palantir.atlasdb.transaction.ImmutableTransactionConfig; import com.palantir.atlasdb.transaction.TransactionConfig; @@ -117,7 +117,7 @@ public TestTransactionManagerImpl( private TestTransactionManagerImpl( MetricsManager metricsManager, - TransactionKeyValueServiceManager keyValueService, + DataKeyValueServiceManager keyValueService, AbstractInMemoryTimelockExtension services, LockService lockService, TransactionService transactionService, @@ -162,8 +162,8 @@ protected boolean shouldStopRetrying(int numTimesFailed) { return false; } - private static TransactionKeyValueServiceManager createAssertKeyValue(KeyValueService kv, LockService lock) { - return new DelegatingTransactionKeyValueServiceManager(new AssertLockedKeyValueService(kv, lock)); + private static DataKeyValueServiceManager createAssertKeyValue(KeyValueService kv, LockService lock) { + return new DelegatingDataKeyValueServiceManager(new AssertLockedKeyValueService(kv, lock)); } @Override @@ -187,7 +187,7 @@ protected CallbackAwareTransaction createTransaction( return transactionWrapper.apply( new SerializableTransaction( metricsManager, - transactionKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier), + dataKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier), timelockService, lockWatchManager, transactionService, diff --git a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TransactionTestSetup.java b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TransactionTestSetup.java index 2a2e37cb159..b9de73dbf09 100644 --- a/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TransactionTestSetup.java +++ b/atlasdb-tests-shared/src/main/java/com/palantir/atlasdb/transaction/impl/TransactionTestSetup.java @@ -22,7 +22,7 @@ import com.google.common.util.concurrent.MoreExecutors; import com.palantir.atlasdb.ComparingTimestampCache; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.coordination.CoordinationService; import com.palantir.atlasdb.encoding.PtBytes; import com.palantir.atlasdb.internalschema.ImmutableInternalSchemaInstallConfig; @@ -36,7 +36,7 @@ import com.palantir.atlasdb.keyvalue.api.Value; import com.palantir.atlasdb.keyvalue.api.watch.LockWatchManagerInternal; import com.palantir.atlasdb.keyvalue.impl.Cells; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.impl.KvsManager; import com.palantir.atlasdb.keyvalue.impl.TransactionManagerManager; import com.palantir.atlasdb.persistent.api.PersistentStore; @@ -120,7 +120,7 @@ public static void storageTearDown() throws Exception { protected final MetricsManager metricsManager = MetricsManagers.createForTests(); protected KeyValueService keyValueService; - protected TransactionKeyValueServiceManager transactionKeyValueServiceManager; + protected DataKeyValueServiceManager dataKeyValueServiceManager; protected TimestampService timestampService; protected TimestampManagementService timestampManagementService; protected TransactionSchemaManager transactionSchemaManager; @@ -154,9 +154,9 @@ public void setUp() { lockClient = LockClient.of("test_client"); keyValueService = getKeyValueService(); - transactionKeyValueServiceManager = new DelegatingTransactionKeyValueServiceManager(keyValueService); + dataKeyValueServiceManager = new DelegatingDataKeyValueServiceManager(keyValueService); deleteExecutor = DefaultDeleteExecutor.createDefault( - transactionKeyValueServiceManager.getKeyValueService().orElseThrow()); + dataKeyValueServiceManager.getKeyValueService().orElseThrow()); keyValueService.createTables(ImmutableMap.of( TEST_TABLE_THOROUGH, TableMetadata.builder() @@ -213,7 +213,7 @@ public void setUp() { conflictDetectionManager = ConflictDetectionManagers.createWithoutWarmingCache(keyValueService); sweepStrategyManager = SweepStrategyManagers.createDefault(keyValueService); keyValueSnapshotReaderManager = new DefaultKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, false, new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor), diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/AtlasDbTestCase.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/AtlasDbTestCase.java index d676154ef09..8a2f0026dc3 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/AtlasDbTestCase.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/AtlasDbTestCase.java @@ -19,10 +19,10 @@ import com.google.common.util.concurrent.MoreExecutors; import com.palantir.atlasdb.cache.DefaultTimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.TableReference; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import com.palantir.atlasdb.keyvalue.impl.StatsTrackingKeyValueService; import com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService; @@ -67,7 +67,7 @@ public class AtlasDbTestCase { protected LockClient lockClient; protected LockService lockService; protected TrackingKeyValueService keyValueService; - protected TransactionKeyValueServiceManager txnKeyValueServiceManager; + protected DataKeyValueServiceManager txnKeyValueServiceManager; protected TimelockService timelockService; protected TimestampService timestampService; protected ConflictDetectionManager conflictDetectionManager; @@ -95,7 +95,7 @@ public void setUp() throws Exception { timelockService = inMemoryTimelockExtension.getLegacyTimelockService(); timestampService = inMemoryTimelockExtension.getTimestampService(); keyValueService = trackingKeyValueService(getBaseKeyValueService()); - txnKeyValueServiceManager = new DelegatingTransactionKeyValueServiceManager(keyValueService); + txnKeyValueServiceManager = new DelegatingDataKeyValueServiceManager(keyValueService); TransactionTables.createTables(keyValueService); transactionService = spy(TransactionServices.createRaw(keyValueService, timestampService, false)); conflictDetectionManager = ConflictDetectionManagers.createWithoutWarmingCache(keyValueService); diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/keyvalue/impl/TableTasksTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/keyvalue/impl/TableTasksTest.java index 14a16273878..d3dca310a24 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/keyvalue/impl/TableTasksTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/keyvalue/impl/TableTasksTest.java @@ -87,7 +87,7 @@ public void setup() { Cleaner cleaner = new NoOpCleaner(); txManager = SerializableTransactionManager.createForTest( metricsManager, - new DelegatingTransactionKeyValueServiceManager(kvs), + new DelegatingDataKeyValueServiceManager(kvs), inMemoryTimelockExtension.getLegacyTimelockService(), inMemoryTimelockExtension.getTimestampManagementService(), lockService, diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/AbstractSnapshotTransactionTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/AbstractSnapshotTransactionTest.java index ed53c138309..74e7a8efbd0 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/AbstractSnapshotTransactionTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/AbstractSnapshotTransactionTest.java @@ -56,7 +56,7 @@ import com.palantir.atlasdb.AtlasDbTestCase; import com.palantir.atlasdb.cache.DefaultTimestampCache; import com.palantir.atlasdb.cache.TimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import com.palantir.atlasdb.cleaner.NoOpCleaner; import com.palantir.atlasdb.debug.ConflictTracer; import com.palantir.atlasdb.encoding.PtBytes; @@ -231,18 +231,15 @@ public abstract class AbstractSnapshotTransactionTest extends AtlasDbTestCase { @FunctionalInterface interface ExpectationFactory { Expectations apply( - TransactionKeyValueService transactionKeyValueService, - Cell cell, - long transactionTs, - LockService lockService) + DataKeyValueService dataKeyValueService, Cell cell, long transactionTs, LockService lockService) throws InterruptedException; } private Expectations asyncGetExpectation( - TransactionKeyValueService tkvMock, Cell cell, long transactionTs, LockService lockMock) { + DataKeyValueService dkvMock, Cell cell, long transactionTs, LockService lockMock) { return new Expectations() { { - oneOf(tkvMock).getAsync(TABLE, ImmutableMap.of(cell, transactionTs)); + oneOf(dkvMock).getAsync(TABLE, ImmutableMap.of(cell, transactionTs)); will(returnValue(Futures.immediateFailedFuture(new RuntimeException()))); } }; @@ -426,7 +423,7 @@ public void testLockAfterGet() throws Exception { byte[] rowName = PtBytes.toBytes("1"); Mockery mockery = new Mockery(); mockery.setThreadingPolicy(new Synchroniser()); - final TransactionKeyValueService tkvsMock = mockery.mock(TransactionKeyValueService.class); + final DataKeyValueService dkvsMock = mockery.mock(DataKeyValueService.class); final LockService lockMock = mockery.mock(LockService.class); LockService lock = MultiDelegateProxy.newProxyInstance(LockService.class, lockService, lockMock); @@ -436,7 +433,7 @@ public void testLockAfterGet() throws Exception { final long transactionTs = timestampService.getFreshTimestamp(); keyValueService.put(TABLE, ImmutableMap.of(cell, PtBytes.EMPTY_BYTE_ARRAY), startTs); - mockery.checking(asyncGetExpectation(tkvsMock, cell, transactionTs, lockMock)); + mockery.checking(asyncGetExpectation(dkvsMock, cell, transactionTs, lockMock)); mockery.checking(new Expectations() { { never(lockMock).lockWithFullLockResponse(with(LockClient.ANONYMOUS), with(any(LockRequest.class))); @@ -446,14 +443,14 @@ public void testLockAfterGet() throws Exception { PathTypeTracker pathTypeTracker = PathTypeTrackers.constructSynchronousTracker(); DeleteExecutor typedDeleteExecutor = new DefaultDeleteExecutor(keyValueService, deleteExecutor); KeyValueSnapshotReaderManager manager = TestKeyValueSnapshotReaderManagers.createForTests( - new FakeTransactionKeyValueServiceManager(tkvsMock), + new FakeDataKeyValueServiceManager(dkvsMock), transactionService, sweepStrategyManager, typedDeleteExecutor); Transaction snapshot = transactionWrapper.apply( new SnapshotTransaction( metricsManager, - tkvsMock, + dkvsMock, inMemoryTimelockExtension.getLegacyTimelockService(), NoOpLockWatchManager.create(), transactionService, @@ -2024,24 +2021,21 @@ public void canReadWithExpectedSizeOneAfterDeletingPresentCellAndWritingToAnothe } @Test - public void throwsRetriableExceptionIfTransactionKeyValueServiceNoLongerValid() { + public void throwsRetryableExceptionIfDataKeyValueServiceNoLongerValid() { ConjureStartTransactionsResponse startedTransactions = startTransactionWithWatches(); long transactionTs = startedTransactions.getTimestamps().start(); LongSupplier startTimestampSupplier = () -> transactionTs; - InvalidatableTransactionKeyValueService invalidatableTransactionKeyValueService = - new InvalidatableTransactionKeyValueService( - txnKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier)); + InvalidatableDataKeyValueService invalidatableDataKeyValueService = new InvalidatableDataKeyValueService( + txnKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier)); SnapshotTransaction snapshotTransaction = getSnapshotTransactionWith( - startTimestampSupplier, - startedTransactions.getImmutableTimestamp(), - invalidatableTransactionKeyValueService); + startTimestampSupplier, startedTransactions.getImmutableTimestamp(), invalidatableDataKeyValueService); PathTypeTracker pathTypeTracker = PathTypeTrackers.constructSynchronousTracker(); Transaction callbackAwareTransaction = transactionWrapper.apply(snapshotTransaction, pathTypeTracker); callbackAwareTransaction.put(TABLE, ImmutableMap.of(TEST_CELL, TEST_VALUE)); - invalidatableTransactionKeyValueService.invalidate(); + invalidatableDataKeyValueService.invalidate(); assertThatLoggableExceptionThrownBy(callbackAwareTransaction::commit) .isInstanceOf(TransactionFailedRetriableException.class) .hasLogMessage("Transaction key value service is no longer valid") @@ -2051,23 +2045,20 @@ public void throwsRetriableExceptionIfTransactionKeyValueServiceNoLongerValid() } @Test - public void doesNotThrowExceptionIfTransactionKeyValueServiceNoLongerValidOnTransactionNotPerformingWrites() { + public void doesNotThrowExceptionIfDataKeyValueServiceNoLongerValidOnTransactionNotPerformingWrites() { ConjureStartTransactionsResponse startedTransactions = startTransactionWithWatches(); long transactionTs = startedTransactions.getTimestamps().start(); LongSupplier startTimestampSupplier = () -> transactionTs; - InvalidatableTransactionKeyValueService invalidatableTransactionKeyValueService = - new InvalidatableTransactionKeyValueService( - txnKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier)); + InvalidatableDataKeyValueService invalidatableDataKeyValueService = new InvalidatableDataKeyValueService( + txnKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier)); SnapshotTransaction snapshotTransaction = getSnapshotTransactionWith( - startTimestampSupplier, - startedTransactions.getImmutableTimestamp(), - invalidatableTransactionKeyValueService); + startTimestampSupplier, startedTransactions.getImmutableTimestamp(), invalidatableDataKeyValueService); PathTypeTracker pathTypeTracker = PathTypeTrackers.constructSynchronousTracker(); Transaction callbackAwareTransaction = transactionWrapper.apply(snapshotTransaction, pathTypeTracker); callbackAwareTransaction.get(TABLE, ImmutableSet.of(TEST_CELL)); - invalidatableTransactionKeyValueService.invalidate(); + invalidatableDataKeyValueService.invalidate(); assertThatCode(callbackAwareTransaction::commit) .as("although the transaction key value service was no longer valid, read transactions performed" @@ -3414,28 +3405,28 @@ private SnapshotTransaction getSnapshotTransactionWith( startTimestampSupplier, res, mockLockWatchManager, - txnKeyValueServiceManager.getTransactionKeyValueService(startTimestampSupplier)); + txnKeyValueServiceManager.getDataKeyValueService(startTimestampSupplier)); } private SnapshotTransaction getSnapshotTransactionWith( LongSupplier startTimestampSupplier, LockImmutableTimestampResponse lockImmutableTimestampResponse, - InvalidatableTransactionKeyValueService invalidatableTransactionKeyValueService) { + InvalidatableDataKeyValueService invalidatableDataKeyValueService) { return getSnapshotTransactionWith( startTimestampSupplier, lockImmutableTimestampResponse, inMemoryTimelockExtension.getLockWatchManager(), - invalidatableTransactionKeyValueService); + invalidatableDataKeyValueService); } private SnapshotTransaction getSnapshotTransactionWith( LongSupplier startTimestampSupplier, LockImmutableTimestampResponse res, LockWatchManagerInternal lockWatchManagerInternal, - TransactionKeyValueService transactionKeyValueService) { + DataKeyValueService dataKeyValueService) { return new SnapshotTransaction( metricsManager, - transactionKeyValueService, + dataKeyValueService, timelockService, lockWatchManagerInternal, transactionService, @@ -3496,7 +3487,7 @@ private Transaction getSnapshotTransactionWith( PathTypeTracker pathTypeTracker = PathTypeTrackers.constructSynchronousTracker(); SnapshotTransaction transaction = new SnapshotTransaction( metricsManager, - txnKeyValueServiceManager.getTransactionKeyValueService(startTs::get), + txnKeyValueServiceManager.getDataKeyValueService(startTs::get), timelockService, inMemoryTimelockExtension.getLockWatchManager(), transactionService, diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/FakeTransactionKeyValueServiceManager.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/FakeDataKeyValueServiceManager.java similarity index 74% rename from atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/FakeTransactionKeyValueServiceManager.java rename to atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/FakeDataKeyValueServiceManager.java index 14e7f3aa315..8e80852108e 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/FakeTransactionKeyValueServiceManager.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/FakeDataKeyValueServiceManager.java @@ -16,23 +16,23 @@ package com.palantir.atlasdb.transaction.impl; +import com.palantir.atlasdb.cell.api.DataKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cell.api.DdlManager; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.logsafe.exceptions.SafeIllegalStateException; import java.util.Optional; import java.util.function.LongSupplier; -public final class FakeTransactionKeyValueServiceManager implements TransactionKeyValueServiceManager { - private final TransactionKeyValueService delegate; +public final class FakeDataKeyValueServiceManager implements DataKeyValueServiceManager { + private final DataKeyValueService delegate; - public FakeTransactionKeyValueServiceManager(TransactionKeyValueService delegate) { + public FakeDataKeyValueServiceManager(DataKeyValueService delegate) { this.delegate = delegate; } @Override - public TransactionKeyValueService getTransactionKeyValueService(LongSupplier timestampSupplier) { + public DataKeyValueService getDataKeyValueService(LongSupplier timestampSupplier) { return delegate; } diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/InvalidatableTransactionKeyValueService.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/InvalidatableDataKeyValueService.java similarity index 70% rename from atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/InvalidatableTransactionKeyValueService.java rename to atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/InvalidatableDataKeyValueService.java index 6b6780be595..2252dc1372a 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/InvalidatableTransactionKeyValueService.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/InvalidatableDataKeyValueService.java @@ -16,21 +16,21 @@ package com.palantir.atlasdb.transaction.impl; -import com.palantir.atlasdb.cell.api.AutoDelegate_TransactionKeyValueService; -import com.palantir.atlasdb.cell.api.TransactionKeyValueService; +import com.palantir.atlasdb.cell.api.AutoDelegate_DataKeyValueService; +import com.palantir.atlasdb.cell.api.DataKeyValueService; import java.util.concurrent.atomic.AtomicBoolean; -public final class InvalidatableTransactionKeyValueService implements AutoDelegate_TransactionKeyValueService { - private final TransactionKeyValueService delegate; +public final class InvalidatableDataKeyValueService implements AutoDelegate_DataKeyValueService { + private final DataKeyValueService delegate; private final AtomicBoolean isStillValid; - public InvalidatableTransactionKeyValueService(TransactionKeyValueService delegate) { + public InvalidatableDataKeyValueService(DataKeyValueService delegate) { this.delegate = delegate; this.isStillValid = new AtomicBoolean(true); } @Override - public TransactionKeyValueService delegate() { + public DataKeyValueService delegate() { return delegate; } diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManagerTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManagerTest.java index 6a8b55c90e3..c19a5d20d2d 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManagerTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SerializableTransactionManagerTest.java @@ -34,7 +34,7 @@ import com.palantir.atlasdb.keyvalue.api.ClusterAvailabilityStatus; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.watch.NoOpLockWatchManager; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter; import com.palantir.atlasdb.transaction.ImmutableTransactionConfig; import com.palantir.atlasdb.transaction.api.KeyValueServiceStatus; @@ -277,7 +277,7 @@ private TransactionManager getManagerWithCallback( boolean initializeAsync, Callback callBack, ScheduledExecutorService executor) { return SerializableTransactionManager.create( metricsManager, - new DelegatingTransactionKeyValueServiceManager(mockKvs), + new DelegatingDataKeyValueServiceManager(mockKvs), mockTimelockService, NoOpLockWatchManager.create(), mockTimestampManagementService, @@ -303,7 +303,7 @@ private TransactionManager getManagerWithCallback( Optional.empty(), knowledge, new DefaultKeyValueSnapshotReaderManager( - new DelegatingTransactionKeyValueServiceManager(mockKvs), + new DelegatingDataKeyValueServiceManager(mockKvs), mock(TransactionService.class), false, mock(DefaultOrphanedSentinelDeleter.class), diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManagerTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManagerTest.java index dd30eeda74e..ac0ef3a0193 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManagerTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/SnapshotTransactionManagerTest.java @@ -31,12 +31,12 @@ import com.google.common.collect.ImmutableList; import com.palantir.atlasdb.cache.DefaultTimestampCache; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.cleaner.api.Cleaner; import com.palantir.atlasdb.debug.ConflictTracer; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.watch.NoOpLockWatchManager; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter; import com.palantir.atlasdb.transaction.ImmutableTransactionConfig; import com.palantir.atlasdb.transaction.api.AtlasDbConstraintCheckingMode; @@ -80,8 +80,8 @@ public class SnapshotTransactionManagerTest { private final Cleaner cleaner = mock(Cleaner.class); private final KeyValueService keyValueService = mock(KeyValueService.class); - private final TransactionKeyValueServiceManager transactionKeyValueServiceManager = - new DelegatingTransactionKeyValueServiceManager(keyValueService); + private final DataKeyValueServiceManager dataKeyValueServiceManager = + new DelegatingDataKeyValueServiceManager(keyValueService); private final MetricsManager metricsManager = MetricsManagers.createForTests(); @@ -102,7 +102,7 @@ public void setUp() { timestampService = inMemoryTimelockClassExtension.getManagedTimestampService(); snapshotTransactionManager = new SnapshotTransactionManager( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, inMemoryTimelockClassExtension.getLegacyTimelockService(), NoOpLockWatchManager.create(), timestampService, @@ -160,7 +160,7 @@ public void closesDeleteExecutorOnClosingTransactionManager() { public void canCloseTransactionManagerWithNonCloseableLockService() { SnapshotTransactionManager newTransactionManager = new SnapshotTransactionManager( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, inMemoryTimelockClassExtension.getLegacyTimelockService(), NoOpLockWatchManager.create(), inMemoryTimelockClassExtension.getManagedTimestampService(), @@ -300,7 +300,7 @@ private SnapshotTransactionManager createSnapshotTransactionManager( TimelockService timelockService, boolean grabImmutableTsLockOnReads) { return new SnapshotTransactionManager( metricsManager, - transactionKeyValueServiceManager, + dataKeyValueServiceManager, timelockService, NoOpLockWatchManager.create(), timestampService, @@ -329,9 +329,6 @@ private SnapshotTransactionManager createSnapshotTransactionManager( private KeyValueSnapshotReaderManager getKeyValueSnapshotReaderManager(SweepStrategyManager sweepStrategyManager) { return TestKeyValueSnapshotReaderManagers.createForTests( - transactionKeyValueServiceManager, - mock(TransactionService.class), - sweepStrategyManager, - deleteExecutor); + dataKeyValueServiceManager, mock(TransactionService.class), sweepStrategyManager, deleteExecutor); } } diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TestKeyValueSnapshotReaderManagers.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TestKeyValueSnapshotReaderManagers.java index 5cd39c79cd4..fdfc2fd2a7d 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TestKeyValueSnapshotReaderManagers.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TestKeyValueSnapshotReaderManagers.java @@ -16,9 +16,9 @@ package com.palantir.atlasdb.transaction.impl; -import com.palantir.atlasdb.cell.api.TransactionKeyValueServiceManager; +import com.palantir.atlasdb.cell.api.DataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.api.KeyValueService; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.transaction.api.DeleteExecutor; import com.palantir.atlasdb.transaction.api.snapshot.KeyValueSnapshotReaderManager; import com.palantir.atlasdb.transaction.impl.snapshot.DefaultKeyValueSnapshotReaderManager; @@ -32,7 +32,7 @@ static KeyValueSnapshotReaderManager createForTests( SweepStrategyManager sweepStrategyManager, DeleteExecutor deleteExecutor) { return new DefaultKeyValueSnapshotReaderManager( - new DelegatingTransactionKeyValueServiceManager(keyValueService), + new DelegatingDataKeyValueServiceManager(keyValueService), transactionService, false, new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor), @@ -40,12 +40,12 @@ static KeyValueSnapshotReaderManager createForTests( } static KeyValueSnapshotReaderManager createForTests( - TransactionKeyValueServiceManager transactionKeyValueServiceManager, + DataKeyValueServiceManager dataKeyValueServiceManager, TransactionService transactionService, SweepStrategyManager sweepStrategyManager, DeleteExecutor deleteExecutor) { return new DefaultKeyValueSnapshotReaderManager( - transactionKeyValueServiceManager, + dataKeyValueServiceManager, transactionService, false, new DefaultOrphanedSentinelDeleter(sweepStrategyManager::get, deleteExecutor), diff --git a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TransactionManagerTest.java b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TransactionManagerTest.java index 3c44760a95d..d92fdcc820d 100644 --- a/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TransactionManagerTest.java +++ b/atlasdb-tests-shared/src/test/java/com/palantir/atlasdb/transaction/impl/TransactionManagerTest.java @@ -29,7 +29,7 @@ import com.palantir.atlasdb.debug.ConflictTracer; import com.palantir.atlasdb.keyvalue.api.KeyValueService; import com.palantir.atlasdb.keyvalue.api.watch.NoOpLockWatchManager; -import com.palantir.atlasdb.keyvalue.impl.DelegatingTransactionKeyValueServiceManager; +import com.palantir.atlasdb.keyvalue.impl.DelegatingDataKeyValueServiceManager; import com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService; import com.palantir.atlasdb.keyvalue.impl.TestResourceManager; import com.palantir.atlasdb.sweep.queue.MultiTableSweepQueueWriter; @@ -123,7 +123,7 @@ public void shouldNotMakeRemoteCallsInAReadOnlyTransactionIfNoWorkIsDone() { LockService mockLockService = mock(LockService.class); TransactionManager txnManagerWithMocks = SerializableTransactionManager.createForTest( metricsManager, - new DelegatingTransactionKeyValueServiceManager(getKeyValueService()), + new DelegatingDataKeyValueServiceManager(getKeyValueService()), mockTimeLockService, mockTimestampManagementService, mockLockService, @@ -248,7 +248,7 @@ private TransactionManager setupTransactionManager() { LockService mockLockService = mock(LockService.class); TransactionManager txnManagerWithMocks = new SerializableTransactionManager( metricsManager, - new DelegatingTransactionKeyValueServiceManager(keyValueService), + new DelegatingDataKeyValueServiceManager(keyValueService), timelock, NoOpLockWatchManager.create(), timeManagement, diff --git a/changelog/@unreleased/pr-7307.v2.yml b/changelog/@unreleased/pr-7307.v2.yml new file mode 100644 index 00000000000..d8c0ec6933b --- /dev/null +++ b/changelog/@unreleased/pr-7307.v2.yml @@ -0,0 +1,5 @@ +type: feature +feature: + description: rename TransactionKeyValueService to DataKeyValueService + links: + - https://github.com/palantir/atlasdb/pull/7307