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

rajeshbabu commented on PHOENIX-1479:
-------------------------------------

I have done that way to make local index work from 0.98.0 onward. Any way it's 
not good. Sorry for the mess.
While creating reference files during split if split row is outside
the storefile boundaries we skip creating reference files unnecessarily and 
scan later during compaction.
But for local index we cannot know exact split point because there the order is 
depending on index columns values. We cannot decide a kv belong to which 
daughter region until unless get data row key from the index row key.
So we want to skip below boundary check in HRegionFileSystem#splitStoreFile
and create two reference files always for both index daughter regions.

{code}
  Path splitStoreFile(final HRegionInfo hri, final String familyName,
      final StoreFile f, final byte[] splitRow, final boolean top) throws 
IOException {
    
    // Check whether the split row lies in the range of the store file
    // If it is outside the range, return directly.
    if (top) {
      //check if larger than last key.
      KeyValue splitKey = KeyValue.createFirstOnRow(splitRow);
      byte[] lastKey = f.createReader().getLastKey();      
      // If lastKey is null means storefile is empty.
      if (lastKey == null) return null;
      if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(), 
        splitKey.getKeyOffset(), splitKey.getKeyLength(), lastKey, 0, 
lastKey.length) > 0) {
        return null;
      }
    } else {
      //check if smaller than first key
      KeyValue splitKey = KeyValue.createLastOnRow(splitRow);
      byte[] firstKey = f.createReader().getFirstKey();
      // If firstKey is null means storefile is empty.
      if (firstKey == null) return null;
      if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(), 
        splitKey.getKeyOffset(), splitKey.getKeyLength(), firstKey, 0, 
firstKey.length) < 0) {
        return null;
      }      

      f.getReader().close(true);
    }
    
    Path splitDir = new Path(getSplitsDir(hri), familyName);
    // A reference to the bottom half of the hsf store file.
    Reference r =
      top ? Reference.createTopReference(splitRow): 
Reference.createBottomReference(splitRow);
    // Add the referred-to regions name as a dot separated suffix.
    // See REF_NAME_REGEX regex above.  The referred-to regions name is
    // up in the path of the passed in <code>f</code> -- parentdir is family,
    // then the directory above is the region name.
    String parentRegionName = regionInfo.getEncodedName();
    // Write reference with same file id only with the other region name as
    // suffix and into the new region location (under same family).
    Path p = new Path(splitDir, f.getPath().getName() + "." + parentRegionName);
    return r.write(fs, p);
  }
{code}

we can do this different ways
1) we can add new coprocessor hooks surrounding the above code this but what I 
feel is if we implement the new hooks in phoenix then it will not compile with 
versions already released.
2) We can have a Boolean table attribute to consider for skipping the check and 
set it to true for local index table.

Please suggest any other ways?

I will raise the issue for this in HBase. 
Thanks.

> IndexSplitTransaction won't compile after HBASE-12550
> -----------------------------------------------------
>
>                 Key: PHOENIX-1479
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1479
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Andrew Purtell
>
> {code}
> [ERROR] 
> /Users/apurtell/src/phoenix/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java:[364,28]
>  method createDaughterRegionFromSplits in class 
> org.apache.hadoop.hbase.regionserver.HRegion cannot be applied to given types;
> [ERROR] required: org.apache.hadoop.hbase.HRegionInfo,int
> [ERROR] found: org.apache.hadoop.hbase.HRegionInfo
> [ERROR] reason: actual and formal argument lists differ in length
> [ERROR] 
> /Users/apurtell/src/phoenix/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java:[368,28]
>  method createDaughterRegionFromSplits in class 
> org.apache.hadoop.hbase.regionserver.HRegion cannot be applied to given types;
> [ERROR] required: org.apache.hadoop.hbase.HRegionInfo,int
> [ERROR] found: org.apache.hadoop.hbase.HRegionInfo
> [ERROR] reason: actual and formal argument lists differ in length
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to