You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/06/07 20:28:30 UTC

[GitHub] [pinot] jackjlli commented on a diff in pull request #8838: Wait segment deletion in startReplaceSegment api to make sure there will be at most 2 data snapshots.

jackjlli commented on code in PR #8838:
URL: https://github.com/apache/pinot/pull/8838#discussion_r891677547


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3183,6 +3186,20 @@ public String startReplaceSegments(String tableNameWithType, List<String> segmen
     return segmentLineageEntryId;
   }
 
+  private void waitForSegmentsToDelete(String tableNameWithType, List<String> segments, long timeOutInMillis)
+      throws InterruptedException {
+    LOGGER.info("Wait segments to delete. timeout = {}ms, segments = {}", timeOutInMillis, segments);

Review Comment:
   `LOGGER.info("Waiting for {} segments to delete for table: {}. timeout = {}ms, segments = {}", segments.size(), tableNameWithType, timeOutInMillis, segments)`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3183,6 +3186,20 @@ public String startReplaceSegments(String tableNameWithType, List<String> segmen
     return segmentLineageEntryId;
   }
 
+  private void waitForSegmentsToDelete(String tableNameWithType, List<String> segments, long timeOutInMillis)
+      throws InterruptedException {
+    LOGGER.info("Wait segments to delete. timeout = {}ms, segments = {}", timeOutInMillis, segments);
+    long endTimeMs = System.currentTimeMillis() + timeOutInMillis;
+    do {
+      if (Collections.disjoint(getSegmentsFor(tableNameWithType, false), segments)) {
+        return;
+      } else {
+        Thread.sleep(SEGMENT_CLEANUP_CHECK_INTERVAL_MS);
+      }
+    } while (System.currentTimeMillis() < endTimeMs);
+    throw new RuntimeException("Timeout while waiting for segments to be deleted");

Review Comment:
   Also, suggest adding some details of the exception in Line 3176 to briefly explain why the request failed.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3183,6 +3186,20 @@ public String startReplaceSegments(String tableNameWithType, List<String> segmen
     return segmentLineageEntryId;
   }
 
+  private void waitForSegmentsToDelete(String tableNameWithType, List<String> segments, long timeOutInMillis)
+      throws InterruptedException {
+    LOGGER.info("Wait segments to delete. timeout = {}ms, segments = {}", timeOutInMillis, segments);
+    long endTimeMs = System.currentTimeMillis() + timeOutInMillis;
+    do {
+      if (Collections.disjoint(getSegmentsFor(tableNameWithType, false), segments)) {
+        return;
+      } else {
+        Thread.sleep(SEGMENT_CLEANUP_CHECK_INTERVAL_MS);
+      }
+    } while (System.currentTimeMillis() < endTimeMs);
+    throw new RuntimeException("Timeout while waiting for segments to be deleted");

Review Comment:
   log the table name and the timeout value here.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org