@InterfaceAudience.Private class BucketEntry extends Object implements HBaseReferenceCounted
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
BucketEntry.BucketEntryHandler<T> |
Modifier and Type | Field and Description |
---|---|
private long |
accessCounter |
(package private) ByteBuffAllocator |
allocator |
private long |
cachedTime
Time this block was cached.
|
(package private) static Comparator<BucketEntry> |
COMPARATOR |
(package private) byte |
deserializerIndex
The index of the deserializer that can deserialize this BucketEntry content.
|
private int |
length |
(package private) AtomicBoolean |
markedAsEvicted |
private byte |
offset1 |
private int |
offsetBase |
private BlockPriority |
priority |
private RefCnt |
refCnt
The RefCnt means how many paths are referring the
BucketEntry , each RPC reading path is
considering as one path, the BucketCache.backingMap reference is also considered a
path. |
Constructor and Description |
---|
BucketEntry(long offset,
int length,
long accessCounter,
boolean inMemory) |
BucketEntry(long offset,
int length,
long accessCounter,
boolean inMemory,
RefCnt refCnt,
ByteBuffAllocator allocator) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
access(long accessCounter)
Block has been accessed.
|
(package private) CacheableDeserializer<Cacheable> |
deserializerReference() |
(package private) long |
getAccessCounter() |
(package private) long |
getCachedTime() |
int |
getLength() |
BlockPriority |
getPriority() |
(package private) boolean |
isRpcRef()
Check whether have some RPC patch referring this block.
|
(package private) boolean |
markAsEvicted()
The
BucketCache will try to release its reference to this BucketEntry many times. |
(package private) boolean |
markStaleAsEvicted()
Mark as evicted only when NO RPC references.
|
(package private) long |
offset() |
int |
refCnt() |
boolean |
release()
We've three cases to release refCnt now:
1. |
BucketEntry |
retain() |
(package private) void |
setDeserializerReference(CacheableDeserializer<Cacheable> deserializer) |
private void |
setOffset(long value) |
(package private) <T> T |
withWriteLock(IdReadWriteLock<Long> offsetLock,
BucketEntry.BucketEntryHandler<T> handler) |
(package private) Cacheable |
wrapAsCacheable(ByteBuff buf) |
(package private) Cacheable |
wrapAsCacheable(ByteBuffer[] buffers) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
release, retain, touch, touch
static final Comparator<BucketEntry> COMPARATOR
private int offsetBase
private int length
private byte offset1
byte deserializerIndex
CacheableDeserializerIdManager
for hosting of index to serializers.private volatile long accessCounter
private BlockPriority priority
private final RefCnt refCnt
BucketEntry
, each RPC reading path is
considering as one path, the BucketCache.backingMap
reference is also considered a
path. NOTICE that if two read RPC path hit the same BucketEntry
, then the HFileBlocks
the two RPC referred will share the same refCnt instance with the BucketEntry. so the refCnt
will increase or decrease as the following: BucketAllocator
will free the block area.final AtomicBoolean markedAsEvicted
final ByteBuffAllocator allocator
private final long cachedTime
BucketEntry(long offset, int length, long accessCounter, boolean inMemory)
BucketEntry(long offset, int length, long accessCounter, boolean inMemory, RefCnt refCnt, ByteBuffAllocator allocator)
long offset()
private void setOffset(long value)
public int getLength()
CacheableDeserializer<Cacheable> deserializerReference()
void setDeserializerReference(CacheableDeserializer<Cacheable> deserializer)
long getAccessCounter()
void access(long accessCounter)
public BlockPriority getPriority()
long getCachedTime()
boolean markAsEvicted()
BucketCache
will try to release its reference to this BucketEntry many times. we
must make sure the idempotent, otherwise it'll decrease the RPC's reference count in advance,
then for RPC memory leak happen.boolean markStaleAsEvicted()
boolean isRpcRef()
Cacheable wrapAsCacheable(ByteBuffer[] buffers) throws IOException
IOException
Cacheable wrapAsCacheable(ByteBuff buf) throws IOException
IOException
<T> T withWriteLock(IdReadWriteLock<Long> offsetLock, BucketEntry.BucketEntryHandler<T> handler)
public int refCnt()
refCnt
in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
public BucketEntry retain()
retain
in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
public boolean release()
markStaleAsEvicted()
do.release
in interface org.apache.hbase.thirdparty.io.netty.util.ReferenceCounted
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.