From 3b51605b8dd5d0a288663b296f2b3f1182bc38c3 Mon Sep 17 00:00:00 2001 From: Abhishek Kona Date: Thu, 28 Mar 2013 13:37:15 -0700 Subject: [PATCH] [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 --- db/db_impl.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index fe676b40d..d4ce7476c 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -934,9 +934,7 @@ Status DBImpl::FindProbableWALFiles(std::vector* const allLogs, if (!s.ok()) { if (CheckFileExistsAndEmpty(allLogs->at(mid))) { allLogs->erase(allLogs->begin() + mid); - if (mid == start) { - ++start; - } + --end; continue; } return s;