HBASE-1951 Stack overflow when calling HTable.checkAndPut()

when deleting a lot of values


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@832640 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2009-11-04 01:26:02 +00:00
parent 99e725c7ff
commit 88c5a74d7c
3 changed files with 33 additions and 11 deletions

View File

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

View File

@ -102,18 +102,23 @@ 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

View File

@ -311,4 +311,19 @@ public class TestGetDeleteTracker extends HBaseTestCase implements HConstants {
assertEquals(true, dt.isDeleted(col2, 0, col2Len, ts1));
}
// HBASE-1951
public void testStackOverflow() {
List<Delete> dels = new ArrayList<Delete>();
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));
}
}