kadirozde commented on a change in pull request #741: PHOENIX-5791 Eliminate
false invalid row detection due to concurrent …
URL: https://github.com/apache/phoenix/pull/741#discussion_r398353963
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
##########
@@ -613,39 +605,132 @@ private boolean isDeleteFamilyVersion(Mutation
mutation) {
}
return getMutationsWithSameTS(put, del);
}
+ /**
+ * In this method, the actual list is repaired in memory using the
expected list which is actually the output of
+ * rebuilding the index table row. The result of this repair is used only
for verification.
+ */
+ private void repairActualMutationList(List<Mutation> actualMutationList,
List<Mutation> expectedMutationList)
+ throws IOException {
+ // Find the first (latest) actual unverified put mutation
+ for (Mutation actual : actualMutationList) {
+ if (actual instanceof Put && !isVerified((Put) actual)) {
+ long ts = getTimestamp(actual);
+ int expectedIndex;
+ int expectedListSize = expectedMutationList.size();
+ for (expectedIndex = 0; expectedIndex < expectedListSize;
expectedIndex++) {
+ if (getTimestamp(expectedMutationList.get(expectedIndex))
<= ts) {
+ if (expectedIndex > 0) {
+ expectedIndex--;
+ }
+ break;
+ }
+ }
+ if (expectedIndex == expectedListSize) {
+ continue;
+ }
+ for (; expectedIndex < expectedListSize; expectedIndex++) {
+ Mutation mutation =
expectedMutationList.get(expectedIndex);
+ if (mutation instanceof Put) {
+ mutation = new Put((Put) mutation);
+ } else {
+ mutation = new Delete((Delete) mutation);
+ }
+ actualMutationList.add(mutation);
Review comment:
This is in general a problem. I was thinking why it did not cause an issue
in my tests. The reason is that we are not actually modifying the list here
while iterating over it. We modify the list and then terminate the loop.
Therefore, it is not a problem. Regardless, I will change the code to eliminate
the confusion.
----------------------------------------------------------------
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