[ 
https://issues.apache.org/jira/browse/HBASE-16438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15924365#comment-15924365
 ] 

Anoop Sam John commented on HBASE-16438:
----------------------------------------

No cyclic reference way pls.  
We dont do init (Actual BB allocation) at first step to avoid possible 
locks/synchronized way and do it with CAS.
{code}
if (curChunk.compareAndSet(null, c)) {
        // we won race - now we need to actually do the expensive
        // allocation step
        c.init();
        if (pooledChunk) {
          if (!this.closed && !this.pooledChunkQueue.offer(c)) {
            if (LOG.isTraceEnabled()) {
              LOG.trace("Chunk queue is full, won't reuse this new chunk. 
Current queue size: "
                  + pooledChunkQueue.size());
            }
          }
        }
        return c;
      } else if (pooledChunk) {
        chunkPool.putbackChunk(c);
      }
{code}
In multi threaded case, for sure for many threads, the CAS will fail and they 
can go with using the same Chunk allocated via calls from other threads.  If 
the init also happened as part of ChunkCreator's Chunk creation, that will be 
waste of allocating 2 MB memory right?  How u will avoid that as well as 
continue to use CAS way?

> Create a cell type so that chunk id is embedded in it
> -----------------------------------------------------
>
>                 Key: HBASE-16438
>                 URL: https://issues.apache.org/jira/browse/HBASE-16438
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 2.0.0
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>         Attachments: HBASE-16438_1.patch, HBASE-16438.patch, 
> MemstoreChunkCell_memstoreChunkCreator_oldversion.patch, 
> MemstoreChunkCell_trunk.patch
>
>
> For CellChunkMap we may need a cell such that the chunk out of which it was 
> created, the id of the chunk be embedded in it so that when doing flattening 
> we can use the chunk id as a meta data. More details will follow once the 
> initial tasks are completed. 
> Why we need to embed the chunkid in the Cell is described by [~anastas] in 
> this remark over in parent issue 
> https://issues.apache.org/jira/browse/HBASE-14921?focusedCommentId=15244119&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15244119



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to