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

kadir 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 b8250cb  PHOENIX-5910 IndexTool verification-only runs should have 
counters for unverified rows
b8250cb is described below

commit b8250cb7368d5bd5783323702ebecc60c5155ab9
Author: Kadir <kozde...@salesforce.com>
AuthorDate: Thu May 21 14:23:34 2020 -0700

    PHOENIX-5910 IndexTool verification-only runs should have counters for 
unverified rows
---
 .../end2end/IndexToolForNonTxGlobalIndexIT.java    |  6 ++
 .../end2end/index/GlobalIndexCheckerIT.java        | 25 ++++++++
 .../coprocessor/IndexRebuildRegionScanner.java     | 55 ++++++++++++++++++
 .../coprocessor/IndexToolVerificationResult.java   | 66 ++++++++++++++++++++++
 .../index/IndexVerificationResultRepository.java   | 15 +++++
 .../index/PhoenixIndexImportDirectReducer.java     |  6 ++
 .../index/PhoenixIndexToolJobCounters.java         |  3 +
 7 files changed, 176 insertions(+)

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 aca88b3..1880a31 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
@@ -90,6 +90,9 @@ import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEF
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_EXPIRED_INDEX_ROW_COUNT;
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT;
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_MISSING_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_OLD_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT;
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_VALID_INDEX_ROW_COUNT;
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.REBUILT_INDEX_ROW_COUNT;
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.SCANNED_DATA_ROW_COUNT;
@@ -385,6 +388,9 @@ public class IndexToolForNonTxGlobalIndexIT extends 
BaseUniqueNamesOwnClusterIT
             assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_MISSING_INDEX_ROW_COUNT).getValue());
             assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT).getValue());
             assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_OLD_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT).getValue());
             assertEquals(0, 
indexTool.getJob().getCounters().findCounter(AFTER_REBUILD_VALID_INDEX_ROW_COUNT).getValue());
             assertEquals(0, 
indexTool.getJob().getCounters().findCounter(AFTER_REBUILD_EXPIRED_INDEX_ROW_COUNT).getValue());
             assertEquals(0, 
indexTool.getJob().getCounters().findCounter(AFTER_REBUILD_INVALID_INDEX_ROW_COUNT).getValue());
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexCheckerIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexCheckerIT.java
index 56d4614..5c358c7 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexCheckerIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/GlobalIndexCheckerIT.java
@@ -17,6 +17,18 @@
  */
 package org.apache.phoenix.end2end.index;
 
+import static org.apache.phoenix.mapreduce.PhoenixJobCounters.INPUT_RECORDS;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_EXPIRED_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_MISSING_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_OLD_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_VALID_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.REBUILT_INDEX_ROW_COUNT;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.SCANNED_DATA_ROW_COUNT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -446,6 +458,19 @@ public class GlobalIndexCheckerIT extends 
BaseUniqueNamesOwnClusterIT {
             conn.commit();
             conn.createStatement().execute("upsert into " + dataTableName + " 
(id, val1, val2) values ('c', 'cd','cde')");
             conn.commit();
+            IndexTool indexTool = IndexToolIT.runIndexTool(true, false, "", 
dataTableName, indexTableName, null, 0, IndexTool.IndexVerifyType.ONLY);
+            assertEquals(3, 
indexTool.getJob().getCounters().findCounter(INPUT_RECORDS).getValue());
+            assertEquals(3, 
indexTool.getJob().getCounters().findCounter(SCANNED_DATA_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(REBUILT_INDEX_ROW_COUNT).getValue());
+            assertEquals(3, 
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());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT).getValue());
+            assertEquals(2, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_OLD_INDEX_ROW_COUNT).getValue());
+            assertEquals(0, 
indexTool.getJob().getCounters().findCounter(BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT).getValue());
             IndexRegionObserver.setFailPostIndexUpdatesForTesting(false);
             String selectSql = "SELECT val2, val3 from " + dataTableName + " 
WHERE val1  = 'ab' and val2 = 'abcc'";
             // Verify that we will read from the index table
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 a5a4ec1..1442b3d 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
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.coprocessor;
 
+import static 
org.apache.phoenix.hbase.index.IndexRegionObserver.UNVERIFIED_BYTES;
 import static 
org.apache.phoenix.hbase.index.IndexRegionObserver.VERIFIED_BYTES;
 import static 
org.apache.phoenix.hbase.index.IndexRegionObserver.removeEmptyColumn;
 import static 
org.apache.phoenix.hbase.index.write.AbstractParallelWriterIndexCommitter.INDEX_WRITER_KEEP_ALIVE_TIME_CONF_KEY;
@@ -504,6 +505,55 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
         }
         return getMutationsWithSameTS(put, del);
     }
+
+    private void updateUnverifiedIndexRowCounters(Put actual,
+                                                  
IndexToolVerificationResult.PhaseResult verificationPhaseResult) {
+        // We are given an index row and need to check if this index row is 
unverified. However, before doing
+        // that we need to check if this index row is the most recent version. 
To do that, we need to check its data
+        // table row first.
+        // Get the data row key from the index row key
+        byte[] dataKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(actual.getRow()), viewConstants);
+        // Get the data table row mutations using the data row key
+        Pair<Put, Delete> putDeletePair = dataKeyToMutationMap.get(dataKey);
+        Put put = putDeletePair.getFirst();
+        if (put == null) {
+            // The data table row does not exist, so there is nothing to do
+            return;
+        }
+        Delete del = putDeletePair.getSecond();
+        if (del != null && getMaxTimestamp(del) >= getTimestamp(put)) {
+            // The data table row is deleted, i.e., the most recent mutation 
is delete. So there is nothing to do
+            return;
+        }
+        // Get the index row key from the data table row and check if the 
given index row has the same row key
+        byte[] indexRowKey = getIndexRowKey(indexMaintainer, put);
+        if (Bytes.compareTo(actual.getRow(), 0, actual.getRow().length,
+                indexRowKey, 0, indexRowKey.length) != 0) {
+            return;
+        }
+        // Get the empty column of the given index row
+        List<Cell> cellList = 
actual.get(indexMaintainer.getEmptyKeyValueFamily().copyBytesIfNecessary(),
+                indexMaintainer.getEmptyKeyValueQualifier());
+        Cell cell = (cellList != null && !cellList.isEmpty()) ? 
cellList.get(0) : null;
+        if (cell == null) {
+            // There is no empty column on the given index row. We do not know 
if this is a row generated by the new
+            // or the old design
+            
verificationPhaseResult.setUnknownIndexRowCount(verificationPhaseResult.getUnknownIndexRowCount()
 + 1);
+            return;
+        }
+        if (Bytes.compareTo(cell.getValueArray(), cell.getValueOffset(), 
cell.getValueLength(),
+                VERIFIED_BYTES, 0, VERIFIED_BYTES.length) == 0) {
+            // This is a verified index row, so nothing to do here
+            return;
+        } else if (Bytes.compareTo(cell.getValueArray(), 
cell.getValueOffset(), cell.getValueLength(),
+                UNVERIFIED_BYTES, 0, UNVERIFIED_BYTES.length) == 0) {
+            
verificationPhaseResult.setUnverifiedIndexRowCount(verificationPhaseResult.getUnverifiedIndexRowCount()
 +  1);
+            return;
+        }
+        // The empty column value is neither "verified" or "unverified". This 
must be a row from the old design
+        
verificationPhaseResult.setOldIndexRowCount(verificationPhaseResult.getOldIndexRowCount()
 + 1);
+    }
+
     /**
      * In this method, the actual list is repaired in memory using the 
expected list which is actually the output of
      * rebuilding the index table row. The result of this repair is used only 
for verification.
@@ -650,6 +700,11 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
         Collections.sort(expectedMutationList, MUTATION_TS_DESC_COMPARATOR);
         Collections.sort(actualMutationList, MUTATION_TS_DESC_COMPARATOR);
         if (verifyType == IndexTool.IndexVerifyType.ONLY) {
+            if (actualMutationList.get(0) instanceof Put) {
+                // We do check here only the latest version as older versions 
will always be unverified before
+                // newer versions are inserted.
+                updateUnverifiedIndexRowCounters((Put) 
actualMutationList.get(0), verificationPhaseResult);
+            }
             repairActualMutationList(actualMutationList, expectedMutationList);
         }
         cleanUpActualMutationList(actualMutationList);
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 06b8ff4..2e02263 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
@@ -37,6 +37,9 @@ import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultReposito
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_MISSING_INDEX_ROW_COUNT_BYTES;
+import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_OLD_INDEX_ROW_COUNT_BYTES;
+import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT_BYTES;
+import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_VALID_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.REBUILT_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.RESULT_TABLE_COLUMN_FAMILY;
@@ -117,6 +120,9 @@ public class IndexToolVerificationResult {
         private long beyondMaxLookBackInvalidIndexRowCount = 0;
         private long indexHasExtraCellsCount = 0;
         private long indexHasMissingCellsCount = 0;
+        private long unverifiedIndexRowCount = 0;
+        private long oldIndexRowCount = 0;
+        private long unknownIndexRowCount = 0;
 
         public void add(PhaseResult phaseResult) {
             
setBeyondMaxLookBackMissingIndexRowCount(getBeyondMaxLookBackMissingIndexRowCount()
 +
@@ -129,6 +135,9 @@ public class IndexToolVerificationResult {
             setInvalidIndexRowCount(getInvalidIndexRowCount() + 
phaseResult.getInvalidIndexRowCount());
             setIndexHasExtraCellsCount(getIndexHasExtraCellsCount() + 
phaseResult.getIndexHasExtraCellsCount());
             setIndexHasMissingCellsCount(getIndexHasMissingCellsCount() + 
phaseResult.getIndexHasMissingCellsCount());
+            setUnverifiedIndexRowCount(getUnverifiedIndexRowCount() + 
phaseResult.getUnverifiedIndexRowCount());
+            setUnknownIndexRowCount(getUnknownIndexRowCount() + 
phaseResult.getUnknownIndexRowCount());
+            setOldIndexRowCount(getOldIndexRowCount() + 
phaseResult.getOldIndexRowCount());
         }
 
         public PhaseResult() {
@@ -209,6 +218,9 @@ public class IndexToolVerificationResult {
             result = 31 * result + getBeyondMaxLookBackInvalidIndexRowCount();
             result = 31 * result + getIndexHasMissingCellsCount();
             result = 31 * result + getIndexHasExtraCellsCount();
+            result = 31 * result + getUnverifiedIndexRowCount();
+            result = 31 * result + getOldIndexRowCount();
+            result = 31 * result + getUnknownIndexRowCount();
             return (int) result;
         }
 
@@ -267,6 +279,30 @@ public class IndexToolVerificationResult {
         public void setIndexHasExtraCellsCount(long indexHasExtraCellsCount) {
             this.indexHasExtraCellsCount = indexHasExtraCellsCount;
         }
+
+        public long getUnverifiedIndexRowCount() {
+            return unverifiedIndexRowCount;
+        }
+
+        public void setUnverifiedIndexRowCount(long unverifiedIndexRowCount) {
+            this.unverifiedIndexRowCount = unverifiedIndexRowCount;
+        }
+
+        public long getOldIndexRowCount() {
+            return oldIndexRowCount;
+        }
+
+        public void setOldIndexRowCount(long oldIndexRowCount) {
+            this.oldIndexRowCount = oldIndexRowCount;
+        }
+
+        public long getUnknownIndexRowCount() {
+            return unknownIndexRowCount;
+        }
+
+        public void setUnknownIndexRowCount(long unknownIndexRowCount) {
+            this.unknownIndexRowCount = unknownIndexRowCount;
+        }
     }
 
     private long scannedDataRowCount = 0;
@@ -308,6 +344,18 @@ public class IndexToolVerificationResult {
         return getBefore().getInvalidIndexRowCount();
     }
 
+    public long getBeforeRebuildUnverifiedIndexRowCount() {
+        return getBefore().getUnverifiedIndexRowCount();
+    }
+
+    public long getBeforeRebuildOldIndexRowCount() {
+        return getBefore().getOldIndexRowCount();
+    }
+
+    public long getBeforeRebuildUnknownIndexRowCount() {
+        return getBefore().getUnknownIndexRowCount();
+    }
+
     public long getBeforeRebuildBeyondMaxLookBackMissingIndexRowCount() {
         return before.getBeyondMaxLookBackMissingIndexRowCount();
     }
@@ -391,6 +439,18 @@ public class IndexToolVerificationResult {
         
getBefore().setIndexHasExtraCellsCount(getBefore().getIndexHasExtraCellsCount() 
+ count);
     }
 
+    public void addBeforeUnverifiedIndexRowCount(long count) {
+        
getBefore().setUnverifiedIndexRowCount(getBefore().getUnverifiedIndexRowCount() 
+ count);
+    }
+
+    public void addBeforeOldIndexRowCount(long count) {
+        getBefore().setOldIndexRowCount(getBefore().getOldIndexRowCount() + 
count);
+    }
+
+    public void addBeforeUnknownIndexRowCount(long count) {
+        
getBefore().setUnknownIndexRowCount(getBefore().getUnknownIndexRowCount() + 
count);
+    }
+
     private void addAfterRebuildValidIndexRowCount(long count) {
         getAfter().setValidIndexRowCount(getAfter().getValidIndexRowCount() + 
count);
     }
@@ -459,6 +519,12 @@ public class IndexToolVerificationResult {
             addBeforeIndexHasExtraCellsCount(getValue(cell));
         } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES)) {
             addBeforeIndexHasMissingCellsCount(getValue(cell));
+        } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT_BYTES)) {
+            addBeforeUnverifiedIndexRowCount(getValue(cell));
+        } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_OLD_INDEX_ROW_COUNT_BYTES)) {
+            addBeforeOldIndexRowCount(getValue(cell));
+        } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT_BYTES)) {
+            addBeforeUnknownIndexRowCount(getValue(cell));
         } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_VALID_INDEX_ROW_COUNT_BYTES)) {
             addAfterRebuildValidIndexRowCount(getValue(cell));
         } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_EXPIRED_INDEX_ROW_COUNT_BYTES)) {
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexVerificationResultRepository.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexVerificationResultRepository.java
index d6cb2cf..50f36c6 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexVerificationResultRepository.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexVerificationResultRepository.java
@@ -73,6 +73,15 @@ public class IndexVerificationResultRepository implements 
AutoCloseable {
     public final static String BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT =
         "BeforeRebuildInvalidIndexRowCount";
     public final static byte[] BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_BYTES = 
Bytes.toBytes(BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT);
+    public final static String BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT =
+            "BeforeRebuildUnverifiedIndexRowCount";
+    public final static byte[] BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT_BYTES 
= Bytes.toBytes(BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT);
+    public final static String BEFORE_REBUILD_OLD_INDEX_ROW_COUNT =
+            "BeforeRebuildOldIndexRowCount";
+    public final static byte[] BEFORE_REBUILD_OLD_INDEX_ROW_COUNT_BYTES = 
Bytes.toBytes(BEFORE_REBUILD_OLD_INDEX_ROW_COUNT);
+    public final static String BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT =
+            "BeforeRebuildUnknownIndexRowCount";
+    public final static byte[] BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT_BYTES = 
Bytes.toBytes(BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT);
     public final static String AFTER_REBUILD_VALID_INDEX_ROW_COUNT =
         "AfterValidExpiredIndexRowCount";
     public final static byte[] AFTER_REBUILD_VALID_INDEX_ROW_COUNT_BYTES = 
Bytes.toBytes(AFTER_REBUILD_VALID_INDEX_ROW_COUNT);
@@ -211,6 +220,12 @@ public class IndexVerificationResultRepository implements 
AutoCloseable {
                 
Bytes.toBytes(Long.toString(verificationResult.getBeforeIndexHasExtraCellsCount())));
             put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES,
                 
Bytes.toBytes(Long.toString(verificationResult.getBeforeIndexHasMissingCellsCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT_BYTES,
+                    
Bytes.toBytes(Long.toString(verificationResult.getBeforeRebuildUnverifiedIndexRowCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_OLD_INDEX_ROW_COUNT_BYTES,
+                    
Bytes.toBytes(Long.toString(verificationResult.getBeforeRebuildOldIndexRowCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT_BYTES,
+                    
Bytes.toBytes(Long.toString(verificationResult.getBeforeRebuildUnknownIndexRowCount())));
         }
         if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == 
IndexTool.IndexVerifyType.BOTH) {
             put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_VALID_INDEX_ROW_COUNT_BYTES,
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 169608a..10a6768 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
@@ -85,6 +85,12 @@ public class PhoenixIndexImportDirectReducer extends
                         
setValue(verificationResult.getBeforeIndexHasExtraCellsCount());
                 
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS).
                         
setValue(verificationResult.getBeforeIndexHasMissingCellsCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT).
+                        
setValue(verificationResult.getBeforeRebuildUnverifiedIndexRowCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_OLD_INDEX_ROW_COUNT).
+                        
setValue(verificationResult.getBeforeRebuildOldIndexRowCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT).
+                        
setValue(verificationResult.getBeforeRebuildUnknownIndexRowCount());
             }
             if (verifyType == IndexTool.IndexVerifyType.BOTH || verifyType == 
IndexTool.IndexVerifyType.AFTER) {
                 
context.getCounter(PhoenixIndexToolJobCounters.AFTER_REBUILD_VALID_INDEX_ROW_COUNT).
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexToolJobCounters.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexToolJobCounters.java
index a5a3fae..c6c6ec7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexToolJobCounters.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/PhoenixIndexToolJobCounters.java
@@ -32,6 +32,9 @@ public enum PhoenixIndexToolJobCounters {
     BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT,
     BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS,
     BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS,
+    BEFORE_REBUILD_UNVERIFIED_INDEX_ROW_COUNT,
+    BEFORE_REBUILD_OLD_INDEX_ROW_COUNT,
+    BEFORE_REBUILD_UNKNOWN_INDEX_ROW_COUNT,
     AFTER_REBUILD_VALID_INDEX_ROW_COUNT,
     AFTER_REBUILD_EXPIRED_INDEX_ROW_COUNT,
     AFTER_REBUILD_MISSING_INDEX_ROW_COUNT,

Reply via email to