ColumnFamilyOptions SanitizeOptions is buggy on 32-bit platforms.

Summary:
The pre-existing code is trying to clamp between 65,536 and 0,
resulting in clamping to 65,536, resulting in very small buffers,
resulting in ShouldFlushNow() being true quite easily,
resulting in assertion failing and database performance
being "not what it should be".

https://github.com/facebook/rocksdb/issues/1018

Test Plan: make check

Reviewers: sdong, andrewkr, IslamAbdelRahman, yhchiang, igor

Reviewed By: igor

Subscribers: leveldb, andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D55455
main
Dhruba Borthakur 9 years ago
parent e778c34e78
commit 1a2cc27e01
  1. 11
      db/column_family.cc

@ -147,13 +147,10 @@ ColumnFamilyOptions SanitizeOptions(const DBOptions& db_options,
const ColumnFamilyOptions& src) { const ColumnFamilyOptions& src) {
ColumnFamilyOptions result = src; ColumnFamilyOptions result = src;
result.comparator = icmp; result.comparator = icmp;
#ifdef OS_MACOSX size_t clamp_max = std::conditional<
// TODO(icanadi) make write_buffer_size uint64_t instead of size_t sizeof(size_t) == 4, std::integral_constant<size_t, 0xffffffff>,
ClipToRange(&result.write_buffer_size, ((size_t)64) << 10, ((size_t)1) << 30); std::integral_constant<size_t, 64ull << 30>>::type::value;
#else ClipToRange(&result.write_buffer_size, ((size_t)64) << 10, clamp_max);
ClipToRange(&result.write_buffer_size,
((size_t)64) << 10, ((size_t)64) << 30);
#endif
// if user sets arena_block_size, we trust user to use this value. Otherwise, // if user sets arena_block_size, we trust user to use this value. Otherwise,
// calculate a proper value from writer_buffer_size; // calculate a proper value from writer_buffer_size;
if (result.arena_block_size <= 0) { if (result.arena_block_size <= 0) {

Loading…
Cancel
Save