kadirozde commented on a change in pull request #624: PHOENIX-5564 Restructure 
read repair to improve readability and corre…
URL: https://github.com/apache/phoenix/pull/624#discussion_r346976534
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java
 ##########
 @@ -322,28 +382,27 @@ private void repairIndexRows(byte[] indexRowKey, long 
ts, List<Cell> row) throws
                 singleRowScanner.next(row);
                 singleRowScanner.close();
                 if (row.isEmpty()) {
-                    // This means that the data row did not exist, so we need 
to skip this unverified row (i.e., do not
-                    // return it to the client). Just retuning empty row is 
sufficient to do that
+                    LOG.error("Could not find the newly rebuilt index row with 
row key " +
+                            Bytes.toStringBinary(indexRowKey) + " for table " +
+                            
region.getRegionInfo().getTable().getNameAsString());
+                    // This was not expected. The new build index row must be 
deleted before opening the new scanner
+                    // possibly by compaction
                     return;
                 }
-                ts = getMaxTimestamp(row);
-            }
-            if (indexRowExists) {
-                // This means there does not exist a data row for the 
unverified index row. Skip this row. To do that
-                // just return empty row.
-                row.clear();
-                return;
-            } else {
-                // This means the index row has been deleted. We got the next 
row
-                // If the next row is "verified" (or empty) then we are good 
to go.
                 if (verifyRowAndRemoveEmptyColumn(row)) {
+                    // The index row status is "verified". This row is good to 
return to the client. We are done here.
                     return;
                 }
-                // The next row is "unverified". Rewind the scanner and let 
the row be scanned again
-                // so that it can be repaired
-                scanner = region.getScanner(indexScan);
-                row.clear();
-            }
+                ts = getMaxTimestamp(row);
+            } while (Bytes.compareTo(row.get(0).getRowArray(), 
row.get(0).getRowOffset(), row.get(0).getRowLength(),
+                    indexRowKey, 0, indexRowKey.length) == 0);
+            // This should not happen at all
+            Cell cell = row.get(0);
+            byte[] rowKey = new byte[cell.getRowLength()];
 
 Review comment:
   Done

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