From 3e496b1fd8572d6337f7ef2a098e001cd5e0e4ea Mon Sep 17 00:00:00 2001 From: Kristy Lee <18691669+kristyelee@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:14:10 -0700 Subject: [PATCH] Update initializing StorageService object --- .../linkedin/venice/server/VeniceServer.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/services/venice-server/src/main/java/com/linkedin/venice/server/VeniceServer.java b/services/venice-server/src/main/java/com/linkedin/venice/server/VeniceServer.java index 571d120cf3a..03fe5cd119f 100644 --- a/services/venice-server/src/main/java/com/linkedin/venice/server/VeniceServer.java +++ b/services/venice-server/src/main/java/com/linkedin/venice/server/VeniceServer.java @@ -43,11 +43,7 @@ import com.linkedin.venice.listener.ServerReadMetadataRepository; import com.linkedin.venice.listener.ServerStoreAclHandler; import com.linkedin.venice.listener.StoreValueSchemasCacheService; -import com.linkedin.venice.meta.ReadOnlyLiveClusterConfigRepository; -import com.linkedin.venice.meta.ReadOnlySchemaRepository; -import com.linkedin.venice.meta.ReadOnlyStoreRepository; -import com.linkedin.venice.meta.StaticClusterInfoProvider; -import com.linkedin.venice.meta.Version; +import com.linkedin.venice.meta.*; import com.linkedin.venice.pubsub.PubSubClientsFactory; import com.linkedin.venice.schema.SchemaReader; import com.linkedin.venice.security.SSLFactory; @@ -317,6 +313,9 @@ private List createServices() { ? new RocksDBMemoryStats(metricsRepository, "RocksDBMemoryStats", plainTableEnabled) : null; + boolean whetherToRestoreDataPartitions = !isIsolatedIngestion() + || veniceConfigLoader.getVeniceServerConfig().freezeIngestionIfReadyToServeOrLocalDataExists(); + // Create and add StorageService. storeRepository will be populated by StorageService storageService = new StorageService( veniceConfigLoader, @@ -324,7 +323,10 @@ private List createServices() { rocksDBMemoryStats, storeVersionStateSerializer, partitionStateSerializer, - metadataRepo); + metadataRepo, + whetherToRestoreDataPartitions, + true, + functionToCheckWhetherStorageEngineShouldBeKeptOrNot()); storageEngineMetadataService = new StorageEngineMetadataService(storageService.getStorageEngineRepository(), partitionStateSerializer); services.add(storageEngineMetadataService); @@ -699,6 +701,10 @@ protected VeniceConfigLoader getConfigLoader() { return veniceConfigLoader; } + protected final boolean isIsolatedIngestion() { + return veniceConfigLoader.getVeniceServerConfig().getIngestionMode().equals(IngestionMode.ISOLATED); + } + private Function functionToCheckWhetherStorageEngineShouldBeKeptOrNot() { return storageEngineName -> { String storeName = Version.parseStoreFromKafkaTopicName(storageEngineName);