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_r396571775
##########
File path:
llap-server/src/java/org/apache/hadoop/hive/llap/cache/LlapCacheableBuffer.java
##########
@@ -26,39 +26,71 @@
* using a real programming language.
*/
public abstract class LlapCacheableBuffer {
- protected static final int IN_LIST = -2, NOT_IN_CACHE = -1;
-
- /** Priority for cache policy (should be pretty universal). */
- public double priority;
- /** Last priority update time for cache policy (should be pretty universal).
*/
- public long lastUpdate = -1;
+ public static final int INVALIDATE_OK = 0, INVALIDATE_FAILED = 1,
INVALIDATE_ALREADY_INVALID = 2;
- // TODO: remove some of these fields as needed?
+ public CacheAttribute cacheAttribute;
/** Linked list pointers for LRFU/LRU cache policies. Given that each block
is in cache
* that might be better than external linked list. Or not, since this is not
concurrent. */
public LlapCacheableBuffer prev = null;
/** Linked list pointers for LRFU/LRU cache policies. Given that each block
is in cache
* that might be better than external linked list. Or not, since this is not
concurrent. */
public LlapCacheableBuffer next = null;
- /** Index in heap for LRFU/LFU cache policies. */
- public int indexInHeap = NOT_IN_CACHE;
- public static final int INVALIDATE_OK = 0, INVALIDATE_FAILED = 1,
INVALIDATE_ALREADY_INVALID = 2;
+ /**
+ * @return result of invalidation.
+ */
protected abstract int invalidate();
+
+ /**
+ * @return size of the buffer in bytes.
+ */
public abstract long getMemoryUsage();
+
+ /**
+ * @param evictionDispatcher dispatcher object to be notified.
+ */
public abstract void notifyEvicted(EvictionDispatcher evictionDispatcher);
+ /**
Review comment:
I agree, with you the only thing that is bothering me is if we delegate to
actual policy we will need to delegate the buffer state as well which can make
the code quite hard to reason about. What am trying to say i do not like that
part of the state will be controlled by policy (in this case the bit) and the
other part is by the actual buffer internal state biz. Let me know what you
think.
----------------------------------------------------------------
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]