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


##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/HelixInstanceDataManager.java:
##########
@@ -160,6 +164,16 @@ public synchronized void init(PinotConfiguration config, 
HelixManager helixManag
     } else {
       LOGGER.info("SegmentPreloadExecutor was not created with pool size: {}", 
maxSegmentPreloadThreads);
     }
+    _enableSegmentRefreshAsynchronousHandling = 
isEnableSegmentRefreshAsynchronousHandling();
+    if (_enableSegmentRefreshAsynchronousHandling) {
+      _segmentRefreshExecutor = 
Executors.newFixedThreadPool(maxParallelRefreshThreads,

Review Comment:
   done



##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/HelixInstanceDataManager.java:
##########
@@ -340,7 +358,13 @@ public void replaceSegment(String tableNameWithType, 
String segmentName)
     LOGGER.info("Replacing segment: {} in table: {}", segmentName, 
tableNameWithType);
     TableDataManager tableDataManager = 
_tableDataManagerMap.get(tableNameWithType);
     if (tableDataManager != null) {
-      tableDataManager.replaceSegment(segmentName);
+      if (_enableSegmentRefreshAsynchronousHandling) {
+        LOGGER.info("Asynchronous segment refresh handling enabled, enqueuing 
segment: {} to be replaced in table: {}",
+            segmentName, tableNameWithType);
+        tableDataManager.enqueueSegmentToReplace(segmentName);

Review Comment:
   done



##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/HelixInstanceDataManagerConfig.java:
##########
@@ -100,6 +100,11 @@ public class HelixInstanceDataManagerConfig implements 
InstanceDataManagerConfig
   //
   public static final String MAX_PARALLEL_REFRESH_THREADS = 
"max.parallel.refresh.threads";
 
+  // Whether to process SEGMENT_REFRESH in a synchronous or asynchronous 
manner when the messaged is received.
+  // Defaults to false, meaning SEGMENT_REFRESH will be processed in a 
synchronous manner.
+  public static final String ENABLE_SEGMENT_REFRESH_ASYNCHRONOUS_HANDLING = 
"segment.refresh.asynchronous.handling";

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