This is an automated email from the ASF dual-hosted git repository.

kadir pushed a commit to branch 5.2
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.2 by this push:
     new 2581df13be PHOENIX-7574 Addendum to check loop variable increments 
against the loop condition (#2127)
2581df13be is described below

commit 2581df13be23b12a4e051d9081e3d8ca8db66d06
Author: Kadir Ozdemir <37155482+kadiro...@users.noreply.github.com>
AuthorDate: Thu Apr 24 12:41:20 2025 -0700

    PHOENIX-7574 Addendum to check loop variable increments against the loop 
condition (#2127)
---
 .../phoenix/coprocessor/CompactionScanner.java     | 40 ++++++++++++++--------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git 
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/CompactionScanner.java
 
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/CompactionScanner.java
index 1768197f97..c084b9907b 100644
--- 
a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/CompactionScanner.java
+++ 
b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/CompactionScanner.java
@@ -854,11 +854,15 @@ public class CompactionScanner implements InternalScanner 
{
                                     retainedCells.add(cell);
                                 }
                             }
-                            cell = result.get(index + 1);
-                            if (!CellUtil.matchingColumn(cell, 
currentColumnCell)) {
-                                continue top;
+                            if (index + 1 < result.size()) {
+                                cell = result.get(index + 1);
+                                if (!CellUtil.matchingColumn(cell, 
currentColumnCell)) {
+                                    continue top;
+                                }
+                                index++;
+                            } else {
+                                break top;
                             }
-                            index++;
                         }
                     }
                 }
@@ -885,17 +889,25 @@ public class CompactionScanner implements InternalScanner 
{
                     } else if (!major) {
                         retainedCells.add(cell);
                     }
-                    Cell nextCell = result.get(index + 1);
-                    if (!CellUtil.matchingColumn(currentColumnCell, nextCell)) 
{
-                        continue top;
-                    }
-                    // Increment index by one as the delete cell should be 
consumed
-                    index++;
-                    if (nextCell.getType() == Cell.Type.Put
-                            && cell.getTimestamp() == nextCell.getTimestamp()) 
{
-                        // This put cell is masked by the delete marker
+                    if (index + 1 < result.size()) {
+                        Cell nextCell = result.get(index + 1);
+                        if (!CellUtil.matchingColumn(currentColumnCell, 
nextCell)) {
+                            continue top;
+                        }
+                        // Increment index by one as the delete cell should be 
consumed
                         index++;
-                        cell = result.get(index);
+                        if (nextCell.getType() == Cell.Type.Put
+                                && cell.getTimestamp() == 
nextCell.getTimestamp()) {
+                            // This put cell is masked by the delete marker
+                            index++;
+                            if (index < result.size()) {
+                                cell = result.get(index);
+                            } else {
+                                break top;
+                            }
+                        }
+                    } else {
+                        break top;
                     }
                 }
                 if (cell.getType() == Cell.Type.DeleteColumn) {

Reply via email to