This is an automated email from the ASF dual-hosted git repository.
kadir pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 49dd7eb3bf PHOENIX-7574 Addendum to check loop variable increments
against the loop condition (#2127)
49dd7eb3bf is described below
commit 49dd7eb3bf140da1bbc2b9af8ef4078355744dce
Author: Kadir Ozdemir <[email protected]>
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 08302d220d..232a4a20c2 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
@@ -2391,11 +2391,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++;
}
}
}
@@ -2422,17 +2426,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) {