Jackie-Jiang commented on code in PR #9802:
URL: https://github.com/apache/pinot/pull/9802#discussion_r1036358541


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/offline/DimensionTableDataManager.java:
##########
@@ -117,6 +135,26 @@ public void removeSegment(String segmentName) {
     }
   }
 
+  @Override
+  protected void doShutdown() {
+    closeDimensionTable(_dimensionTable, _disablePreload);
+  }
+
+  private void closeDimensionTable(DimensionTable dimensionTable, boolean 
releaseSegments) {
+    if (dimensionTable != null) {

Review Comment:
   (minor) This check is redundant



##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/offline/DimensionTableDataManager.java:
##########
@@ -117,6 +135,26 @@ public void removeSegment(String segmentName) {
     }
   }
 
+  @Override
+  protected void doShutdown() {
+    closeDimensionTable(_dimensionTable, _disablePreload);
+  }
+
+  private void closeDimensionTable(DimensionTable dimensionTable, boolean 
releaseSegments) {
+    if (dimensionTable != null) {
+      try {
+        dimensionTable.close();
+        if (releaseSegments && _segmentDataManagers != null) {
+          for (SegmentDataManager segmentDataManager: _segmentDataManagers) {

Review Comment:
   This doesn't work because the current `_segmentDataManagers` are for the new 
dimension table, and here we are closing the already replaced dimension table.
   
   We can pass the acquired `List<SegmentDataManager>` into the 
`MemoryOptimizedDimensionTable`, and close it within the 
`MemoryOptimizedDimensionTable.close()`. Basically the dimension table 
implementation knows whether it needs to release the segments, instead of the 
caller



-- 
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