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

Xiang Li commented on HBASE-18573:
----------------------------------

Hi [~Jan Hentschel], when I am trying to make Append and Delete to call 
getCellList(family) for addxxx() functions, I found in Append and Delete, when 
allocating ArrayList, the initial capacity is set to 1, which is different from 
that for Put and Increment (in which, ArrayList is allocated with no initial 
capacity set).

The setting of initial capacity for Append and Delete was introduced by 
HBASE-10699. Would you please explain a little more about
* Any special reason to set initial capacity when allocating ArrayList? Is it 
safe than new ArrayList<>()? I am not an expert on this. Could you please 
explain a little bit more?
* Why initial capacity is set to 1, rather than other number?
* Why it is done for Append and Delete, but not for Put and Increment?

I just would like to check with you about those to see if I could make Append 
and Delete to use Mutation#getCellList(family) and if I need to update 
Mutation#getCellList(family) to give an initial capacity when allocating 
ArrayList.

Please kindly advice, many thanks!

> Update Append and Delete to use Mutation#getCellList(family)
> ------------------------------------------------------------
>
>                 Key: HBASE-18573
>                 URL: https://issues.apache.org/jira/browse/HBASE-18573
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>
> In addxxx() of Put and Increment, Mutation#getCellList(family) is called to 
> get cell list from familyMap. But in the other 2 sub-class of Mutation: 
> Append and Delete, the logic like Mutation#getCellList(family) is used, like
> {code}
>     List<Cell> list = familyMap.get(family);
>     if(list == null) {
>       list = new ArrayList<>(1);
>     }
> {code}
> in
> {code}
> public Delete addColumn(byte [] family, byte [] qualifier, long timestamp)
> {code}
> of Delete
> We could make them to call Mutation#getCellList(family) to get better 
> encapsulation



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to