kadirozde commented on a change in pull request #683: PHOENIX-5674 IndexTool to 
not write already correct index rows/CFs
URL: https://github.com/apache/phoenix/pull/683#discussion_r366699764
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/IndexRebuildRegionScanner.java
 ##########
 @@ -521,55 +625,58 @@ public boolean next(List<Cell> results) throws 
IOException {
                             if (KeyValue.Type.codeToType(cell.getTypeByte()) 
== KeyValue.Type.Put) {
                                 if (put == null) {
                                     put = new Put(CellUtil.cloneRow(cell));
-                                    setMutationAttributes(put, uuidValue);
                                     mutations.add(put);
                                 }
                                 put.add(cell);
                             } else {
                                 if (del == null) {
                                     del = new Delete(CellUtil.cloneRow(cell));
-                                    setMutationAttributes(del, uuidValue);
                                     mutations.add(del);
                                 }
                                 del.addDeleteMarker(cell);
                             }
                         }
-                        if (onlyVerify) {
-                            rowCount++;
-                            continue;
+                        if (scan.isRaw()) {
+                            if (put != null) {
+                                setMutationAttributes(put, uuidValue);
+                            }
+                            if (del != null) {
+                                setMutationAttributes(del, uuidValue);
+                            }
+                            uuidValue = commitIfReady(uuidValue, mutations);
                         }
-                        uuidValue = commitIfReady(uuidValue);
-                        if (!scan.isRaw()) {
-                            Delete deleteMarkers = generateDeleteMarkers(row);
+                        if (indexRowKey != null) {
+                            if (put != null) {
+                                setMutationAttributes(put, uuidValue);
+                            }
+                            Delete deleteMarkers = generateDeleteMarkers(put);
                             if (deleteMarkers != null) {
                                 setMutationAttributes(deleteMarkers, 
uuidValue);
                                 mutations.add(deleteMarkers);
-                                uuidValue = commitIfReady(uuidValue);
+                                uuidValue = commitIfReady(uuidValue, 
mutations);
                             }
-                        }
-                        if (indexRowKey != null) {
                             // GlobalIndexChecker passed the index row key. 
This is to build a single index row.
                             // Check if the data table row we have just 
scanned matches with the index row key.
                             // If not, there is no need to build the index row 
from this data table row,
                             // and just return zero row count.
                             if (checkIndexRow(indexRowKey, put)) {
                                 rowCount = 
GlobalIndexChecker.RebuildReturnCode.INDEX_ROW_EXISTS.getValue();
-                            }
-                            else {
+                            } else {
                                 rowCount = 
GlobalIndexChecker.RebuildReturnCode.NO_INDEX_ROW.getValue();
                             }
                             break;
                         }
                         rowCount++;
                     }
-
                 } while (hasMore && rowCount < pageSizeInRows);
-                if (!mutations.isEmpty() && !onlyVerify) {
+            }
+            if (!scan.isRaw() && indexRowKey == null) {
 
 Review comment:
   I will add comments for it.

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


With regards,
Apache Git Services

Reply via email to