jackjlli commented on a change in pull request #8422:
URL: https://github.com/apache/pinot/pull/8422#discussion_r838836727



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -2053,6 +2062,36 @@ public boolean updateZkMetadata(String 
tableNameWithType, SegmentZKMetadata segm
     return ZKMetadataProvider.setSegmentZKMetadata(_propertyStore, 
tableNameWithType, segmentZKMetadata);
   }
 
+  /**
+   * Delete the table on servers
+   */
+  private void deleteTableOnServer(String tableNameWithType) {
+    LOGGER.info("Sending delete message for table: {}", tableNameWithType);
+
+    Criteria recipientCriteria = new Criteria();

Review comment:
       Add the comment above saying that:
   ```
   // Send table deletion message to servers
   ```

##########
File path: 
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
##########
@@ -408,7 +413,41 @@ public void testUploadSegmentRefreshOnly()
       assertEquals(segmentsZKMetadata.size(), 1);
       assertNotEquals(segmentsZKMetadata.get(0).getRefreshTime(), 
Long.MIN_VALUE);
     }
+    waitForNumOfSegmentsBecomeOnline(offlineTableName, 1);
     dropOfflineTable(SEGMENT_UPLOAD_TEST_TABLE);
+    testTableDataManagerCleanup(offlineTableName);
+  }
+
+  private void waitForNumOfSegmentsBecomeOnline(String tableNameWithType, int 
numSegments)
+      throws InterruptedException, TimeoutException {
+    long endTimeMs = System.currentTimeMillis() + 
EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS;
+    do {
+      Set<String> onlineSegments = 
_helixResourceManager.getOnlineSegmentsFromExternalView(tableNameWithType);
+      if (onlineSegments.size() == numSegments) {
+        return;
+      }
+      Thread.sleep(EXTERNAL_VIEW_CHECK_INTERVAL_MS);
+    } while (System.currentTimeMillis() < endTimeMs);
+    throw new TimeoutException(String
+        .format("Time out while waiting segments become ONLINE. 
(tableNameWithType = %s)", tableNameWithType));
+  }
+
+  private void testTableDataManagerCleanup(String offlineTableName)

Review comment:
       Is it possible to put this method to `BaseClusterIntegrationTestSet` 
since both offline and realtime cluster integration tests have this method 
respectively?

##########
File path: 
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/RealtimeClusterIntegrationTest.java
##########
@@ -154,6 +156,7 @@ public void testInstanceShutdown()
   public void tearDown()
       throws Exception {
     dropRealtimeTable(getTableName());
+    testTableDataManagerCleanup();

Review comment:
       Rename it to `cleanupTestTableDataManager`?

##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -3285,10 +3324,11 @@ private void waitForSegmentsBecomeOnline(String 
tableNameWithType, Set<String> s
             tableNameWithType, segmentsToCheck));
   }
 
-  private Set<String> getOnlineSegmentsFromExternalView(String 
tableNameWithType) {
+  public Set<String> getOnlineSegmentsFromExternalView(String 
tableNameWithType) {
     ExternalView externalView = getTableExternalView(tableNameWithType);
-    Preconditions
-        .checkState(externalView != null, String.format("External view is null 
for table (%s)", tableNameWithType));
+    if (externalView == null) {

Review comment:
       +1 on this. It's a valid scenario that externalview might be null.




-- 
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-unsubscr...@pinot.apache.org

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



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

Reply via email to