From 27221b0cc29466923bc060122e861a862b3e51ab Mon Sep 17 00:00:00 2001 From: jsteemann Date: Tue, 18 Sep 2018 09:17:32 -0700 Subject: [PATCH] use specified comparator in CollapsedRangeDelMap (#4386) 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: https://github.com/facebook/rocksdb/pull/4386 Differential Revision: D9916506 Pulled By: ajkr fbshipit-source-id: 27bff8c775831f089dde8c5289df7343d88b2d66 --- db/range_del_aggregator.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/range_del_aggregator.cc b/db/range_del_aggregator.cc index 09e642bc9..e343cf611 100644 --- a/db/range_del_aggregator.cc +++ b/db/range_del_aggregator.cc @@ -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(); }