hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiang Li (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HBASE-18986) Remove unnecessary null check after CellUtil.cloneQualifier()
Date Wed, 11 Oct 2017 12:21:00 GMT

     [ https://issues.apache.org/jira/browse/HBASE-18986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Xiang Li updated HBASE-18986:
-----------------------------
    Description: 
In master branch,
{code:title=hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java|borderStyle=solid}
// From line 2858
public void prepareDeleteTimestamps(Mutation mutation, Map<byte[], List<Cell>>
familyMap,
      byte[] byteNow) throws IOException {
    for (Map.Entry<byte[], List<Cell>> e : familyMap.entrySet()) {
      // ...
      for (int i=0; i < listSize; i++) {
        // ...
        if (cell.getTimestamp() == HConstants.LATEST_TIMESTAMP && CellUtil.isDeleteType(cell))
{
          byte[] qual = CellUtil.cloneQualifier(cell);
          if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY; // <-- here
          ...
{code}

The last statement {if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY;}


  was:
In master branch,
{code:title=hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java|borderStyle=solid}
// From line 2858
public void prepareDeleteTimestamps(Mutation mutation, Map<byte[], List<Cell>>
familyMap,
      byte[] byteNow) throws IOException {
    for (Map.Entry<byte[], List<Cell>> e : familyMap.entrySet()) {

      byte[] family = e.getKey();
      List<Cell> cells = e.getValue();
      assert cells instanceof RandomAccess;

      Map<byte[], Integer> kvCount = new TreeMap<>(Bytes.BYTES_COMPARATOR);
      int listSize = cells.size();
      for (int i=0; i < listSize; i++) {
        Cell cell = cells.get(i);
        //  Check if time is LATEST, change to time of most recent addition if so
        //  This is expensive.
        if (cell.getTimestamp() == HConstants.LATEST_TIMESTAMP && CellUtil.isDeleteType(cell))
{
          byte[] qual = CellUtil.cloneQualifier(cell);
          if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY; // <-- here
          ...
{code}



> Remove unnecessary null check after CellUtil.cloneQualifier()
> -------------------------------------------------------------
>
>                 Key: HBASE-18986
>                 URL: https://issues.apache.org/jira/browse/HBASE-18986
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Xiang Li
>            Assignee: Xiang Li
>            Priority: Minor
>
> In master branch,
> {code:title=hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java|borderStyle=solid}
> // From line 2858
> public void prepareDeleteTimestamps(Mutation mutation, Map<byte[], List<Cell>>
familyMap,
>       byte[] byteNow) throws IOException {
>     for (Map.Entry<byte[], List<Cell>> e : familyMap.entrySet()) {
>       // ...
>       for (int i=0; i < listSize; i++) {
>         // ...
>         if (cell.getTimestamp() == HConstants.LATEST_TIMESTAMP && CellUtil.isDeleteType(cell))
{
>           byte[] qual = CellUtil.cloneQualifier(cell);
>           if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY; // <-- here
>           ...
> {code}
> The last statement {if (qual == null) qual = HConstants.EMPTY_BYTE_ARRAY;}



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

Mime
View raw message