Jackie-Jiang commented on code in PR #16931:
URL: https://github.com/apache/pinot/pull/16931#discussion_r2411654843
##########
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:
Consider making it more concise
```suggestion
public static final String ENABLE_ASYNC_SEGMENT_REFRESH =
"enable.async.segment.refresh";
```
##########
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:
This decision can be handled within the `TableDataManager`. I don't think we
need to introduce this new API
##########
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:
Given we already have `_segmentReloadExecutor` which is initialized with the
same threshold, should we just use it to also handle the refresh?
Refresh and reload are very similar operation, with subtle difference:
refresh won't reload the segment when CRC matches; reload can skip CRC check
when configured
Having too many executors could cause confusion.
##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/HelixInstanceDataManagerConfig.java:
##########
@@ -252,6 +257,12 @@ public int getMaxParallelRefreshThreads() {
return _serverConfig.getProperty(MAX_PARALLEL_REFRESH_THREADS, 1);
}
+ @Override
+ public boolean isEnableSegmentRefreshAsynchronousHandling() {
Review Comment:
We usually name the getter for enablement: `isXXXEnabled()`
--
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]