HBASE-716 TestGet2.testGetClosestBefore fails with hadoop-0.17.1
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@672456 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
acac3a8a95
commit
1901b25365
|
@ -72,6 +72,7 @@ Hbase Change Log
|
||||||
before rather than after its parent in .META.
|
before rather than after its parent in .META.
|
||||||
HBASE-714 Showing bytes in log when should be string (2)
|
HBASE-714 Showing bytes in log when should be string (2)
|
||||||
HBASE-627 Disable table doesn't work reliably
|
HBASE-627 Disable table doesn't work reliably
|
||||||
|
HBASE-716 TestGet2.testGetClosestBefore fails with hadoop-0.17.1
|
||||||
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
|
@ -1544,7 +1544,6 @@ public class HStore implements HConstants {
|
||||||
private void rowAtOrBeforeFromMapFile(MapFile.Reader map, final byte [] row,
|
private void rowAtOrBeforeFromMapFile(MapFile.Reader map, final byte [] row,
|
||||||
SortedMap<HStoreKey, Long> candidateKeys)
|
SortedMap<HStoreKey, Long> candidateKeys)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
HStoreKey searchKey = null;
|
|
||||||
ImmutableBytesWritable readval = new ImmutableBytesWritable();
|
ImmutableBytesWritable readval = new ImmutableBytesWritable();
|
||||||
HStoreKey readkey = new HStoreKey();
|
HStoreKey readkey = new HStoreKey();
|
||||||
|
|
||||||
|
@ -1585,6 +1584,9 @@ public class HStore implements HConstants {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HStoreKey deletedOrExpiredRow = null;
|
||||||
|
boolean foundCandidate = false;
|
||||||
|
while (!foundCandidate) {
|
||||||
// seek to the exact row, or the one that would be immediately before it
|
// seek to the exact row, or the one that would be immediately before it
|
||||||
readkey = (HStoreKey)map.getClosest(searchKey, readval, true);
|
readkey = (HStoreKey)map.getClosest(searchKey, readval, true);
|
||||||
|
|
||||||
|
@ -1602,17 +1604,19 @@ public class HStore implements HConstants {
|
||||||
now < readkey.getTimestamp() + ttl) {
|
now < readkey.getTimestamp() + ttl) {
|
||||||
candidateKeys.put(stripTimestamp(readkey),
|
candidateKeys.put(stripTimestamp(readkey),
|
||||||
new Long(readkey.getTimestamp()));
|
new Long(readkey.getTimestamp()));
|
||||||
} else {
|
foundCandidate = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("rowAtOrBeforeFromMapFile:" + readkey +
|
LOG.debug("rowAtOrBeforeFromMapFile:" + readkey +
|
||||||
": expired, skipped");
|
": expired, skipped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
deletedOrExpiredRow = stripTimestamp(readkey);
|
||||||
} else if (Bytes.compareTo(readkey.getRow(), row) > 0 ) {
|
} else if (Bytes.compareTo(readkey.getRow(), row) > 0 ) {
|
||||||
// if the row key we just read is beyond the key we're searching for,
|
// if the row key we just read is beyond the key we're searching for,
|
||||||
// then we're done. return.
|
// then we're done. return.
|
||||||
return;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// so, the row key doesn't match, but we haven't gone past the row
|
// so, the row key doesn't match, but we haven't gone past the row
|
||||||
// we're seeking yet, so this row is a candidate for closest
|
// we're seeking yet, so this row is a candidate for closest
|
||||||
|
@ -1622,16 +1626,31 @@ public class HStore implements HConstants {
|
||||||
now < readkey.getTimestamp() + ttl) {
|
now < readkey.getTimestamp() + ttl) {
|
||||||
candidateKeys.put(stripTimestamp(readkey),
|
candidateKeys.put(stripTimestamp(readkey),
|
||||||
new Long(readkey.getTimestamp()));
|
new Long(readkey.getTimestamp()));
|
||||||
} else {
|
foundCandidate = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("rowAtOrBeforeFromMapFile:" + readkey +
|
LOG.debug("rowAtOrBeforeFromMapFile:" + readkey +
|
||||||
": expired, skipped");
|
": expired, skipped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
deletedOrExpiredRow = stripTimestamp(readkey);
|
||||||
}
|
}
|
||||||
} while(map.next(readkey, readval));
|
} while(map.next(readkey, readval));
|
||||||
|
|
||||||
|
// If we get here and have no candidates but we did find a deleted or
|
||||||
|
// expired candidate, we need to look at the key before that
|
||||||
|
|
||||||
|
if (!foundCandidate && deletedOrExpiredRow != null) {
|
||||||
|
searchKey = deletedOrExpiredRow;
|
||||||
|
deletedOrExpiredRow = null;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// No candidates and no deleted or expired candidates. Give up.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// arriving here just means that we consumed the whole rest of the map
|
// arriving here just means that we consumed the whole rest of the map
|
||||||
// without going "past" the key we're searching for. we can just fall
|
// without going "past" the key we're searching for. we can just fall
|
||||||
// through here.
|
// through here.
|
||||||
|
|
Loading…
Reference in New Issue