Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 f257f5e02 -> 67b568395
PHOENIX-5048 Index Rebuilder does not handle INDEX_STATE timestamp check for all index Signed-off-by: Geoffrey Jacoby <gjac...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/67b56839 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/67b56839 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/67b56839 Branch: refs/heads/4.x-HBase-1.2 Commit: 67b5683956a555fe912857004c327ec33ba1c2c4 Parents: f257f5e Author: Monani Mihir <monani.mi...@gmail.com> Authored: Fri Dec 14 18:15:55 2018 +0530 Committer: Geoffrey Jacoby <gjac...@apache.org> Committed: Mon Dec 17 10:12:20 2018 -0800 ---------------------------------------------------------------------- .../coprocessor/MetaDataRegionObserver.java | 35 ++++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/67b56839/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java index 4968525..4045d47 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataRegionObserver.java @@ -512,20 +512,27 @@ public class MetaDataRegionObserver extends BaseRegionObserver { String indexTableFullName = SchemaUtil.getTableName( indexPTable.getSchemaName().getString(), indexPTable.getTableName().getString()); - if (scanEndTime == latestUpperBoundTimestamp) { - IndexUtil.updateIndexState(conn, indexTableFullName, PIndexState.ACTIVE, 0L, latestUpperBoundTimestamp); - batchExecutedPerTableMap.remove(dataPTable.getName()); - LOG.info("Making Index:" + indexPTable.getTableName() + " active after rebuilding"); - } else { - // Increment timestamp so that client sees updated disable timestamp - IndexUtil.updateIndexState(conn, indexTableFullName, indexPTable.getIndexState(), scanEndTime * signOfDisableTimeStamp, latestUpperBoundTimestamp); - Long noOfBatches = batchExecutedPerTableMap.get(dataPTable.getName()); - if (noOfBatches == null) { - noOfBatches = 0l; - } - batchExecutedPerTableMap.put(dataPTable.getName(), ++noOfBatches); - LOG.info("During Round-robin build: Successfully updated index disabled timestamp for " - + indexTableFullName + " to " + scanEndTime); + try { + if (scanEndTime == latestUpperBoundTimestamp) { + IndexUtil.updateIndexState(conn, indexTableFullName, PIndexState.ACTIVE, 0L, + latestUpperBoundTimestamp); + batchExecutedPerTableMap.remove(dataPTable.getName()); + LOG.info("Making Index:" + indexPTable.getTableName() + " active after rebuilding"); + } else { + // Increment timestamp so that client sees updated disable timestamp + IndexUtil.updateIndexState(conn, indexTableFullName, indexPTable.getIndexState(), + scanEndTime * signOfDisableTimeStamp, latestUpperBoundTimestamp); + Long noOfBatches = batchExecutedPerTableMap.get(dataPTable.getName()); + if (noOfBatches == null) { + noOfBatches = 0l; + } + batchExecutedPerTableMap.put(dataPTable.getName(), ++noOfBatches); + LOG.info( + "During Round-robin build: Successfully updated index disabled timestamp for " + + indexTableFullName + " to " + scanEndTime); + } + } catch (SQLException e) { + LOG.error("Unable to rebuild " + dataPTable + " index " + indexTableFullName, e); } } } catch (Exception e) {