somandal commented on code in PR #16791:
URL: https://github.com/apache/pinot/pull/16791#discussion_r2370329975
##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/BrokerRoutingManager.java:
##########
@@ -156,10 +203,29 @@ public synchronized void processClusterChange(ChangeType
changeType) {
}
private void processSegmentAssignmentChange() {
+ _globalLock.readLock().lock();
+ ThreadFactory threadFactory = new
ThreadFactoryBuilder().setNameFormat("async-broker-assignment-change-%d").build();
+ ExecutorService executorService =
Executors.newFixedThreadPool(_processSegmentAssignmentChangeNumThreads,
Review Comment:
done - had to add a stop() method to the class and call that in the
`BaseBrokerStarter::stop()` for shutting down the executorService
##########
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];
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<>();
+ 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);
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]