You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ka...@apache.org on 2020/02/01 21:29:34 UTC

[phoenix] branch 4.x-HBase-1.3 updated: PHOENIX-5706 IndexTool verification reports failure when data row has no covered column values

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

kadir pushed a commit to branch 4.x-HBase-1.3
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.3 by this push:
     new 90a594b  PHOENIX-5706 IndexTool verification reports failure when data row has no covered column values
90a594b is described below

commit 90a594bf4b6d27df445e98586bf9c08f577334ba
Author: Kadir <ko...@salesforce.com>
AuthorDate: Fri Jan 31 13:42:53 2020 -0800

    PHOENIX-5706 IndexTool verification reports failure when data row has no covered column values
---
 .../src/it/java/org/apache/phoenix/end2end/IndexToolIT.java  | 12 ++++++++++++
 .../phoenix/coprocessor/IndexRebuildRegionScanner.java       |  5 ++---
 2 files changed, 14 insertions(+), 3 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 400a760..020541f 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
@@ -337,6 +337,18 @@ public class IndexToolIT extends BaseUniqueNamesOwnClusterIT {
             assertTrue(rs.next());
             assertEquals(2, rs.getInt(1));
             assertFalse(rs.next());
+            if (localIndex || transactional || useTenantId || useSnapshot) {
+                return;
+            }
+            // Run the index MR job and verify that the global index table is built correctly
+            IndexTool indexTool = runIndexTool(directApi, useSnapshot, schemaName, dataTableName, indexTableName, null, 0, IndexTool.IndexVerifyType.BEFORE, new String[0]);
+            assertEquals(4, indexTool.getJob().getCounters().findCounter(INPUT_RECORDS).getValue());
+            assertEquals(4, indexTool.getJob().getCounters().findCounter(SCANNED_DATA_ROW_COUNT).getValue());
+            assertEquals(0, indexTool.getJob().getCounters().findCounter(REBUILT_INDEX_ROW_COUNT).getValue());
+            assertEquals(4, indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_VALID_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_EXPIRED_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_MISSING_INDEX_ROW_COUNT).getValue());
         } finally {
             conn.close();
         }
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
index ed55489..e726aa7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
@@ -683,9 +683,8 @@ public class IndexRebuildRegionScanner extends BaseRegionScanner {
         Put indexPut = indexMaintainer.buildUpdateMutation(GenericKeyValueBuilder.INSTANCE,
                 valueGetter, new ImmutableBytesWritable(dataRow.getRow()), ts, null, null);
         if (indexPut == null) {
-            String errorMsg = "Empty index update";
-            logToIndexToolOutputTable(dataRow.getRow(), indexRow.getRow(), ts, getMaxTimestamp(indexRow), errorMsg);
-            return false;
+            // This means the data row does not have any covered column values
+            indexPut = new Put(indexRow.getRow());
         }
         else {
             // Remove the empty column prepared by Index codec as we need to change its value