clintropolis commented on code in PR #19671:
URL: https://github.com/apache/druid/pull/19671#discussion_r3555713238
##########
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:
ah this comment was a bit unclear and your question made me realize that i
only intended to eagerly try to evict unheld entries when they were rule held,
since I was thinking that stuff that was eagerly partial loads sort of fall in
between regular loads with static entries that drop immediately, and pure vsf
weak loads, and so my gut feel was that maybe trying to drop if possible was
the correct behavior for rule held partials.
However, I realized that this still _always_ results in lazy later eviction
because the metadata entries always have a hold on them so they cannot be
evicted before a bundle part is evicted, so i've just removed the call
completely and so now we just clear the rule.
--
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]