HBASE-808,809 MAX_VERSIONS not respected, and Deletall doesn't and inserts; fix misapplication of patch

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@685458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-08-13 06:22:49 +00:00
parent 78b53558b8
commit aabc02c44b
1 changed files with 16 additions and 31 deletions

View File

@ -548,42 +548,27 @@ class Memcache {
final long now) {
ArrayList<Cell> result = new ArrayList<Cell>();
List<HStoreKey> victims = new ArrayList<HStoreKey>();
// Handle special case where only one version wanted.
if (numVersions == 1) {
byte [] value = map.get(key);
if (!isDeleted(value)) {
// Filter out expired results
if (HStore.notExpiredAndNotInDeletes(ttl, key, now, deletes)) {
result.add(new Cell(value, key.getTimestamp()));
} else {
addVictim(victims, key);
}
} else {
deletes.add(key);
}
} else {
SortedMap<HStoreKey, byte[]> tailMap = map.tailMap(key);
for (Map.Entry<HStoreKey, byte[]> es : tailMap.entrySet()) {
HStoreKey itKey = es.getKey();
if (itKey.matchesRowCol(key)) {
if (!isDeleted(es.getValue())) {
// Filter out expired results
if (HStore.notExpiredAndNotInDeletes(ttl, itKey, now, deletes)) {
result.add(new Cell(tailMap.get(itKey), itKey.getTimestamp()));
if (numVersions > 0 && result.size() >= numVersions) {
break;
}
} else {
addVictim(victims, itKey);
SortedMap<HStoreKey, byte[]> tailMap = map.tailMap(key);
for (Map.Entry<HStoreKey, byte[]> es : tailMap.entrySet()) {
HStoreKey itKey = es.getKey();
if (itKey.matchesRowCol(key)) {
if (!isDeleted(es.getValue())) {
// Filter out expired results
if (HStore.notExpiredAndNotInDeletes(ttl, itKey, now, deletes)) {
result.add(new Cell(tailMap.get(itKey), itKey.getTimestamp()));
if (numVersions > 0 && result.size() >= numVersions) {
break;
}
} else {
// Cell holds a delete value.
deletes.add(itKey);
addVictim(victims, itKey);
}
} else {
// By L.N. HBASE-684, map is sorted, so we can't find match any more.
break;
// Cell holds a delete value.
deletes.add(itKey);
}
} else {
// By L.N. HBASE-684, map is sorted, so we can't find match any more.
break;
}
}
// Remove expired victims from the map.