somandal commented on code in PR #16791:
URL: https://github.com/apache/pinot/pull/16791#discussion_r2370330660


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/BrokerRoutingManager.java:
##########
@@ -168,7 +234,7 @@ private void processSegmentAssignmentChange() {
     List<RoutingEntry> routingEntries = new ArrayList<>(numTables);

Review Comment:
   good point, changed this to cache the tableNames instead, thanks for the 
suggestion!



##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/BrokerRoutingManager.java:
##########
@@ -177,38 +243,51 @@ private void processSegmentAssignmentChange() {
     Stat[] externalViewStats = _zkDataAccessor.getStats(externalViewPaths, 
AccessOption.PERSISTENT);
     long fetchStatsEndTimeMs = System.currentTimeMillis();
 
-    List<String> tablesToUpdate = new ArrayList<>();
+    ConcurrentLinkedQueue<String> tablesToUpdate = new 
ConcurrentLinkedQueue<>();
+    List<Future<?>> futures = new ArrayList<>();
     for (int i = 0; i < numTables; i++) {
-      Stat idealStateStat = idealStateStats[i];
-      Stat externalViewStat = externalViewStats[i];
+      final Stat idealStateStat = idealStateStats[i];
+      final Stat externalViewStat = externalViewStats[i];
       if (idealStateStat != null && externalViewStat != null) {
-        RoutingEntry routingEntry = routingEntries.get(i);
-        if (idealStateStat.getVersion() != 
routingEntry.getLastUpdateIdealStateVersion()
-            || externalViewStat.getVersion() != 
routingEntry.getLastUpdateExternalViewVersion()) {
-          String tableNameWithType = routingEntry.getTableNameWithType();
-          tablesToUpdate.add(tableNameWithType);
-          try {
-            IdealState idealState = 
getIdealState(routingEntry._idealStatePath);
-            if (idealState == null) {
-              LOGGER.warn("Failed to find ideal state for table: {}, skipping 
updating routing entry",
-                  tableNameWithType);
-              continue;
+        final int index = i;
+        futures.add(executorService.submit(() -> {
+          RoutingEntry cachedRoutingEntry = routingEntries.get(index);
+          Object tableLock = 
getRoutingTableBuildLock(cachedRoutingEntry.getTableNameWithType());

Review Comment:
   done



##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/BrokerRoutingManager.java:
##########
@@ -177,38 +243,51 @@ private void processSegmentAssignmentChange() {
     Stat[] externalViewStats = _zkDataAccessor.getStats(externalViewPaths, 
AccessOption.PERSISTENT);
     long fetchStatsEndTimeMs = System.currentTimeMillis();
 
-    List<String> tablesToUpdate = new ArrayList<>();
+    ConcurrentLinkedQueue<String> tablesToUpdate = new 
ConcurrentLinkedQueue<>();

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to