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