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 7b4db73 PHOENIX-5840: IndexTool inline verification should not fail with -v ONLY option (#761) 7b4db73 is described below commit 7b4db73b37d8a67fb0238e405abcf4e5f160a103 Author: Swaroopa Kadam <swaroopa.kada...@gmail.com> AuthorDate: Thu Apr 16 10:04:37 2020 -0700 PHOENIX-5840: IndexTool inline verification should not fail with -v ONLY option (#761) Co-authored-by: s.kadam <s.ka...@apache.org> --- .../it/java/org/apache/phoenix/end2end/IndexToolIT.java | 4 ++-- .../coprocessor/IndexToolVerificationResult.java | 14 +++----------- .../index/PhoenixIndexImportDirectReducer.java | 2 +- .../phoenix/parse/PhoenixRowTimestampFunctionTest.java | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java index 7394f57..11cce5c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java @@ -624,7 +624,7 @@ public class IndexToolIT extends BaseUniqueNamesOwnClusterIT { // IndexTool will go through each data table row and record the mismatches in the output table // called PHOENIX_INDEX_TOOL runIndexTool(directApi, useSnapshot, schemaName, dataTableName, indexTableName, - null, -1, IndexTool.IndexVerifyType.ONLY); + null, 0, IndexTool.IndexVerifyType.ONLY); Cell cell = getErrorMessageFromIndexToolOutputTable(conn, dataTableFullName, indexTableFullName); byte[] expectedValueBytes = Bytes.toBytes("Missing index row"); assertTrue(Bytes.compareTo(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength(), @@ -662,7 +662,7 @@ public class IndexToolIT extends BaseUniqueNamesOwnClusterIT { conn.createStatement() .execute(String.format("CREATE INDEX %s ON %s (NAME) INCLUDE (CODE) ASYNC", indexTableName, dataTableFullName)); - runIndexTool(directApi, useSnapshot, schemaName, dataTableName, indexTableName, null, -1, + runIndexTool(directApi, useSnapshot, schemaName, dataTableName, indexTableName, null, 0, IndexTool.IndexVerifyType.ONLY); Cell cell = getErrorMessageFromIndexToolOutputTable(conn, dataTableFullName, diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexToolVerificationResult.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexToolVerificationResult.java index ed92fad..84a36d9 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexToolVerificationResult.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexToolVerificationResult.java @@ -280,17 +280,9 @@ public class IndexToolVerificationResult { return verificationResult; } - public boolean isVerificationFailed(IndexTool.IndexVerifyType verifyType) { - if (verifyType == IndexTool.IndexVerifyType.BEFORE || verifyType == IndexTool.IndexVerifyType.NONE) { - return false; - } else if (verifyType == IndexTool.IndexVerifyType.ONLY) { - if (before.invalidIndexRowCount + before.missingIndexRowCount > 0) { - return true; - } - } else if (verifyType == IndexTool.IndexVerifyType.BOTH || verifyType == IndexTool.IndexVerifyType.AFTER) { - if (after.invalidIndexRowCount + after.missingIndexRowCount > 0) { - return true; - } + public boolean isVerificationFailed() { + if (after.invalidIndexRowCount + after.missingIndexRowCount > 0) { + return true; } return false; } 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 8d1b4db..6a79205 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 @@ -91,7 +91,7 @@ public class PhoenixIndexImportDirectReducer extends context.getCounter(PhoenixIndexToolJobCounters.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT). setValue(verificationResult.getAfterRebuildInvalidIndexRowCount()); } - if (verificationResult.isVerificationFailed(verifyType)) { + if (verificationResult.isVerificationFailed()) { throw new IOException("Index verification failed! " + verificationResult); } } catch (Exception e) { diff --git a/phoenix-core/src/test/java/org/apache/phoenix/parse/PhoenixRowTimestampFunctionTest.java b/phoenix-core/src/test/java/org/apache/phoenix/parse/PhoenixRowTimestampFunctionTest.java index 6e1e901..aa9531e 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/parse/PhoenixRowTimestampFunctionTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/PhoenixRowTimestampFunctionTest.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.phoenix.parse; import org.junit.Test;