kadirozde commented on a change in pull request #915:
URL: https://github.com/apache/phoenix/pull/915#discussion_r504916360



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GlobalIndexRegionScanner.java
##########
@@ -240,4 +320,1033 @@ protected boolean isColumnIncluded(Cell cell) {
         byte[] qualifier = CellUtil.cloneQualifier(cell);
         return set.contains(qualifier);
     }
+    @VisibleForTesting
+    public boolean shouldVerify(IndexTool.IndexVerifyType verifyType,
+                                byte[] indexRowKey, Scan scan, Region region, 
IndexMaintainer indexMaintainer,
+                                IndexVerificationResultRepository 
verificationResultRepository, boolean shouldVerifyCheckDone) throws IOException 
{
+        this.verifyType = verifyType;
+        this.indexRowKeyforReadRepair = indexRowKey;
+        this.scan = scan;
+        this.region = region;
+        this.indexMaintainer = indexMaintainer;
+        this.verificationResultRepository = verificationResultRepository;
+        this.shouldVerifyCheckDone = shouldVerifyCheckDone;
+        return shouldVerify();
+    }
+
+    protected boolean shouldVerify() throws IOException {
+        // In case of read repair, proceed with rebuild
+        // All other types of rebuilds/verification should be incrementally 
performed if appropriate param is passed
+        byte[] lastVerifyTimeValue = 
scan.getAttribute(UngroupedAggregateRegionObserver.INDEX_RETRY_VERIFY);
+        Long lastVerifyTime = lastVerifyTimeValue == null ? 0 : 
Bytes.toLong(lastVerifyTimeValue);
+        if(indexRowKeyforReadRepair != null || lastVerifyTime == 0 || 
shouldVerifyCheckDone) {

Review comment:
       lastVerifyTime is not a global variable. We can improve this method by 
checking shouldVerifyCheckDone at the entry of this method.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to