b-slim commented on a change in pull request #944: [Hive-22760] Adding Clock
based eviction strategy.
URL: https://github.com/apache/hive/pull/944#discussion_r396624247
##########
File path:
llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelLrfuCachePolicy.java
##########
@@ -189,26 +188,33 @@ private void doNotifyUnderHeapLock(int count,
LlapCacheableBuffer[] cacheableBuf
LlapIoImpl.CACHE_LOGGER.trace("Touching {} at {}", buffer, time);
}
// First, update buffer priority - we have just been using it.
- buffer.priority = (buffer.lastUpdate == -1) ? F0
- : touchPriority(time, buffer.lastUpdate, buffer.priority);
- buffer.lastUpdate = time;
+ LrfuCacheAttribute lrfuCacheAttribute = (LrfuCacheAttribute)
buffer.cacheAttribute;
+ if (lrfuCacheAttribute == null) {
+ //This should not happen but it is possible that adding the attribute
on cache call happens after this call
+ lrfuCacheAttribute = new LrfuCacheAttribute(F0, time);
+ buffer.cacheAttribute = lrfuCacheAttribute;
+ } else {
+ lrfuCacheAttribute.lastUpdate = time;
+ lrfuCacheAttribute.priority = touchPriority(time,
lrfuCacheAttribute.lastUpdate, lrfuCacheAttribute.priority);
+ }
+
// Then, if the buffer was in the list, remove it.
- if (buffer.indexInHeap == LlapCacheableBuffer.IN_LIST) {
+ if (lrfuCacheAttribute.indexInHeap == IN_LIST) {
listLock.lock();
removeFromListAndUnlock(buffer);
}
// The only concurrent change that can happen when we hold the heap lock
is list removal;
// we have just ensured the item is not in the list, so we have a
definite state now.
- if (buffer.indexInHeap >= 0) {
+ if (lrfuCacheAttribute.indexInHeap >= 0) {
// The buffer has lived in the heap all along. Restore heap property.
heapifyDownUnderLock(buffer, time);
} else if (heapSize == heap.length) {
// The buffer is not in the (full) heap. Demote the top item of the
heap into the list.
LlapCacheableBuffer demoted = heap[0];
listLock.lock();
try {
- assert demoted.indexInHeap == 0; // Noone could have moved it, we
have the heap lock.
- demoted.indexInHeap = LlapCacheableBuffer.IN_LIST;
+ //assert demoted.indexInHeap == 0; // Noone could have moved it, we
have the heap lock.
Review comment:
reverted
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]