Skip to content

Commit

Permalink
avoid doing getStore() for which the controller is not the leader
Browse files Browse the repository at this point in the history
  • Loading branch information
arjun4084346 committed Dec 2, 2024
1 parent f1d2066 commit 60aefd2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3534,7 +3534,7 @@ private boolean hasFatalDataValidationError(PushMonitor pushMonitor, String topi

private void safeDeleteRTTopic(String clusterName, String storeName) {
if (isRTTopicDeletionPermittedByAllControllers(clusterName, storeName)) {
deleteRTTopic(clusterName, storeName);
deleteRealTtimeTopic(clusterName, storeName);
}
}

Expand All @@ -3545,7 +3545,6 @@ public boolean isRTTopicDeletionPermittedByAllControllers(String clusterName, St
// approach if some fabrics are unavailable or out of sync (temporarily).
// String storeName = store.getName();
String rtTopicName = Version.composeRealTimeTopic(storeName);

Map<String, ControllerClient> controllerClientMap = getControllerClientMap(clusterName);
for (Map.Entry<String, ControllerClient> controllerClientEntry: controllerClientMap.entrySet()) {
StoreResponse storeResponse = controllerClientEntry.getValue().getStore(storeName);
Expand All @@ -3569,7 +3568,7 @@ public boolean isRTTopicDeletionPermittedByAllControllers(String clusterName, St
return true;
}

private void deleteRTTopic(String clusterName, String storeName) {
private void deleteRealTtimeTopic(String clusterName, String storeName) {
Map<String, ControllerClient> controllerClientMap = getControllerClientMap(clusterName);
String rtTopicToDelete = Version.composeRealTimeTopic(storeName);
deleteRTTopicFromAllFabrics(rtTopicToDelete, controllerClientMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,8 @@ void cleanupVeniceTopics() {
PubSubTopic topic = allTopics.poll();
String storeName = topic.getStoreName();
String clusterDiscovered;
Store store;
try {
clusterDiscovered = admin.discoverCluster(storeName).getFirst();
store = admin.getStoreInfoInChildColos(clusterDiscovered, storeName).get();
} catch (VeniceNoStoreException e) {
LOGGER.warn(
"Store {} not found. Exception when trying to delete topic: {} - {}",
Expand Down

0 comments on commit 60aefd2

Please sign in to comment.