[ https://issues.apache.org/jira/browse/HIVE-23197?focusedWorklogId=512267&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-512267 ]
ASF GitHub Bot logged work on HIVE-23197: ----------------------------------------- Author: ASF GitHub Bot Created on: 16/Nov/20 10:59 Start Date: 16/Nov/20 10:59 Worklog Time Spent: 10m Work Description: pvary commented on a change in pull request #1675: URL: https://github.com/apache/hive/pull/1675#discussion_r524122923 ########## File path: llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelLrfuCachePolicy.java ########## @@ -240,18 +247,38 @@ public void setEvictionListener(EvictionListener listener) { this.evictionListener = listener; } - @Override - public long purge() { + private long evictOrPurge(boolean isPurge) { long evicted = 0; LlapCacheableBuffer oldTail; listLock.lock(); try { LlapCacheableBuffer current = listTail; + LlapCacheableBuffer lockedHead = null; + LlapCacheableBuffer lockedTail = null; oldTail = listTail; while (current != null) { - boolean canEvict = LlapCacheableBuffer.INVALIDATE_OK == current.invalidate(); + // Case for when there is proactive eviction, but current buffer is not marked -> thus need to be kept + if (!isPurge && !current.isMarkedForEviction()) { + LlapCacheableBuffer newCurrent = current.prev; + oldTail = removeFromLocalList(oldTail, current); + + current.indexInHeap = LlapCacheableBuffer.IN_LIST; + if (lockedHead != null) { + current.next = lockedHead; + lockedHead.prev = current; + lockedHead = current; + } else { + lockedHead = current; + lockedTail = current; + current.next = null; + } + + current = newCurrent; + continue; Review comment: Have I told you that I hate `continue`? This is basically an `if/else` in disguise :( ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 512267) Time Spent: 1h (was: 50m) > Implement selective purge for LRFU > ---------------------------------- > > Key: HIVE-23197 > URL: https://issues.apache.org/jira/browse/HIVE-23197 > Project: Hive > Issue Type: Sub-task > Reporter: Ádám Szita > Assignee: Ádám Szita > Priority: Major > Labels: pull-request-available > Time Spent: 1h > Remaining Estimate: 0h > > Add eviction functionality parts of proactive caching on daemon side. Cache > policies that want to support proactive eviction will have to implement a > selective kind of purging, where only the buffers that were marked for > proactive eviction get removed from the policy's data structure and get > deallocated from the cache itself. -- This message was sent by Atlassian Jira (v8.3.4#803005)