diff --git a/services/venice-router/src/main/java/com/linkedin/venice/router/api/VenicePathParser.java b/services/venice-router/src/main/java/com/linkedin/venice/router/api/VenicePathParser.java index 9468b6a10b..cfdf735754 100644 --- a/services/venice-router/src/main/java/com/linkedin/venice/router/api/VenicePathParser.java +++ b/services/venice-router/src/main/java/com/linkedin/venice/router/api/VenicePathParser.java @@ -25,6 +25,7 @@ import com.linkedin.venice.meta.RetryManager; import com.linkedin.venice.meta.Store; import com.linkedin.venice.meta.StoreDataChangedListener; +import com.linkedin.venice.meta.StoreName; import com.linkedin.venice.meta.StoreVersionName; import com.linkedin.venice.read.RequestType; import com.linkedin.venice.router.VeniceRouterConfig; @@ -121,9 +122,10 @@ public class VenicePathParser implements ExtendedResourcePathParser routerSingleKeyRetryManagers; - private final Map routerMultiKeyRetryManagers; + private final Map routerSingleKeyRetryManagers; + private final Map routerMultiKeyRetryManagers; private final NameRepository nameRepository = new NameRepository(); + /** Outer map of {client's desired compression strategy -> inner map of {store-version -> decompressor}} */ private final EnumMap> decompressorMaps; public VenicePathParser( @@ -145,7 +147,8 @@ public VenicePathParser( } this.storeRepository.registerStoreDataChangedListener(new StoreDataChangedListener() { @Override - public void handleStoreDeleted(String storeName) { + public void handleStoreDeleted(String storeNameString) { + StoreName storeName = nameRepository.getStoreName(storeNameString); routerSingleKeyRetryManagers.remove(storeName); routerMultiKeyRetryManagers.remove(storeName); cleanDecompressorMaps(storeName, storeVersionName -> true); @@ -153,21 +156,21 @@ public void handleStoreDeleted(String storeName) { @Override public void handleStoreChanged(Store store) { - String storeName = store.getName(); + StoreName storeName = nameRepository.getStoreName(store.getName()); IntSet upToDateVersionsSet = store.getVersionNumbers(); cleanDecompressorMaps( storeName, storeVersionName -> !upToDateVersionsSet.contains(storeVersionName.getVersionNumber())); } - private void cleanDecompressorMaps(String storeName, Function criteriaForRemoval) { + private void cleanDecompressorMaps(StoreName storeName, Function criteriaForRemoval) { for (Map decompressorMap: decompressorMaps.values()) { // remove out dated versions (if any) from the map Iterator storeVersionNameIterator = decompressorMap.keySet().iterator(); StoreVersionName storeVersionName; while (storeVersionNameIterator.hasNext()) { storeVersionName = storeVersionNameIterator.next(); - if (storeVersionName.getStoreName().equals(storeName)) { + if (storeVersionName.getStore().equals(storeName)) { if (criteriaForRemoval.apply(storeVersionName)) { storeVersionNameIterator.remove(); } @@ -212,7 +215,7 @@ public VenicePath parseResourceUri(String uri, BasicFullHttpRequest fullHttpRequ if (VeniceRouterUtils.isHttpGet(method)) { RetryManager singleKeyRetryManager = routerSingleKeyRetryManagers.computeIfAbsent( - storeName, + storeVersionName.getStore(), ignored -> new RetryManager( metricsRepository, SINGLE_KEY_RETRY_MANAGER_STATS_PREFIX + storeName, @@ -231,7 +234,7 @@ public VenicePath parseResourceUri(String uri, BasicFullHttpRequest fullHttpRequ responseDecompressor); } else if (VeniceRouterUtils.isHttpPost(method)) { RetryManager multiKeyRetryManager = routerMultiKeyRetryManagers.computeIfAbsent( - storeName, + storeVersionName.getStore(), ignored -> new RetryManager( metricsRepository, MULTI_KEY_RETRY_MANAGER_STATS_PREFIX + storeName,