prasanthj commented on a change in pull request #944: [Hive-22760] Adding Clock
based eviction strategy.
URL: https://github.com/apache/hive/pull/944#discussion_r400424669
##########
File path:
llap-server/src/java/org/apache/hadoop/hive/llap/cache/LlapAllocatorBuffer.java
##########
@@ -337,25 +364,34 @@ public Boolean endDiscard() {
return result;
}
- private static final class State {
- public static final int
- FLAG_MOVING = 0b00001, // Locked by someone to move or
force-evict.
- FLAG_EVICTED = 0b00010, // Evicted. This is cache-specific.
- FLAG_REMOVED = 0b00100, // Removed from allocator structures. The
final state.
- FLAG_MEM_RELEASED = 0b01000, // The memory was released to memory
manager.
- FLAG_NEW_ALLOC = 0b10000; // New allocation before the first use;
cannot force-evict.
- private static final int FLAGS_WIDTH = 5,
- REFCOUNT_WIDTH = 19, ARENA_WIDTH = 16, HEADER_WIDTH = 24;
-
- public static final long MAX_REFCOUNT = (1 << REFCOUNT_WIDTH) - 1;
-
- private static final int REFCOUNT_SHIFT = FLAGS_WIDTH,
- ARENA_SHIFT = REFCOUNT_SHIFT + REFCOUNT_WIDTH, HEADER_SHIFT =
ARENA_SHIFT + ARENA_WIDTH;
-
- private static final long FLAGS_MASK = (1L << FLAGS_WIDTH) - 1,
- REFCOUNT_MASK = ((1L << REFCOUNT_WIDTH) - 1) << REFCOUNT_SHIFT,
- ARENA_MASK = ((1L << ARENA_WIDTH) - 1) << ARENA_SHIFT,
- HEADER_MASK = ((1L << HEADER_WIDTH) - 1) << HEADER_SHIFT;
+ /**
+ * Utility class to manipulate the buffer state.
+ */
+ static final class State {
Review comment:
There seems to be many global state manipulation. Can you lease a comment
that the state manipulations are global. Can rename the class to be
CacheState/GlobalCacheState to be more precise about what state it represents.
----------------------------------------------------------------
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]