abhishek-chouhan commented on a change in pull request #685: PHOENIX-5676 
Inline-verification from IndexTool does not handle TTL/r…
URL: https://github.com/apache/phoenix/pull/685#discussion_r367047621
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
 ##########
 @@ -465,17 +490,32 @@ private void verifyIndexRows(ArrayList<KeyRange> keys) 
throws IOException {
                 if (dataPut == null) {
                     exceptionMessage = "Index verify failed - Missing data row 
- " + indexHTable.getName();
                     String errorMsg = "Missing data row";
-                    logToIndexToolOutputTable(null, result.getRow(), 0, 
getMaxTimestamp(result), errorMsg);
+                    logToIndexToolOutputTable(null, result.getRow(), 0, 
getMaxTimestamp(Arrays.asList(result.rawCells())), errorMsg);
                     if (!onlyVerify) {
                         throw new IOException(exceptionMessage);
                     }
                 }
                 verifySingleIndexRow(result, dataPut);
+                indexRowKeys.remove(result.getRow());
                 rowCount++;
             }
         } catch (Throwable t) {
             ServerUtil.throwIOException(indexHTable.getName().toString(), t);
         }
+        // Check if any expected rows from index(which we didn't get) are 
already expired due to TTL
+        // TODO: metrics for expired rows
+        if (!indexRowKeys.isEmpty()) {
+            Iterator<byte[]> itr = indexRowKeys.iterator();
+            long currentTime = EnvironmentEdgeManager.currentTime();
+            while(itr.hasNext()) {
+                byte[] indexKey = itr.next();
+                long ts = 
getMaxTimestampFromPut(indexKeyToDataPutMap.get(indexKey));
+                if (indexTableTTL != HConstants.FOREVER && ts < (currentTime - 
(long)indexTableTTL * 1000)) {
 
 Review comment:
   The logic was a little different from checking a cellTs directly, in the 
sense that it requires finding the max ts first amongst different cells in the 
put, just that the comparison part is common. Didn't feel very strongly about 
creating a different function for that.

----------------------------------------------------------------
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