From e6e259b8abbe2b275237c4f6ebd749f71f5768dc Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Mon, 16 Jun 2014 16:26:46 -0700 Subject: [PATCH] Include max_write_buffer_number >= 2 to SanitizeOptions. Summary: Include max_write_buffer_number >= 2 to SanitizeOptions. Test Plan: make all check Reviewers: haobo, sdong, igor, ljin Reviewed By: ljin Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D19077 --- db/column_family.cc | 3 +++ include/rocksdb/options.h | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/db/column_family.cc b/db/column_family.cc index 45a3e9a82a..c4132b367c 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -92,6 +92,9 @@ ColumnFamilyOptions SanitizeOptions(const InternalKeyComparator* icmp, if (result.soft_rate_limit > result.hard_rate_limit) { result.soft_rate_limit = result.hard_rate_limit; } + if (result.max_write_buffer_number < 2) { + result.max_write_buffer_number = 2; + } if (!result.prefix_extractor) { assert(result.memtable_factory); Slice name = result.memtable_factory->Name(); diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index d8e2507217..d32e95aefd 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -184,8 +184,9 @@ struct ColumnFamilyOptions { size_t write_buffer_size; // The maximum number of write buffers that are built up in memory. - // The default is 2, so that when 1 write buffer is being flushed to - // storage, new writes can continue to the other write buffer. + // The default and the minimum number is 2, so that when 1 write buffer + // is being flushed to storage, new writes can continue to the other + // write buffer. // Default: 2 int max_write_buffer_number;