-
Notifications
You must be signed in to change notification settings - Fork 113
[controller] [server] extend rt versioning to system stores #2264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,6 +57,7 @@ | |||||||||||||||
| import com.linkedin.venice.meta.Store; | ||||||||||||||||
| import com.linkedin.venice.meta.StoreDataChangedListener; | ||||||||||||||||
| import com.linkedin.venice.meta.SubscriptionBasedReadOnlyStoreRepository; | ||||||||||||||||
| import com.linkedin.venice.meta.SystemStoreAttributes; | ||||||||||||||||
| import com.linkedin.venice.meta.Version; | ||||||||||||||||
| import com.linkedin.venice.pubsub.api.PubSubPosition; | ||||||||||||||||
| import com.linkedin.venice.pushmonitor.ExecutionStatus; | ||||||||||||||||
|
|
@@ -308,7 +309,8 @@ public DaVinciBackend( | |||||||||||||||
| ingestionService.getVeniceWriterFactory(), | ||||||||||||||||
| instanceName, | ||||||||||||||||
| valueSchemaEntry, | ||||||||||||||||
| updateSchemaEntry); | ||||||||||||||||
| updateSchemaEntry, | ||||||||||||||||
| (this::getRealTimeTopicName)); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| ingestionService.start(); | ||||||||||||||||
|
|
@@ -560,6 +562,29 @@ public SubscriptionBasedReadOnlyStoreRepository getStoreRepository() { | |||||||||||||||
| return storeRepository; | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
arjun4084346 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
| /** | ||||||||||||||||
| * Resolves and returns the store object for the given store name. | ||||||||||||||||
| * For user system stores, this returns the SystemStoreAttributes from the parent user store. | ||||||||||||||||
| * For regular stores and shared system stores, this returns the Store object directly. | ||||||||||||||||
| */ | ||||||||||||||||
| private String getRealTimeTopicName(String storeName) { | ||||||||||||||||
| VeniceSystemStoreType systemStoreType = VeniceSystemStoreType.getSystemStoreType(storeName); | ||||||||||||||||
| if (systemStoreType != null) { | ||||||||||||||||
| // it is a user system store | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Everything else is good but I just found that this assumption might not be correct. There is a BATCH JOB HB system store which is a ZK shared one. I believe we should exclude that. |
||||||||||||||||
| String userStoreName = VeniceSystemStoreType.extractUserStoreName(storeName); | ||||||||||||||||
| Store userStore = storeRepository.getStore(userStoreName); | ||||||||||||||||
arjun4084346 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
| Map<String, SystemStoreAttributes> systemStores = userStore.getSystemStores(); | ||||||||||||||||
|
Comment on lines
+575
to
+576
|
||||||||||||||||
| for (Map.Entry<String, SystemStoreAttributes> systemStoreEntries: systemStores.entrySet()) { | ||||||||||||||||
| if (storeName.startsWith(systemStoreEntries.getKey())) { | ||||||||||||||||
arjun4084346 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
| return Utils.getRealTimeTopicName(systemStoreEntries.getValue()); | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+577
to
+580
|
||||||||||||||||
| for (Map.Entry<String, SystemStoreAttributes> systemStoreEntries: systemStores.entrySet()) { | |
| if (storeName.startsWith(systemStoreEntries.getKey())) { | |
| return Utils.getRealTimeTopicName(systemStoreEntries.getValue()); | |
| } | |
| SystemStoreAttributes systemStoreAttributes = systemStores.get(storeName); | |
| if (systemStoreAttributes != null) { | |
| return Utils.getRealTimeTopicName(systemStoreAttributes); |
arjun4084346 marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential NullPointerException when calling Utils.getRealTimeTopicName() with a null store. If storeRepository.getStore(storeName) returns null, this will fail. Add a null check before calling the utility method.
arjun4084346 marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,7 +393,8 @@ public KafkaStoreIngestionService( | |
| zkSharedSchemaRepository.get(), | ||
| pubSubTopicRepository, | ||
| serverConfig.getMetaStoreWriterCloseTimeoutInMS(), | ||
| serverConfig.getMetaStoreWriterCloseConcurrency()); | ||
| serverConfig.getMetaStoreWriterCloseConcurrency(), | ||
| storeName -> Utils.getRealTimeTopicNameForSystemStore(metadataRepo.getStore(storeName))); | ||
arjun4084346 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| metadataRepo.registerStoreDataChangedListener(new StoreDataChangedListener() { | ||
| @Override | ||
| public void handleStoreDeleted(Store store) { | ||
|
|
@@ -1486,7 +1487,8 @@ public InternalDaVinciRecordTransformerConfig getInternalRecordTransformerConfig | |
| return storeNameToInternalRecordTransformerConfig.get(storeName); | ||
| } | ||
|
|
||
| public void attemptToPrintIngestionInfoFor(String storeName, Integer version, Integer partition, String regionName) { | ||
| public void attemptToPrintIngestionInfoFor(Store store, Integer version, Integer partition, String regionName) { | ||
| String storeName = store.getName(); | ||
| try { | ||
| PubSubTopic versionTopic = pubSubTopicRepository.getTopic(Version.composeKafkaTopic(storeName, version)); | ||
| StoreIngestionTask storeIngestionTask = getStoreIngestionTask(versionTopic.getName()); | ||
|
|
@@ -1508,7 +1510,7 @@ public void attemptToPrintIngestionInfoFor(String storeName, Integer version, In | |
| String infoPrefix = "isCurrentVersion: " + (storeIngestionTask.isCurrentVersion()) + "\n"; | ||
| if (storeIngestionTask.isHybridMode() && partitionConsumptionState.isEndOfPushReceived() | ||
| && partitionConsumptionState.getLeaderFollowerState() == LeaderFollowerStateType.LEADER) { | ||
| ingestingTopic = pubSubTopicRepository.getTopic(Utils.composeRealTimeTopic(storeName)); | ||
| ingestingTopic = pubSubTopicRepository.getTopic(Utils.getRealTimeTopicName(store)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this util come with a fallback? I think it is important to have a fallback inside the util method so that it does not throw exception in a random place
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it does come with a fallback, for stores not using rt versioning, it returns "storeName_rt" |
||
| } | ||
| PubSubTopicPartition ingestingTopicPartition = new PubSubTopicPartitionImpl(ingestingTopic, partition); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -647,7 +647,7 @@ void checkAndMaybeLogHeartbeatDelayMap( | |
| heartbeatTs, | ||
| currentTimestamp); | ||
| getKafkaStoreIngestionService().attemptToPrintIngestionInfoFor( | ||
| storeName.getKey(), | ||
| metadataRepository.getStore(storeName.getKey()), | ||
|
||
| version.getKey(), | ||
| partition.getKey(), | ||
| region.getKey()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| import static com.linkedin.venice.utils.DataProviderUtils.BOOLEAN; | ||
| import static com.linkedin.venice.utils.DataProviderUtils.allPermutationGenerator; | ||
| import static org.mockito.ArgumentMatchers.any; | ||
| import static org.mockito.ArgumentMatchers.anyString; | ||
| import static org.mockito.Mockito.clearInvocations; | ||
| import static org.mockito.Mockito.doNothing; | ||
| import static org.mockito.Mockito.mock; | ||
|
|
@@ -34,6 +35,7 @@ | |
| import com.linkedin.venice.client.store.ClientFactory; | ||
| import com.linkedin.venice.exceptions.DiskLimitExhaustedException; | ||
| import com.linkedin.venice.exceptions.VeniceException; | ||
| import com.linkedin.venice.helix.ZkClientFactory; | ||
| import com.linkedin.venice.meta.ClusterInfoProvider; | ||
| import com.linkedin.venice.meta.ReadOnlySchemaRepository; | ||
| import com.linkedin.venice.meta.SubscriptionBasedReadOnlyStoreRepository; | ||
|
|
@@ -43,16 +45,19 @@ | |
| import com.linkedin.venice.schema.writecompute.DerivedSchemaEntry; | ||
| import com.linkedin.venice.serialization.avro.SchemaPresenceChecker; | ||
| import com.linkedin.venice.service.ICProvider; | ||
| import com.linkedin.venice.stats.ZkClientStatusStats; | ||
| import com.linkedin.venice.utils.VeniceProperties; | ||
| import io.tehuti.metrics.MetricsRepository; | ||
| import java.util.Optional; | ||
| import java.util.Properties; | ||
| import java.util.concurrent.ExecutionException; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.TimeoutException; | ||
| import org.apache.helix.zookeeper.impl.client.ZkClient; | ||
| import org.mockito.MockedConstruction; | ||
| import org.mockito.MockedStatic; | ||
| import org.testng.annotations.AfterMethod; | ||
| import org.testng.annotations.BeforeClass; | ||
| import org.testng.annotations.BeforeMethod; | ||
| import org.testng.annotations.DataProvider; | ||
| import org.testng.annotations.Test; | ||
|
|
@@ -66,6 +71,15 @@ public class DaVinciBackendTest { | |
| private MockedStatic<ClientFactory> mockClientFactory; | ||
| private MockedConstruction<VeniceMetadataRepositoryBuilder> mockMetadataBuilder; | ||
| private MockedConstruction<SchemaPresenceChecker> mockSchemaPresenceChecker; | ||
| private MockedStatic<ZkClientFactory> mockZkFactory; | ||
|
|
||
| @BeforeClass | ||
| public void init() { | ||
| mockZkFactory = mockStatic(ZkClientFactory.class); | ||
| ZkClient mockZkClient = mock(ZkClient.class); | ||
| mockZkFactory.when(() -> ZkClientFactory.newZkClient(anyString())).thenReturn(mockZkClient); | ||
| doNothing().when(mockZkClient).subscribeStateChanges(any(ZkClientStatusStats.class)); | ||
| } | ||
|
Comment on lines
+76
to
+82
|
||
|
|
||
| @BeforeMethod | ||
| public void setUp() throws Exception { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.