You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sk...@apache.org on 2020/05/05 18:51:14 UTC
[phoenix] branch 4.x updated: PHOENIX-5876 Let indexTool running
with ONLY option not change index state (#774)
This is an automated email from the ASF dual-hosted git repository.
skadam pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x by this push:
new 786ce96 PHOENIX-5876 Let indexTool running with ONLY option not change index state (#774)
786ce96 is described below
commit 786ce96c8b4fa8f4ad1206b381e82b5bb99646b3
Author: Weiming Wang <wa...@outlook.com>
AuthorDate: Tue May 5 11:51:01 2020 -0700
PHOENIX-5876 Let indexTool running with ONLY option not change index state (#774)
Co-authored-by: Weiming Wang <we...@salesforce.com>
---
.../phoenix/end2end/IndexToolForNonTxGlobalIndexIT.java | 5 +++++
.../mapreduce/index/PhoenixIndexImportDirectReducer.java | 13 ++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolForNonTxGlobalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolForNonTxGlobalIndexIT.java
index e151040..018ec0a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolForNonTxGlobalIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolForNonTxGlobalIndexIT.java
@@ -470,6 +470,10 @@ public class IndexToolForNonTxGlobalIndexIT extends BaseUniqueNamesOwnClusterIT
} catch(Exception ex) {
Assert.fail("Fail to parsing the error message from IndexToolOutputTable");
}
+
+ // VERIFY option should not change the index state.
+ Assert.assertEquals(PIndexState.BUILDING, TestUtil.getIndexState(conn, indexTableFullName));
+
// Delete the output table for the next test
IndexToolIT.dropIndexToolTables(conn);
// Run the index tool to populate the index while verifying rows
@@ -480,4 +484,5 @@ public class IndexToolForNonTxGlobalIndexIT extends BaseUniqueNamesOwnClusterIT
IndexToolIT.dropIndexToolTables(conn);
}
}
+
}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java
index 1dbc686..169608a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexImportDirectReducer.java
@@ -131,11 +131,14 @@ public class PhoenixIndexImportDirectReducer extends
updateCounters(verifyType, context);
}
- try {
- IndexToolUtil.updateIndexState(context.getConfiguration(), PIndexState.ACTIVE);
- } catch (SQLException e) {
- LOGGER.error(" Failed to update the status to Active");
- throw new RuntimeException(e.getMessage());
+ if (verifyType != IndexTool.IndexVerifyType.ONLY) {
+ // "ONLY" option should not turn index state to ACTIVE, as it doesn't rebuild the index
+ try {
+ IndexToolUtil.updateIndexState(context.getConfiguration(), PIndexState.ACTIVE);
+ } catch (SQLException e) {
+ LOGGER.error(" Failed to update the status to Active");
+ throw new RuntimeException(e.getMessage());
+ }
}
}