使用本地索引的具有Hbase + pheonix的Azure HDInsight群集

时间:2018-12-05 14:29:38

标签: azure hbase hdinsight

我们有一个运行HBase(Ambari)的HDInsight群集

  1. 我们已经使用Pheonix创建了一个表
  

如果不存在则创建表(Col1 VARCHAR(255)NOT NULL,Col1   INTEGER NOT NULL,Col3 INTEGER NOT NULL,目标 VARCHAR(255)   NOT NULL约束PK主键(Col1,Col2,Col3))   IMMUTABLE_ROWS = true

  1. 我们已经使用此Java代码将一些数据填充到了该表中

  2. 稍后,我们决定要在目标列上创建本地索引,如下所示

  

在结果上创建本地索引DESTINATION_IDX(目标)ASYNC

  1. 我们已经运行索引工具来填充索引,如下所示:
  

hbase org.apache.phoenix.mapreduce.index.IndexTool-数据表   结果-索引表DESTINATION_IDX-输出路径   DESTINATION_IDX_HFILES

  1. 当我们运行查询并使用目标列进行过滤时,一切正常。例如
  

从以下位置选择/ * + NO_CACHE,SKIP_SCAN * / COL1,COL2,COL3,DESTINATION   结果,其中COL1 ='数据'目的地 =“某个值”;

  1. 但是,如果我们在where查询中不使用DESTINATION,那么我们将在BaseResultIterators.class中获得NullPointerException
  

(来自phoenix-core-4.7.0-HBase-1.1.jar)

  1. 仅当我们使用新的本地索引时,才会引发此异常。如果我们这样查询忽略索引
  

从以下位置选择/ * + NO_CACHE,SKIP_SCAN, NO_INDEX * / COL1,COL2,COL3,DESTINATION   结果,其中COL1 ='数据'目的地 =“某个值”;

我们不会得到例外

在发生异常的地方显示一些相关代码

...
catch (StaleRegionBoundaryCacheException e2) {
// Catch only to try to recover from region boundary cache being out of date
if (!clearedCache) { // Clear cache once so that we rejigger job based on new boundaries
                                services.clearTableRegionCache(physicalTableName);

context.getOverallQueryMetrics().cacheRefreshedDueToSplits();
}
// Resubmit just this portion of work again
Scan oldScan = scanPair.getFirst();
byte[] startKey = oldScan.getAttribute(SCAN_ACTUAL_START_ROW);
byte[] endKey = oldScan.getStopRow();

====================Note the isLocalIndex is true ==================
if (isLocalIndex) {
     endKey = oldScan.getAttribute(EXPECTED_UPPER_REGION_KEY);

    //endKey is null for some reason in this point and the next function 
    //will fail inside it with NPE

}

List<List<Scan>> newNestedScans = this.getParallelScans(startKey, endKey);
  1. 我们必须使用此版本的Jar,因为我们在Azure HDInsight中运行 而且我们无法选择较新的jar版本

  2. 任何想法如何解决这个问题? “从区域边界缓存中过期的恢复”是什么意思?似乎与问题有关

1 个答案:

答案 0 :(得分:0)

看来,Azure HDInsight具有用于phoenix核心的版本(phoenix-core-4.7.0.2.6.5.3004-13.jar)有bug,但是如果我使用的是较新的版本(phoenix-core-4.7)。来自http://nexus-private.hortonworks.com:8081/nexus/content/repositories/hwxreleases/org/apache/phoenix/phoenix-core/4.7.0.2.6.5.8-2/的0.2.6.5.8-2.jar),我们不再看到该错误

请注意,不可能采用较新的版本(如4.8.0),因为在这种情况下,服务器将引发版本不匹配错误