capistrant commented on code in PR #19671:
URL: https://github.com/apache/druid/pull/19671#discussion_r3555823717


##########
server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:
##########
@@ -1066,15 +1435,71 @@ public File getSegmentFiles(final DataSegment segment)
   @Override
   public void drop(final DataSegment segment)
   {
-    final SegmentCacheEntryIdentifier id = new 
SegmentCacheEntryIdentifier(segment.getId());
-    for (StorageLocation location : locations) {
-      final CacheEntry entry = location.getCacheEntry(id);
-      if (entry != null) {
-        location.release(entry);
+    final ReferenceCountingLock lock = lock(segment);
+    synchronized (lock) {
+      try {
+        // partial-load-rule cleanup: if the segment's cache entry is a 
partial metadata entry with an applied rule,
+        // clear it
+        final SegmentCacheEntryIdentifier id = new 
SegmentCacheEntryIdentifier(segment.getId());
+        for (StorageLocation location : locations) {
+          final CacheEntry entry = location.getCacheEntry(id);
+          if (entry instanceof PartialSegmentMetadataCacheEntry partial) {
+            partial.clearRule();
+            // Force synchronous cleanup: clearRule releases the self-hold, 
but the info-file-deletion hook only
+            // fires on doActualUnmount which is triggered by the phaser 
hitting zero. removeUnheldWeakEntry
+            // unlinks the weak entry from cache and terminates the phaser 
now, firing the hook (and the mapper
+            // teardown) on the caller's thread. No-op if a concurrent query 
still holds the entry.
+            location.removeUnheldWeakEntry(id);

Review Comment:
   got it. ty for explanation and I support decision to drop it



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