clintropolis commented on code in PR #18683:
URL: https://github.com/apache/druid/pull/18683#discussion_r2458161909


##########
server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:
##########
@@ -290,6 +291,27 @@ public void storeInfoFile(final DataSegment segment) 
throws IOException
 
   @Override
   public void removeInfoFile(final DataSegment segment)
+  {
+    final Runnable delete = () -> deleteSegmentInfoFile(segment);
+    final SegmentCacheEntryIdentifier entryId = new 
SegmentCacheEntryIdentifier(segment.getId());
+    boolean isCached = false;
+    // defer deleting until the unmount operation of the cache entry, if 
possible, so that if the process stops before
+    // the segment files are deleted, they can be properly managed on startup 
(since the info entry still exists)
+    for (StorageLocation location : locations) {
+      final SegmentCacheEntry cacheEntry = location.getCacheEntry(entryId);
+      if (cacheEntry != null) {
+        isCached = true;
+        cacheEntry.onUnmount.set(delete);

Review Comment:
   yea, this one isn't under a segment lock so could, fixed to just make 
methods on cache entry to synchronize with mount/unmount



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