diff --git a/CHANGES.txt b/CHANGES.txt index 81c74fcc3b7..8701c3165ff 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -90,6 +90,8 @@ Release 0.21.0 - Unreleased no content changes (Lars Francke via Stack) HBASE-1954 Transactional scans do not see newest put (Clint Morgan via Stack) HBASE-1919 code: HRS.delete seems to ignore exceptions it shouldnt + HBASE-1951 Stack overflow when calling HTable.checkAndPut() + when deleting a lot of values IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable diff --git a/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java b/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java index a48d9588f2c..4dd4f89b474 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java @@ -102,20 +102,25 @@ public class GetDeleteTracker implements DeleteTracker { int ret = Bytes.compareTo(buffer, qualifierOffset, qualifierLength, this.delete.buffer, this.delete.qualifierOffset, this.delete.qualifierLength); - if (ret <= -1) { - // Have not reached the next delete yet - return false; - } else if(ret >= 1) { - // Deletes an earlier column, need to move down deletes - if(this.iterator.hasNext()) { - this.delete = this.iterator.next(); - } else { - this.delete = null; + while (ret != 0) { + if (ret <= -1) { + // Have not reached the next delete yet return false; + } else if (ret >= 1) { + // Deletes an earlier column, need to move down deletes + if (this.iterator.hasNext()) { + this.delete = this.iterator.next(); + } else { + this.delete = null; + return false; + } + ret = Bytes.compareTo(buffer, qualifierOffset, qualifierLength, + this.delete.buffer, this.delete.qualifierOffset, + this.delete.qualifierLength); + } - return isDeleted(buffer, qualifierOffset, qualifierLength, timestamp); } - + // Check Timestamp if(timestamp > this.delete.timestamp) { return false; diff --git a/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java b/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java index ed29bf3adbe..91ff6dc214f 100644 --- a/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java +++ b/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java @@ -310,5 +310,20 @@ public class TestGetDeleteTracker extends HBaseTestCase implements HConstants { assertEquals(true, dt.isDeleted(col2, 0, col2Len, ts1)); } + + // HBASE-1951 + public void testStackOverflow() { + List dels = new ArrayList(); + Delete adel = new Delete(col1, 0, col1Len, del, 0L); + for(long i = 0; i < 9000; i++) { + dt.add(adel.buffer, adel.qualifierOffset, adel.qualifierLength, + i, adel.type); + } + + + //update() + dt.update(); + assertEquals(false, dt.isDeleted(col2, 0, col2Len, 7000000)); + } }