This is an automated email from the ASF dual-hosted git repository. skadam pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push: new 2852579 PHOENIX-5876 Let indexTool running with ONLY option not change index state (#774) 2852579 is described below commit 28525790a2c0851be201c8432c82044f1a1a614e Author: Weiming Wang <wangweiming...@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 <weiming.w...@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 e492b9d..7f93cfa 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 @@ -461,6 +461,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 dropIndexToolTables(conn); // Run the index tool to populate the index while verifying rows @@ -471,4 +475,5 @@ public class IndexToolForNonTxGlobalIndexIT extends BaseUniqueNamesOwnClusterIT 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 7f32de7..998f51d 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 @@ -123,11 +123,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()); + } } }