[RocksDB] Fix binary search while finding probable wal files

Summary:
RocksDB does a binary search to look at the files which might contain the requested sequence number at the call GetUpdatesSince.
There was a bug in the binary search => when the file pointed by the middle index of bsearch was empty/corrupt it needst to resize the vector and update indexes.
This now fixes that.

Test Plan: existing unit tests pass.

Reviewers: heyongqiang, dhruba

Reviewed By: heyongqiang

CC: leveldb

Differential Revision: https://reviews.facebook.net/D9777
This commit is contained in:
Abhishek Kona 2013-03-28 13:37:15 -07:00
parent 8e9c781ae5
commit 3b51605b8d

View File

@ -934,9 +934,7 @@ Status DBImpl::FindProbableWALFiles(std::vector<LogFile>* const allLogs,
if (!s.ok()) { if (!s.ok()) {
if (CheckFileExistsAndEmpty(allLogs->at(mid))) { if (CheckFileExistsAndEmpty(allLogs->at(mid))) {
allLogs->erase(allLogs->begin() + mid); allLogs->erase(allLogs->begin() + mid);
if (mid == start) { --end;
++start;
}
continue; continue;
} }
return s; return s;