From eba99c28e40337cf4cd04d139dd1f7617c9c1863 Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Tue, 15 Nov 2016 13:38:24 -0800 Subject: [PATCH] Fix min_write_buffer_number_to_merge = 0 bug Summary: It's possible that we set min_write_buffer_number_to_merge to 0. This should never happen Closes https://github.com/facebook/rocksdb/pull/1515 Differential Revision: D4183356 Pulled By: yiwu-arbug fbshipit-source-id: c9d39d7 --- db/column_family.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/column_family.cc b/db/column_family.cc index ee69e05ba..bbdc3027d 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -158,6 +158,10 @@ ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options, result.min_write_buffer_number_to_merge = std::min(result.min_write_buffer_number_to_merge, result.max_write_buffer_number - 1); + if (result.min_write_buffer_number_to_merge < 1) { + result.min_write_buffer_number_to_merge = 1; + } + if (result.num_levels < 1) { result.num_levels = 1; }