HBASE-9654 Optimize HStore#getRowKeyAtOrBefore() when exact match is found

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1526321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-09-25 22:22:16 +00:00
parent a21deb20f1
commit ad2d0f45b6
1 changed files with 3 additions and 1 deletions

View File

@ -1462,8 +1462,10 @@ public class HStore implements Store {
StoreFile sf = sfIterator.next();
sfIterator.remove(); // Remove sf from iterator.
boolean haveNewCandidate = rowAtOrBeforeFromStoreFile(sf, state);
KeyValue keyv = state.getCandidate();
// we have an optimization here which stops the search if we find exact match.
if (keyv != null && keyv.matchingRow(row)) return state.getCandidate();
if (haveNewCandidate) {
// TODO: we may have an optimization here which stops the search if we find exact match.
sfIterator = this.storeEngine.getStoreFileManager().updateCandidateFilesForRowKeyBefore(
sfIterator, state.getTargetKey(), state.getCandidate());
}