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

 ##########
 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:
   This can be replaced with the function call to "isCellExpired" defined at 
line 530

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