Skip to content

Commit

Permalink
use specified comparator in CollapsedRangeDelMap (#4386)
Browse files Browse the repository at this point in the history
Summary:
The Comparator passed to CollapsedRangeDelMap was not used for
operator less of the std::map `rep_` object contained in
CollapsedRangeDelMap. So the map was always sorted using the
default ByteWiseComparator, which seems wrong.

Passing the specified Comparator through for usage in that map
object fixes actual problems we were seeing with RangeDelete operations
that do not delete keys as expected when using a custom Comparator.

I found that the tests in current master crash when I run them locally,
both with and without my patch, at the very same location. I therefore
don't know if the patch breaks something else, but it seems to fix
RangeDeletion issues in our product that uses RocksDB.
Pull Request resolved: #4386

Differential Revision: D9916506

Pulled By: ajkr

fbshipit-source-id: 27bff8c775831f089dde8c5289df7343d88b2d66
  • Loading branch information
jsteemann authored and facebook-github-bot committed Sep 18, 2018
1 parent 65ac72e commit 27221b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db/range_del_aggregator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ class CollapsedRangeDelMap : public RangeDelMap {
const Comparator* ucmp_;

public:
CollapsedRangeDelMap(const Comparator* ucmp) : ucmp_(ucmp) {
CollapsedRangeDelMap(const Comparator* ucmp)
: rep_(stl_wrappers::LessOfComparator(ucmp)),
ucmp_(ucmp) {
InvalidatePosition();
}

Expand Down

0 comments on commit 27221b0

Please sign in to comment.