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;