Repository: phoenix Updated Branches: refs/heads/master 1c042c25e -> 71946ed27
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/71946ed2 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/71946ed2 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/71946ed2 Branch: refs/heads/master Commit: 71946ed27cb17fd291b472cc2753092891a6abb5 Parents: 1c042c2 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 09:34:03 2018 -0800 ---------------------------------------------------------------------- .../coprocessor/MetaDataRegionObserver.java | 35 ++++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/71946ed2/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 8983733..956e04b 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 @@ -519,20 +519,27 @@ public class MetaDataRegionObserver implements RegionObserver,RegionCoprocessor 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) {