@InterfaceAudience.Private public class MobCell extends Object implements Closeable
Cell
and a StoreFileScanner
inside. Now, the mob cell
is backend by NIO ByteBuffers which are allocated from ByteBuffAllocator, so we cannot just read
the cell and close the MOB file scanner because the MOB file scanner closing will deallocate the
NIO ByteBuffers, which resulting memory leak.
Actually, the right solution is:
1. Read the normal cell;
2. Parse the value of normal cell and get MOB fileName,offset,length;
3. Open scanner to read the mob value;
4. Construct the response cell whose key is from the normal cell and value is from the mob cell.
5. Ship the response cell to HBase client.
6. Release both normal cell's block and mob cell's block.
For mob cell, the block releasing just means closing the the mob scanner, so here we need to keep
the StoreFileScanner
inside and close only when we're ensure that the MobCell has been
shipped to RPC client.
Modifier and Type | Field and Description |
---|---|
private Cell |
cell |
private StoreFileScanner |
sfScanner |
Constructor and Description |
---|
MobCell(Cell cell) |
MobCell(Cell cell,
StoreFileScanner sfScanner) |
private final StoreFileScanner sfScanner
public MobCell(Cell cell, StoreFileScanner sfScanner)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.