You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by pb...@apache.org on 2019/05/28 22:52:57 UTC

[phoenix] 07/18: PHOENIX-5048 Index Rebuilder does not handle INDEX_STATE timestamp check for all index

This is an automated email from the ASF dual-hosted git repository.

pboado pushed a commit to branch 4.x-cdh5.16
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 4db9a6fb614a9d39130fe764adf52d92fb1ec8f7
Author: Monani Mihir <mo...@gmail.com>
AuthorDate: Fri Dec 14 12:45:55 2018 +0000

    PHOENIX-5048 Index Rebuilder does not handle INDEX_STATE timestamp check for all index
    
    Signed-off-by: Geoffrey Jacoby <gj...@apache.org>
---
 .../coprocessor/MetaDataRegionObserver.java        | 35 +++++++++++++---------
 1 file changed, 21 insertions(+), 14 deletions(-)

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) {