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

gokcen 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 a4361c5  PHOENIX-5841 add a counter for mismatching num of columns
a4361c5 is described below

commit a4361c52be04ce873a802a4c87b7c34203a48583
Author: Gokcen Iskender <gisken...@salesforce.com>
AuthorDate: Thu Apr 16 13:32:17 2020 -0700

    PHOENIX-5841 add a counter for mismatching num of columns
    
    Signed-off-by: Gokcen Iskender <gisken...@salesforce.com>
---
 .../org/apache/phoenix/end2end/IndexToolIT.java    |  8 ++
 .../coprocessor/IndexRebuildRegionScanner.java     | 56 ++++++-------
 .../coprocessor/IndexToolVerificationResult.java   | 93 +++++++++++++++++++---
 .../index/IndexVerificationResultRepository.java   | 18 +++++
 .../index/PhoenixIndexImportDirectReducer.java     |  8 ++
 .../index/PhoenixIndexToolJobCounters.java         |  6 +-
 .../phoenix/index/VerifySingleIndexRowTest.java    | 73 ++++++++++++-----
 7 files changed, 199 insertions(+), 63 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 e5db314..8a9cc10 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
@@ -94,6 +94,10 @@ import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.AFT
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT;
 import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.AFTER_REBUILD_BEYOND_MAXLOOKBACK_MISSING_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.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS;
+import static 
org.apache.phoenix.mapreduce.index.PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS;
 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;
@@ -305,6 +309,10 @@ public class IndexToolIT 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_INVALID_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_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS).getValue());
+            assertEquals(0, indexTool.getJob().getCounters().findCounter(
+                    
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS).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 e767a23..4f1c48f 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
@@ -147,7 +147,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
                 verify = true;
                 viewConstants = 
IndexUtil.deserializeViewConstantsFromScan(scan);
                 verificationOutputRepository =
-                    new 
IndexVerificationOutputRepository(indexMaintainer.getIndexTableName(), 
hTableFactory);
+                        new 
IndexVerificationOutputRepository(indexMaintainer.getIndexTableName(), 
hTableFactory);
                 indexKeyToMutationMap = 
Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
                 dataKeyToMutationMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
                 pool = new 
WaitForCompletionTaskRunner(ThreadPoolManager.getExecutor(
@@ -200,7 +200,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
         if (verify) {
             try {
                 
verificationResultRepository.logToIndexToolResultTable(verificationResult,
-                    verifyType, region.getRegionInfo().getRegionName());
+                        verifyType, region.getRegionInfo().getRegionName());
             } finally {
                 this.pool.stop("IndexRebuildRegionScanner is closing");
                 hTableFactory.shutdown();
@@ -266,17 +266,17 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
     }
 
     public void logToIndexToolOutputTable(byte[] dataRowKey, byte[] 
indexRowKey, long dataRowTs, long indexRowTs,
-                                          String errorMsg) throws IOException {
+            String errorMsg) throws IOException {
         logToIndexToolOutputTable(dataRowKey, indexRowKey, dataRowTs, 
indexRowTs, errorMsg, null, null);
     }
 
     @VisibleForTesting
     public void logToIndexToolOutputTable(byte[] dataRowKey, byte[] 
indexRowKey, long dataRowTs, long indexRowTs,
-                                           String errorMsg, byte[] 
expectedVaue, byte[] actualValue)
-        throws IOException {
+            String errorMsg, byte[] expectedVaue, byte[] actualValue)
+            throws IOException {
         verificationOutputRepository.logToIndexToolOutputTable(dataRowKey, 
indexRowKey, dataRowTs, indexRowTs,
                 errorMsg, expectedVaue, actualValue, 
scan.getTimeRange().getMax(),
-            region.getRegionInfo().getTable().getName(), isBeforeRebuilt);
+                region.getRegionInfo().getTable().getName(), isBeforeRebuilt);
     }
 
     private static Cell getCell(Mutation m, byte[] family, byte[] qualifier) {
@@ -292,7 +292,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
         return null;
     }
 
-    private void logMismatch(Mutation expected, Mutation actual, int 
iteration) throws IOException {
+    private void logMismatch(Mutation expected, Mutation actual, int 
iteration, IndexToolVerificationResult.PhaseResult verificationPhaseResult) 
throws IOException {
         if (getTimestamp(expected) != getTimestamp(actual)) {
             String errorMsg = "Not matching timestamp";
             byte[] dataKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(expected.getRow()), viewConstants);
@@ -315,6 +315,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
                     byte[] dataKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(expected.getRow()), viewConstants);
                     String errorMsg = "Missing cell (in iteration " + 
iteration + ") " + Bytes.toString(family) + ":" + Bytes.toString(qualifier);
                     logToIndexToolOutputTable(dataKey, expected.getRow(), 
getTimestamp(expected), getTimestamp(actual), errorMsg);
+                    
verificationPhaseResult.setIndexHasMissingCellsCount(verificationPhaseResult.getIndexHasMissingCellsCount()
 + 1);
                     return;
                 }
                 if (!CellUtil.matchingValue(actualCell, expectedCell)) {
@@ -338,6 +339,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
             byte[] dataKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(expected.getRow()), viewConstants);
             logToIndexToolOutputTable(dataKey, expected.getRow(), 
getTimestamp(expected), getTimestamp(actual),
                     errorMsg);
+            
verificationPhaseResult.setIndexHasExtraCellsCount(verificationPhaseResult.getIndexHasExtraCellsCount()
 + 1);
         }
     }
 
@@ -674,7 +676,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
                 // if current expected index mutation is beyond max look back 
window, we only need to make sure its latest
                 // mutation is a matching one, as an SCN query is required.
                 verificationPhaseResult.
-                    
setValidIndexRowCount(verificationPhaseResult.getValidIndexRowCount() + 1);
+                        
setValidIndexRowCount(verificationPhaseResult.getValidIndexRowCount() + 1);
                 return true;
             }
 
@@ -684,7 +686,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
             // This repair is required, when there is only one index row for a 
given data table row and the timestamp of that row
             // can be beyond maxLookBack.
             verificationPhaseResult.
-                
setBeyondMaxLookBackInvalidIndexRowCount(verificationPhaseResult.getBeyondMaxLookBackInvalidIndexRowCount()
 + 1);
+                    
setBeyondMaxLookBackInvalidIndexRowCount(verificationPhaseResult.getBeyondMaxLookBackInvalidIndexRowCount()
 + 1);
             byte[] dataKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(indexRow.getRow()), viewConstants);
             String errorMsg = String.format("Expect %1$s mutations but got 
%2$s (beyond maxLookBack)",
                     expectedSize,
@@ -696,7 +698,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
         }
         else {
             if (actualIndex < actualSize && actual instanceof Put  &&  
expected instanceof Put){
-                logMismatch(expected, actual, expectedIndex);
+                logMismatch(expected, actual, expectedIndex, 
verificationPhaseResult);
             }
             else {
                 byte[] dataKey = indexMaintainer.buildDataRowKey(new 
ImmutableBytesWritable(indexRow.getRow()), viewConstants);
@@ -763,7 +765,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
                 if (isTimestampBeyondMaxLookBack(maxLookBackInMills, 
currentTime, getTimestamp(mutation))){
                     errorMsg = 
ERROR_MESSAGE_MISSING_INDEX_ROW_BEYOND_MAX_LOOKBACK;
                     verificationPhaseResult.
-                        
setBeyondMaxLookBackMissingIndexRowCount(verificationPhaseResult.getBeyondMaxLookBackMissingIndexRowCount()
 + 1);
+                            
setBeyondMaxLookBackMissingIndexRowCount(verificationPhaseResult.getBeyondMaxLookBackMissingIndexRowCount()
 + 1);
                 }
                 else {
                     errorMsg = ERROR_MESSAGE_MISSING_INDEX_ROW;
@@ -781,7 +783,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
     }
 
     private void addVerifyTask(final List<KeyRange> keys,
-                               final IndexToolVerificationResult.PhaseResult 
verificationPhaseResult) {
+            final IndexToolVerificationResult.PhaseResult 
verificationPhaseResult) {
         tasks.add(new Task<Boolean>() {
             @Override
             public Boolean call() throws Exception {
@@ -983,7 +985,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
     }
 
     private static Put prepareIndexPutForRebuid(IndexMaintainer 
indexMaintainer, ImmutableBytesPtr rowKeyPtr,
-                                                ValueGetter mergedRowVG, long 
ts)
+            ValueGetter mergedRowVG, long ts)
             throws IOException {
         Put indexPut = 
indexMaintainer.buildUpdateMutation(GenericKeyValueBuilder.INSTANCE,
                 mergedRowVG, rowKeyPtr, ts, null, null);
@@ -1040,16 +1042,16 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
         for (List<Cell> cells : del.getFamilyCellMap().values()) {
             for (Cell cell : cells) {
                 switch ((KeyValue.Type.codeToType(cell.getTypeByte()))) {
-                    case DeleteFamily:
-                        
put.getFamilyCellMap().remove(CellUtil.cloneFamily(cell));
-                        break;
-                    case DeleteColumn:
-                        removeColumn(put, cell);
-                        break;
-                    default:
-                        // We do not expect this can happen
-                        throw new DoNotRetryIOException("Single version delete 
marker in data mutation " +
-                                del);
+                case DeleteFamily:
+                    put.getFamilyCellMap().remove(CellUtil.cloneFamily(cell));
+                    break;
+                case DeleteColumn:
+                    removeColumn(put, cell);
+                    break;
+                default:
+                    // We do not expect this can happen
+                    throw new DoNotRetryIOException("Single version delete 
marker in data mutation " +
+                            del);
                 }
             }
         }
@@ -1063,7 +1065,7 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
      * after put.
      */
     public static List<Mutation> 
prepareIndexMutationsForRebuild(IndexMaintainer indexMaintainer,
-                                                                 Put dataPut, 
Delete dataDel) throws IOException {
+            Put dataPut, Delete dataDel) throws IOException {
         List<Mutation> dataMutations = getMutationsWithSameTS(dataPut, 
dataDel);
         List<Mutation> indexMutations = 
Lists.newArrayListWithExpectedSize(dataMutations.size());
         // The row key ptr of the data table row for which we will build index 
rows here
@@ -1259,8 +1261,8 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
             region.closeRegionOperation();
             mutations.clear();
             if (verify) {
-              dataKeyToMutationMap.clear();
-              indexKeyToMutationMap.clear();
+                dataKeyToMutationMap.clear();
+                indexKeyToMutationMap.clear();
             }
         }
         if (indexRowKey != null) {
@@ -1283,4 +1285,4 @@ public class IndexRebuildRegionScanner extends 
GlobalIndexRegionScanner {
     public long getMaxResultSize() {
         return scan.getMaxResultSize();
     }
-}
+}
\ No newline at end of file
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 3299ed6..a2d9145 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
@@ -27,12 +27,16 @@ import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultReposito
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_EXPIRED_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_BYTES;
+import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES;
+import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_MISSING_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.AFTER_REBUILD_VALID_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_EXPIRED_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_BYTES;
+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_VALID_INDEX_ROW_COUNT_BYTES;
 import static 
org.apache.phoenix.mapreduce.index.IndexVerificationResultRepository.REBUILT_INDEX_ROW_COUNT_BYTES;
@@ -112,6 +116,8 @@ public class IndexToolVerificationResult {
         private long invalidIndexRowCount = 0;
         private long beyondMaxLookBackMissingIndexRowCount = 0;
         private long beyondMaxLookBackInvalidIndexRowCount = 0;
+        private long indexHasExtraCellsCount = 0;
+        private long indexHasMissingCellsCount = 0;
 
         public void add(PhaseResult phaseResult) {
             
setBeyondMaxLookBackMissingIndexRowCount(getBeyondMaxLookBackMissingIndexRowCount()
 +
@@ -122,6 +128,8 @@ public class IndexToolVerificationResult {
             setExpiredIndexRowCount(getExpiredIndexRowCount() + 
phaseResult.getExpiredIndexRowCount());
             setMissingIndexRowCount(getMissingIndexRowCount() + 
phaseResult.getMissingIndexRowCount());
             setInvalidIndexRowCount(getInvalidIndexRowCount() + 
phaseResult.getInvalidIndexRowCount());
+            setIndexHasExtraCellsCount(getIndexHasExtraCellsCount() + 
phaseResult.getIndexHasExtraCellsCount());
+            setIndexHasMissingCellsCount(getIndexHasMissingCellsCount() + 
phaseResult.getIndexHasMissingCellsCount());
         }
 
         public PhaseResult() {
@@ -130,13 +138,16 @@ public class IndexToolVerificationResult {
         public PhaseResult(long validIndexRowCount, long expiredIndexRowCount,
                            long missingIndexRowCount, long 
invalidIndexRowCount,
                            long beyondMaxLookBackMissingIndexRowCount,
-                           long beyondMaxLookBackInvalidIndexRowCount) {
+                           long beyondMaxLookBackInvalidIndexRowCount,
+                            long indexHasExtraCellsCount, long 
indexHasMissingCellsCount) {
             this.setValidIndexRowCount(validIndexRowCount);
             this.setExpiredIndexRowCount(expiredIndexRowCount);
             this.setMissingIndexRowCount(missingIndexRowCount);
             this.setInvalidIndexRowCount(invalidIndexRowCount);
             
this.setBeyondMaxLookBackInvalidIndexRowCount(beyondMaxLookBackInvalidIndexRowCount);
             
this.setBeyondMaxLookBackMissingIndexRowCount(beyondMaxLookBackMissingIndexRowCount);
+            this.setIndexHasExtraCellsCount(indexHasExtraCellsCount);
+            this.setIndexHasMissingCellsCount(indexHasMissingCellsCount);
         }
 
 
@@ -145,15 +156,27 @@ public class IndexToolVerificationResult {
                 + getBeyondMaxLookBackMissingIndexRowCount() + 
getBeyondMaxLookBackInvalidIndexRowCount();
         }
 
+        public long getIndexHasExtraCellsCount() {
+            return indexHasExtraCellsCount;
+        }
+
+        public long getIndexHasMissingCellsCount() {
+            return indexHasMissingCellsCount;
+        }
+
         @Override
         public String toString() {
             return "PhaseResult{" +
-                "validIndexRowCount=" + getValidIndexRowCount() +
-                ", expiredIndexRowCount=" + getExpiredIndexRowCount() +
-                ", missingIndexRowCount=" + getMissingIndexRowCount() +
-                ", invalidIndexRowCount=" + getInvalidIndexRowCount() +
-                ", beyondMaxLookBackMissingIndexRowCount=" + 
getBeyondMaxLookBackMissingIndexRowCount() +
-                ", beyondMaxLookBackInvalidIndexRowCount=" + 
getBeyondMaxLookBackInvalidIndexRowCount();
+
+                    "validIndexRowCount=" + validIndexRowCount +
+                    ", expiredIndexRowCount=" + expiredIndexRowCount +
+                    ", missingIndexRowCount=" + missingIndexRowCount +
+                    ", invalidIndexRowCount=" + invalidIndexRowCount +
+                    ", beyondMaxLookBackMissingIndexRowCount=" + 
getBeyondMaxLookBackMissingIndexRowCount() +
+                    ", beyondMaxLookBackInvalidIndexRowCount=" + 
getBeyondMaxLookBackInvalidIndexRowCount() +
+                    ", extraCellsOnIndexCount=" + indexHasExtraCellsCount +
+                    ", missingCellsOnIndexCount=" + indexHasMissingCellsCount +
+                    '}';
         }
 
         @Override
@@ -165,12 +188,15 @@ public class IndexToolVerificationResult {
                 return false;
             }
             PhaseResult pr = (PhaseResult) o;
-            return this.getExpiredIndexRowCount() == 
pr.getExpiredIndexRowCount()
-                && this.getValidIndexRowCount() == pr.getValidIndexRowCount()
-                && this.getInvalidIndexRowCount() == 
pr.getInvalidIndexRowCount()
-                && this.getMissingIndexRowCount() == 
pr.getMissingIndexRowCount()
-                && this.getBeyondMaxLookBackInvalidIndexRowCount() == 
pr.getBeyondMaxLookBackInvalidIndexRowCount()
-                && this.getBeyondMaxLookBackMissingIndexRowCount() == 
pr.getBeyondMaxLookBackMissingIndexRowCount();
+
+            return this.expiredIndexRowCount == pr.expiredIndexRowCount
+                    && this.validIndexRowCount == pr.validIndexRowCount
+                    && this.invalidIndexRowCount == pr.invalidIndexRowCount
+                    && this.missingIndexRowCount == pr.missingIndexRowCount
+                    && this.getBeyondMaxLookBackInvalidIndexRowCount() == 
pr.getBeyondMaxLookBackInvalidIndexRowCount()
+                    && this.getBeyondMaxLookBackMissingIndexRowCount() == 
pr.getBeyondMaxLookBackMissingIndexRowCount()
+                    && this.indexHasMissingCellsCount == 
pr.indexHasMissingCellsCount
+                    && this.indexHasExtraCellsCount == 
pr.indexHasExtraCellsCount;
         }
 
         @Override
@@ -182,6 +208,8 @@ public class IndexToolVerificationResult {
             result = 31 * result + getInvalidIndexRowCount();
             result = 31 * result + getBeyondMaxLookBackMissingIndexRowCount();
             result = 31 * result + getBeyondMaxLookBackInvalidIndexRowCount();
+            result = 31 * result + getIndexHasMissingCellsCount();
+            result = 31 * result + getIndexHasExtraCellsCount();
             return (int) result;
         }
 
@@ -232,6 +260,14 @@ public class IndexToolVerificationResult {
         public void setBeyondMaxLookBackInvalidIndexRowCount(long 
beyondMaxLookBackInvalidIndexRowCount) {
             this.beyondMaxLookBackInvalidIndexRowCount = 
beyondMaxLookBackInvalidIndexRowCount;
         }
+
+        public void setIndexHasMissingCellsCount(long 
indexHasMissingCellsCount) {
+            this.indexHasMissingCellsCount = indexHasMissingCellsCount;
+        }
+
+        public void setIndexHasExtraCellsCount(long indexHasExtraCellsCount) {
+            this.indexHasExtraCellsCount = indexHasExtraCellsCount;
+        }
     }
 
     private long scannedDataRowCount = 0;
@@ -285,6 +321,10 @@ public class IndexToolVerificationResult {
         return getBefore().getMissingIndexRowCount();
     }
 
+    public long getBeforeIndexHasMissingCellsCount() {return 
getBefore().getIndexHasMissingCellsCount(); }
+
+    public long getBeforeIndexHasExtraCellsCount() {return 
getBefore().getIndexHasExtraCellsCount(); }
+
     public long getAfterRebuildValidIndexRowCount() {
         return getAfter().getValidIndexRowCount();
     }
@@ -309,6 +349,10 @@ public class IndexToolVerificationResult {
         return after.getBeyondMaxLookBackInvalidIndexRowCount();
     }
 
+    public long getAfterIndexHasMissingCellsCount() { return 
getAfter().getIndexHasMissingCellsCount(); }
+
+    public long getAfterIndexHasExtraCellsCount() { return 
getAfter().getIndexHasExtraCellsCount(); }
+
     private void addScannedDataRowCount(long count) {
         this.setScannedDataRowCount(this.getScannedDataRowCount() + count);
     }
@@ -340,6 +384,13 @@ public class IndexToolVerificationResult {
     private void addBeforeRebuildBeyondMaxLookBackInvalidIndexRowCount(long 
count) {
         
before.setBeyondMaxLookBackInvalidIndexRowCount(before.getBeyondMaxLookBackInvalidIndexRowCount()
 + count);
     }
+    public void addBeforeIndexHasMissingCellsCount(long count) {
+        
getBefore().setIndexHasMissingCellsCount(getBefore().getIndexHasMissingCellsCount()
 + count);
+    }
+
+    public void addBeforeIndexHasExtraCellsCount(long count) {
+        
getBefore().setIndexHasExtraCellsCount(getBefore().getIndexHasExtraCellsCount() 
+ count);
+    }
 
     private void addAfterRebuildValidIndexRowCount(long count) {
         getAfter().setValidIndexRowCount(getAfter().getValidIndexRowCount() + 
count);
@@ -365,6 +416,14 @@ public class IndexToolVerificationResult {
         
after.setBeyondMaxLookBackInvalidIndexRowCount(after.getBeyondMaxLookBackInvalidIndexRowCount()
 + count);
     }
 
+    public void addAfterIndexHasMissingCellsCount(long count) {
+        
getAfter().setIndexHasMissingCellsCount(getAfter().getIndexHasMissingCellsCount()
 + count);
+    }
+
+    public void addAfterIndexHasExtraCellsCount(long count) {
+        
getAfter().setIndexHasExtraCellsCount(getAfter().getIndexHasExtraCellsCount() + 
count);
+    }
+
     private static boolean isAfterRebuildInvalidIndexRowCount(Cell cell) {
         if (Bytes.compareTo(cell.getQualifierArray(), 
cell.getQualifierOffset(), cell.getQualifierLength(),
                 AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_BYTES, 0,
@@ -397,6 +456,10 @@ public class IndexToolVerificationResult {
             
addBeforeRebuildBeyondMaxLookBackMissingIndexRowCount(getValue(cell));
         } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT_BYTES)) {
             
addBeforeRebuildBeyondMaxLookBackInvalidIndexRowCount(getValue(cell));
+        } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES)) {
+            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, 
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)) {
@@ -409,6 +472,10 @@ public class IndexToolVerificationResult {
             
addAfterRebuildBeyondMaxLookBackMissingIndexRowCount(getValue(cell));
         } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT_BYTES)) {
             
addAfterRebuildBeyondMaxLookBackInvalidIndexRowCount(getValue(cell));
+        } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES)) {
+            addAfterIndexHasExtraCellsCount(getValue(cell));
+        } else if (CellUtil.matchingColumn(cell, RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES)) {
+            addAfterIndexHasMissingCellsCount(getValue(cell));
         }
     }
 
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 cab66b2..988facc 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
@@ -96,6 +96,16 @@ public class IndexVerificationResultRepository implements 
AutoCloseable {
     public final static byte[] 
AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT_BYTES =
         
Bytes.toBytes(AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT);
 
+     public static String 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS = 
"BeforeRebuildInvalidIndexRowCountCozExtraCells";
+     public final static byte[] 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES = 
Bytes.toBytes(BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS);
+     public static String 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS = 
"BeforeRebuildInvalidIndexRowCountCozMissingCells";
+     public final static byte[] 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES = 
Bytes.toBytes(BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS);
+
+    public static String AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS 
= "AfterRebuildInvalidIndexRowCountCozExtraCells";
+    public final static byte[] 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES = 
Bytes.toBytes(AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS);
+    public static String 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS = 
"AfterRebuildInvalidIndexRowCountCozMissingCells";
+    public final static byte[] 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES = 
Bytes.toBytes(AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS);
+
     /***
      * Only usable for read / create methods. To write use setResultTable and 
setIndexTable first
      */
@@ -184,6 +194,10 @@ public class IndexVerificationResultRepository implements 
AutoCloseable {
             put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT_BYTES,
                 scanMaxTs,
                 
Bytes.toBytes(Long.toString(verificationResult.getBefore().getBeyondMaxLookBackInvalidIndexRowCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES,
+                    scanMaxTs, 
Bytes.toBytes(Long.toString(verificationResult.getBeforeIndexHasExtraCellsCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES,
+                    scanMaxTs, 
Bytes.toBytes(Long.toString(verificationResult.getBeforeIndexHasMissingCellsCount())));
         }
         if (verifyType == IndexTool.IndexVerifyType.AFTER || verifyType == 
IndexTool.IndexVerifyType.BOTH) {
             put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_VALID_INDEX_ROW_COUNT_BYTES,
@@ -200,6 +214,10 @@ public class IndexVerificationResultRepository implements 
AutoCloseable {
             put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT_BYTES,
                 scanMaxTs,
                 
Bytes.toBytes(Long.toString(verificationResult.getAfter().getBeyondMaxLookBackInvalidIndexRowCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS_BYTES,
+                    scanMaxTs, 
Bytes.toBytes(Long.toString(verificationResult.getAfterIndexHasExtraCellsCount())));
+            put.addColumn(RESULT_TABLE_COLUMN_FAMILY, 
AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS_BYTES,
+                    scanMaxTs, 
Bytes.toBytes(Long.toString(verificationResult.getAfterIndexHasMissingCellsCount())));
         }
         resultTable.put(put);
     }
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 4bbd7c8..1dbc686 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
@@ -81,6 +81,10 @@ public class PhoenixIndexImportDirectReducer extends
                         
setValue(verificationResult.getBeforeRebuildBeyondMaxLookBackMissingIndexRowCount());
                 
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT).
                         
setValue(verificationResult.getBeforeRebuildBeyondMaxLookBackInvalidIndexRowCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS).
+                        
setValue(verificationResult.getBeforeIndexHasExtraCellsCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS).
+                        
setValue(verificationResult.getBeforeIndexHasMissingCellsCount());
             }
             if (verifyType == IndexTool.IndexVerifyType.BOTH || verifyType == 
IndexTool.IndexVerifyType.AFTER) {
                 
context.getCounter(PhoenixIndexToolJobCounters.AFTER_REBUILD_VALID_INDEX_ROW_COUNT).
@@ -95,6 +99,10 @@ public class PhoenixIndexImportDirectReducer extends
                         
setValue(verificationResult.getAfterRebuildBeyondMaxLookBackMissingIndexRowCount());
                 
context.getCounter(PhoenixIndexToolJobCounters.AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT).
                         
setValue(verificationResult.getAfterRebuildBeyondMaxLookBackInvalidIndexRowCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS).
+                        
setValue(verificationResult.getAfterIndexHasExtraCellsCount());
+                
context.getCounter(PhoenixIndexToolJobCounters.AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS).
+                        
setValue(verificationResult.getAfterIndexHasMissingCellsCount());
             }
             if (verificationResult.isVerificationFailed()) {
                 throw new IOException("Index verification failed! " + 
verificationResult);
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 4baad43..a5a3fae 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
@@ -30,10 +30,14 @@ public enum PhoenixIndexToolJobCounters {
     BEFORE_REBUILD_INVALID_INDEX_ROW_COUNT,
     BEFORE_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT,
     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,
     AFTER_REBUILD_VALID_INDEX_ROW_COUNT,
     AFTER_REBUILD_EXPIRED_INDEX_ROW_COUNT,
     AFTER_REBUILD_MISSING_INDEX_ROW_COUNT,
     AFTER_REBUILD_INVALID_INDEX_ROW_COUNT,
     AFTER_REBUILD_BEYOND_MAXLOOKBACK_MISSING_INDEX_ROW_COUNT,
-    AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT;
+    AFTER_REBUILD_BEYOND_MAXLOOKBACK_INVALID_INDEX_ROW_COUNT,
+    AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_EXTRA_CELLS,
+    AFTER_REBUILD_INVALID_INDEX_ROW_COUNT_COZ_MISSING_CELLS
 }
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/index/VerifySingleIndexRowTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/index/VerifySingleIndexRowTest.java
index 868e6ad..2e45b1f 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/index/VerifySingleIndexRowTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/index/VerifySingleIndexRowTest.java
@@ -74,9 +74,9 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
     public static final String SECOND_VALUE = "SECOND_VALUE";
     public static final String
             CREATE_TABLE_DDL = "CREATE TABLE IF NOT EXISTS %s (FIRST_ID BIGINT 
NOT NULL, "
-                        + "SECOND_ID BIGINT NOT NULL, FIRST_VALUE VARCHAR(20), 
"
-                        + "SECOND_VALUE INTEGER "
-                        + "CONSTRAINT PK PRIMARY KEY(FIRST_ID, SECOND_ID)) 
COLUMN_ENCODED_BYTES=0";
+            + "SECOND_ID BIGINT NOT NULL, FIRST_VALUE VARCHAR(20), "
+            + "SECOND_VALUE INTEGER "
+            + "CONSTRAINT PK PRIMARY KEY(FIRST_ID, SECOND_ID)) 
COLUMN_ENCODED_BYTES=0";
 
     public static final String
             CREATE_INDEX_DDL = "CREATE INDEX %s ON %s (SECOND_VALUE) INCLUDE 
(FIRST_VALUE)";
@@ -97,6 +97,8 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
         VALID_NEW_UNVERIFIED_MUTATIONS,
         //extra mutations mimicking incoming mutations
         VALID_MORE_MUTATIONS,
+        // mimicking the case where the data cells expired but index has them 
still
+        VALID_EXTRA_CELL,
         EXPIRED,
         INVALID_EXTRA_CELL,
         INVALID_EMPTY_CELL,
@@ -218,7 +220,7 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
     }
 
     private void upsertCompleteRow(int key1, int key2, String val1
-    , int val2) throws SQLException, IOException {
+            , int val2) throws SQLException, IOException {
         try(Connection conn = DriverManager.getConnection(getUrl(), new 
Properties())) {
             PreparedStatement
                     ps = 
conn.prepareStatement(String.format(COMPLETE_ROW_UPSERT, dataTableFullName));
@@ -276,11 +278,11 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
                 
Matchers.<IndexToolVerificationResult.PhaseResult>any())).thenCallRealMethod();
         doNothing().when(rebuildScanner)
                 
.logToIndexToolOutputTable(Matchers.<byte[]>any(),Matchers.<byte[]>any(),
-                Mockito.anyLong(),Mockito.anyLong(), Mockito.anyString(),
+                        Mockito.anyLong(),Mockito.anyLong(), 
Mockito.anyString(),
                         Matchers.<byte[]>any(), Matchers.<byte[]>any());
         doNothing().when(rebuildScanner)
                 
.logToIndexToolOutputTable(Matchers.<byte[]>any(),Matchers.<byte[]>any(),
-                Mockito.anyLong(),Mockito.anyLong(), Mockito.anyString());
+                        Mockito.anyLong(),Mockito.anyLong(), 
Mockito.anyString());
 
         //populate the local map to use to create actual mutations
         indexKeyToMutationMapLocal = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
@@ -352,7 +354,7 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
     @Test
     public void testVerifySingleIndexRow_expiredIndexRowCount_nonZero() throws 
IOException {
         IndexToolVerificationResult.PhaseResult
-                expectedPR = new IndexToolVerificationResult.PhaseResult(0, 1, 
0, 0, 0, 0);
+                expectedPR = new IndexToolVerificationResult.PhaseResult(0, 1, 
0, 0, 0, 0,0,0);
         for (Map.Entry<byte[], List<Mutation>>
                 entry : indexKeyToMutationMapLocal.entrySet()) {
             initializeLocalMockitoSetup(entry, TestType.EXPIRED);
@@ -367,6 +369,7 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
     @Test
     public void testVerifySingleIndexRow_invalidIndexRowCount_cellValue() 
throws IOException {
         IndexToolVerificationResult.PhaseResult expectedPR = 
getInvalidPhaseResult();
+        expectedPR.setIndexHasExtraCellsCount(1);
         for (Map.Entry<byte[], List<Mutation>>
                 entry : indexKeyToMutationMapLocal.entrySet()) {
             initializeLocalMockitoSetup(entry, TestType.INVALID_CELL_VALUE);
@@ -393,6 +396,7 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
     @Test
     public void testVerifySingleIndexRow_invalidIndexRowCount_diffColumn() 
throws IOException {
         IndexToolVerificationResult.PhaseResult expectedPR = 
getInvalidPhaseResult();
+        expectedPR.setIndexHasExtraCellsCount(1);
         for (Map.Entry<byte[], List<Mutation>>
                 entry : indexKeyToMutationMapLocal.entrySet()) {
             initializeLocalMockitoSetup(entry, TestType.INVALID_COLUMN);
@@ -424,6 +428,17 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
         rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
     }
 
+    @Test
+    public void testVerifySingleIndexRow_validIndexRowCount_extraCell() throws 
IOException {
+        for (Map.Entry<byte[], List<Mutation>>
+                entry : indexKeyToMutationMapLocal.entrySet()) {
+            initializeLocalMockitoSetup(entry, TestType.VALID_EXTRA_CELL);
+            //test code
+            rebuildScanner.verifySingleIndexRow(indexRow, actualPR);
+
+            assertEquals(1, actualPR.getIndexHasExtraCellsCount());
+        }
+    }
 
     // Test the major compaction on index table only.
     // There is at least one expected mutation within maxLookBack that has its 
matching one in the actual list.
@@ -445,11 +460,11 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
 
         Put put = new Put(indexRowKey1Bytes);
         Cell cell = CellUtil.createCell(indexRowKey1Bytes,
-                                        
QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES,
-                                        QueryConstants.EMPTY_COLUMN_BYTES,
-                                        
EnvironmentEdgeManager.currentTimeMillis(),
-                                        KeyValue.Type.Put.getCode(),
-                                        IndexRegionObserver.VERIFIED_BYTES);
+                QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES,
+                QueryConstants.EMPTY_COLUMN_BYTES,
+                EnvironmentEdgeManager.currentTimeMillis(),
+                KeyValue.Type.Put.getCode(),
+                IndexRegionObserver.VERIFIED_BYTES);
         put.add(cell);
         // This mutation is beyond maxLookBack, so add it to expectedMutations 
only.
         expectedMutations.add(put);
@@ -459,11 +474,11 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
         injectEdge.incrementValue(maxLookbackInMills);
         put =  new Put(indexRowKey1Bytes);
         cell = CellUtil.createCell(indexRowKey1Bytes,
-                        QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES,
-                        QueryConstants.EMPTY_COLUMN_BYTES,
-                        EnvironmentEdgeManager.currentTimeMillis(),
-                        KeyValue.Type.Put.getCode(),
-                        IndexRegionObserver.VERIFIED_BYTES);
+                QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES,
+                QueryConstants.EMPTY_COLUMN_BYTES,
+                EnvironmentEdgeManager.currentTimeMillis(),
+                KeyValue.Type.Put.getCode(),
+                IndexRegionObserver.VERIFIED_BYTES);
         put.add(cell);
         // This mutation is in both expectedMutations and actualMutations, as 
it is within the maxLookBack, so it will not get chance to be compacted away
         expectedMutations.add(put);
@@ -480,7 +495,7 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
         // Report this validation as a success
         
assertTrue(rebuildScanner.verifySingleIndexRow(actualMutationsScanResult, 
actualPR));
         // validIndexRowCount = 1
-        IndexToolVerificationResult.PhaseResult expectedPR = new 
IndexToolVerificationResult.PhaseResult(1, 0, 0, 0, 0, 0);
+        IndexToolVerificationResult.PhaseResult expectedPR = new 
IndexToolVerificationResult.PhaseResult(1, 0, 0, 0, 0, 0, 0, 0);
         assertTrue(actualPR.equals(expectedPR));
     }
 
@@ -535,7 +550,7 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
         // Report this validation as a failure
         
assertFalse(rebuildScanner.verifySingleIndexRow(actualMutationsScanResult, 
actualPR));
         // beyondMaxLookBackInvalidIndexRowCount = 1
-        IndexToolVerificationResult.PhaseResult expectedPR = new 
IndexToolVerificationResult.PhaseResult(0, 0, 0, 0, 0, 1);
+        IndexToolVerificationResult.PhaseResult expectedPR = new 
IndexToolVerificationResult.PhaseResult(0, 0, 0, 0, 0, 1, 0, 0);
         assertTrue(actualPR.equals(expectedPR));
     }
 
@@ -549,11 +564,11 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
     }
 
     private IndexToolVerificationResult.PhaseResult getValidPhaseResult() {
-        return new IndexToolVerificationResult.PhaseResult(1, 0, 0, 0, 0, 0);
+        return new IndexToolVerificationResult.PhaseResult(1, 0, 0, 0, 0, 0, 
0, 0);
     }
 
     private IndexToolVerificationResult.PhaseResult getInvalidPhaseResult() {
-        return new IndexToolVerificationResult.PhaseResult(0, 0, 0, 1, 0, 0);
+        return new IndexToolVerificationResult.PhaseResult(0, 0, 0, 1, 0, 0, 
0, 0);
     }
 
     private void initializeLocalMockitoSetup(Map.Entry<byte[], List<Mutation>> 
entry,
@@ -605,6 +620,20 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
             newActualMutations.add(getDeleteMutation(actualMutations.get(0), 
new Long(1)));
             
newActualMutations.add(getUnverifiedPutMutation(actualMutations.get(0), new 
Long(1)));
         }
+        if(testType.equals(TestType.VALID_EXTRA_CELL)) {
+            for (Mutation m : newActualMutations) {
+                if (m instanceof Put) {
+                    List<Cell> origList = 
m.getFamilyCellMap().firstEntry().getValue();
+                    Cell newCell =
+                            CellUtil.createCell(m.getRow(), 
CellUtil.cloneFamily(origList.get(0)),
+                                    Bytes.toBytes("EXTRACOL"), 
m.getTimeStamp(), KeyValue.Type.Put.getCode(),
+                                    Bytes.toBytes("asdfg"));
+                    byte[] fam = CellUtil.cloneFamily(origList.get(0));
+                    m.getFamilyCellMap().get(fam).add(newCell);
+                    break;
+                }
+            }
+        }
         return newActualMutations;
     }
 
@@ -736,4 +765,4 @@ public class VerifySingleIndexRowTest extends 
BaseConnectionlessQueryTest {
                 CellUtil.cloneFamily(origList.get(0)), 
Bytes.toBytes(INCLUDED_COLUMN),
                 ts, type.getCode(), Bytes.toBytes("asdfg"));
     }
-}
+}
\ No newline at end of file

Reply via email to