[
https://issues.apache.org/jira/browse/HBASE-26604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yutong Xiao resolved HBASE-26604.
---------------------------------
Resolution: Won't Fix
The threadlocal has a potential sync critic. Won't do this then.
> Replace new allocation with ThreadLocal in CellBlockBuilder to reduce GC
> ------------------------------------------------------------------------
>
> Key: HBASE-26604
> URL: https://issues.apache.org/jira/browse/HBASE-26604
> Project: HBase
> Issue Type: Task
> Reporter: Yutong Xiao
> Assignee: Yutong Xiao
> Priority: Minor
>
> In CellBlockBuilder decompress method, we currently allocate a new
> ByteBufferOutputStream object each invoke.
> {code:java}
> try {
> // TODO: This is ugly. The buffer will be resized on us if we guess
> wrong.
> //TODO: reuse buffers.
> bbos = new ByteBufferOutputStream(osInitialSize);
> IOUtils.copy(cis, bbos);
> bbos.close();
> return bbos.getByteBuffer();
> } finally {
> CodecPool.returnDecompressor(poolDecompressor);
> }
> {code}
> We can use a ThreadLocal variable to reuse the buffer in each Thread. As:
> {code:java}
> try {
> // TODO: This is ugly. The buffer will be resized on us if we guess
> wrong.
> if (this.decompressBuff.get() == null) {
> this.decompressBuff.set(new ByteBufferOutputStream(osInitialSize));
> }
> ByteBufferOutputStream localBbos = this.decompressBuff.get();
> localBbos.clear();
> IOUtils.copy(cis, localBbos);
> return localBbos.getByteBuffer();
> } finally {
> CodecPool.returnDecompressor(poolDecompressor);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)