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


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java:
##########
@@ -451,6 +457,31 @@ public void downloadAndLoadSegment(SegmentZKMetadata 
zkMetadata, IndexLoadingCon
   @Override
   public void replaceSegment(String segmentName)
       throws Exception {
+    if (_enableAsyncSegmentRefresh) {
+      enqueueSegmentToReplace(segmentName);
+    } else {
+      replaceSegmentInternal(segmentName);
+    }
+  }
+
+  protected void enqueueSegmentToReplace(String segmentName) {
+    assert _enableAsyncSegmentRefresh;
+    if (_shutDown) {
+      _logger.warn("Shutdown in progress, skip enqueuing segment: {} to 
replace", segmentName);
+      return;
+    }
+    _logger.info("Enqueuing segment: {} to be replaced", segmentName);
+    _segmentReloadRefreshExecutor.submit(() -> {
+      try {
+        replaceSegmentInternal(segmentName);
+      } catch (Exception e) {
+        _serverMetrics.addMeteredTableValue(_tableNameWithType, 
ServerMeter.REFRESH_FAILURES, 1);

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