kadirozde commented on a change in pull request #672: PHOENIX-5658 IndexTool to 
verify index rows inline
URL: https://github.com/apache/phoenix/pull/672#discussion_r364168119
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
 ##########
 @@ -1189,40 +1237,168 @@ private Delete generateDeleteMarkers(List<Cell> row) {
                 checkForRegionClosing();
                 commitBatchWithRetries(region, mutations, 
blockingMemstoreSize);
                 uuidValue = ServerCacheClient.generateId();
+                if (verify) {
+                    addToBeVerifiedIndexRows();
+                }
                 mutations.clear();
             }
             return uuidValue;
         }
 
-        private boolean checkIndexRow(final byte[] indexRowKey, final Put put) 
throws IOException {
-            ValueGetter getter = new ValueGetter() {
-                final ImmutableBytesWritable valuePtr = new 
ImmutableBytesWritable();
-
-                @Override
-                public ImmutableBytesWritable getLatestValue(ColumnReference 
ref, long ts) throws IOException {
-                    List<Cell> cellList = put.get(ref.getFamily(), 
ref.getQualifier());
-                    if (cellList == null || cellList.isEmpty()) {
-                        return null;
-                    }
-                    Cell cell = cellList.get(0);
-                    valuePtr.set(cell.getValueArray(), cell.getValueOffset(), 
cell.getValueLength());
-                    return valuePtr;
+        private class SimpleValueGetter implements ValueGetter {
+            final ImmutableBytesWritable valuePtr = new 
ImmutableBytesWritable();
+            final Put put;
+            SimpleValueGetter (final Put put) {
+                this.put = put;
+            }
+            @Override
+            public ImmutableBytesWritable getLatestValue(ColumnReference ref, 
long ts) throws IOException {
+                List<Cell> cellList = put.get(ref.getFamily(), 
ref.getQualifier());
+                if (cellList == null || cellList.isEmpty()) {
+                    return null;
                 }
+                Cell cell = cellList.get(0);
+                valuePtr.set(cell.getValueArray(), cell.getValueOffset(), 
cell.getValueLength());
+                return valuePtr;
+            }
 
-                @Override
-                public byte[] getRowKey() {
-                    return put.getRow();
-                }
-            };
-            byte[] builtIndexRowKey = indexMaintainer.buildRowKey(getter, new 
ImmutableBytesWritable(put.getRow()),
+            @Override
+            public byte[] getRowKey() {
+                return put.getRow();
+            }
+
+        }
+
+        private byte[] getIndexRowKey(final Put dataRow) throws IOException {
+            ValueGetter valueGetter = new SimpleValueGetter(dataRow);
+            byte[] builtIndexRowKey = indexMaintainer.buildRowKey(valueGetter, 
new ImmutableBytesWritable(dataRow.getRow()),
                     null, null, HConstants.LATEST_TIMESTAMP);
+            return builtIndexRowKey;
+        }
+
+        private boolean checkIndexRow(final byte[] indexRowKey, final Put put) 
throws IOException {
+            byte[] builtIndexRowKey = getIndexRowKey(put);
             if (Bytes.compareTo(builtIndexRowKey, 0, builtIndexRowKey.length,
                     indexRowKey, 0, indexRowKey.length) != 0) {
                 return false;
             }
             return true;
         }
 
+        private void verifySingleIndexRow(Result indexRow, final Put dataRow) 
throws IOException {
 
 Review comment:
   No. The scrutiny tool uses Phoenix API. IndexTool uses HBase API. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to