options_settable_test.cc 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. //
  6. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  7. // Use of this source code is governed by a BSD-style license that can be
  8. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  9. #include <cstring>
  10. #include "options/options_helper.h"
  11. #include "rocksdb/convenience.h"
  12. #include "test_util/testharness.h"
  13. #ifndef GFLAGS
  14. bool FLAGS_enable_print = false;
  15. #else
  16. #include "util/gflags_compat.h"
  17. using GFLAGS_NAMESPACE::ParseCommandLineFlags;
  18. DEFINE_bool(enable_print, false, "Print options generated to console.");
  19. #endif // GFLAGS
  20. namespace ROCKSDB_NAMESPACE {
  21. // Verify options are settable from options strings.
  22. // We take the approach that depends on compiler behavior that copy constructor
  23. // won't touch implicit padding bytes, so that the test is fragile.
  24. // As a result, we only run the tests to verify new fields in options are
  25. // settable through string on limited platforms as it depends on behavior of
  26. // compilers.
  27. #ifndef ROCKSDB_LITE
  28. #if defined OS_LINUX || defined OS_WIN
  29. #ifndef __clang__
  30. class OptionsSettableTest : public testing::Test {
  31. public:
  32. OptionsSettableTest() {}
  33. };
  34. const char kSpecialChar = 'z';
  35. typedef std::vector<std::pair<size_t, size_t>> OffsetGap;
  36. void FillWithSpecialChar(char* start_ptr, size_t total_size,
  37. const OffsetGap& blacklist) {
  38. size_t offset = 0;
  39. for (auto& pair : blacklist) {
  40. std::memset(start_ptr + offset, kSpecialChar, pair.first - offset);
  41. offset = pair.first + pair.second;
  42. }
  43. std::memset(start_ptr + offset, kSpecialChar, total_size - offset);
  44. }
  45. int NumUnsetBytes(char* start_ptr, size_t total_size,
  46. const OffsetGap& blacklist) {
  47. int total_unset_bytes_base = 0;
  48. size_t offset = 0;
  49. for (auto& pair : blacklist) {
  50. for (char* ptr = start_ptr + offset; ptr < start_ptr + pair.first; ptr++) {
  51. if (*ptr == kSpecialChar) {
  52. total_unset_bytes_base++;
  53. }
  54. }
  55. offset = pair.first + pair.second;
  56. }
  57. for (char* ptr = start_ptr + offset; ptr < start_ptr + total_size; ptr++) {
  58. if (*ptr == kSpecialChar) {
  59. total_unset_bytes_base++;
  60. }
  61. }
  62. return total_unset_bytes_base;
  63. }
  64. // If the test fails, likely a new option is added to BlockBasedTableOptions
  65. // but it cannot be set through GetBlockBasedTableOptionsFromString(), or the
  66. // test is not updated accordingly.
  67. // After adding an option, we need to make sure it is settable by
  68. // GetBlockBasedTableOptionsFromString() and add the option to the input string
  69. // passed to the GetBlockBasedTableOptionsFromString() in this test.
  70. // If it is a complicated type, you also need to add the field to
  71. // kBbtoBlacklist, and maybe add customized verification for it.
  72. TEST_F(OptionsSettableTest, BlockBasedTableOptionsAllFieldsSettable) {
  73. // Items in the form of <offset, size>. Need to be in ascending order
  74. // and not overlapping. Need to updated if new pointer-option is added.
  75. const OffsetGap kBbtoBlacklist = {
  76. {offsetof(struct BlockBasedTableOptions, flush_block_policy_factory),
  77. sizeof(std::shared_ptr<FlushBlockPolicyFactory>)},
  78. {offsetof(struct BlockBasedTableOptions, block_cache),
  79. sizeof(std::shared_ptr<Cache>)},
  80. {offsetof(struct BlockBasedTableOptions, persistent_cache),
  81. sizeof(std::shared_ptr<PersistentCache>)},
  82. {offsetof(struct BlockBasedTableOptions, block_cache_compressed),
  83. sizeof(std::shared_ptr<Cache>)},
  84. {offsetof(struct BlockBasedTableOptions, filter_policy),
  85. sizeof(std::shared_ptr<const FilterPolicy>)},
  86. };
  87. // In this test, we catch a new option of BlockBasedTableOptions that is not
  88. // settable through GetBlockBasedTableOptionsFromString().
  89. // We count padding bytes of the option struct, and assert it to be the same
  90. // as unset bytes of an option struct initialized by
  91. // GetBlockBasedTableOptionsFromString().
  92. char* bbto_ptr = new char[sizeof(BlockBasedTableOptions)];
  93. // Count padding bytes by setting all bytes in the memory to a special char,
  94. // copy a well constructed struct to this memory and see how many special
  95. // bytes left.
  96. BlockBasedTableOptions* bbto = new (bbto_ptr) BlockBasedTableOptions();
  97. FillWithSpecialChar(bbto_ptr, sizeof(BlockBasedTableOptions), kBbtoBlacklist);
  98. // It based on the behavior of compiler that padding bytes are not changed
  99. // when copying the struct. It's prone to failure when compiler behavior
  100. // changes. We verify there is unset bytes to detect the case.
  101. *bbto = BlockBasedTableOptions();
  102. int unset_bytes_base =
  103. NumUnsetBytes(bbto_ptr, sizeof(BlockBasedTableOptions), kBbtoBlacklist);
  104. ASSERT_GT(unset_bytes_base, 0);
  105. bbto->~BlockBasedTableOptions();
  106. // Construct the base option passed into
  107. // GetBlockBasedTableOptionsFromString().
  108. bbto = new (bbto_ptr) BlockBasedTableOptions();
  109. FillWithSpecialChar(bbto_ptr, sizeof(BlockBasedTableOptions), kBbtoBlacklist);
  110. // This option is not setable:
  111. bbto->use_delta_encoding = true;
  112. char* new_bbto_ptr = new char[sizeof(BlockBasedTableOptions)];
  113. BlockBasedTableOptions* new_bbto =
  114. new (new_bbto_ptr) BlockBasedTableOptions();
  115. FillWithSpecialChar(new_bbto_ptr, sizeof(BlockBasedTableOptions),
  116. kBbtoBlacklist);
  117. // Need to update the option string if a new option is added.
  118. ASSERT_OK(GetBlockBasedTableOptionsFromString(
  119. *bbto,
  120. "cache_index_and_filter_blocks=1;"
  121. "cache_index_and_filter_blocks_with_high_priority=true;"
  122. "pin_l0_filter_and_index_blocks_in_cache=1;"
  123. "pin_top_level_index_and_filter=1;"
  124. "index_type=kHashSearch;"
  125. "data_block_index_type=kDataBlockBinaryAndHash;"
  126. "index_shortening=kNoShortening;"
  127. "data_block_hash_table_util_ratio=0.75;"
  128. "checksum=kxxHash;hash_index_allow_collision=1;no_block_cache=1;"
  129. "block_cache=1M;block_cache_compressed=1k;block_size=1024;"
  130. "block_size_deviation=8;block_restart_interval=4; "
  131. "metadata_block_size=1024;"
  132. "partition_filters=false;"
  133. "index_block_restart_interval=4;"
  134. "filter_policy=bloomfilter:4:true;whole_key_filtering=1;"
  135. "format_version=1;"
  136. "hash_index_allow_collision=false;"
  137. "verify_compression=true;read_amp_bytes_per_bit=0;"
  138. "enable_index_compression=false;"
  139. "block_align=true",
  140. new_bbto));
  141. ASSERT_EQ(unset_bytes_base,
  142. NumUnsetBytes(new_bbto_ptr, sizeof(BlockBasedTableOptions),
  143. kBbtoBlacklist));
  144. ASSERT_TRUE(new_bbto->block_cache.get() != nullptr);
  145. ASSERT_TRUE(new_bbto->block_cache_compressed.get() != nullptr);
  146. ASSERT_TRUE(new_bbto->filter_policy.get() != nullptr);
  147. bbto->~BlockBasedTableOptions();
  148. new_bbto->~BlockBasedTableOptions();
  149. delete[] bbto_ptr;
  150. delete[] new_bbto_ptr;
  151. }
  152. // If the test fails, likely a new option is added to DBOptions
  153. // but it cannot be set through GetDBOptionsFromString(), or the test is not
  154. // updated accordingly.
  155. // After adding an option, we need to make sure it is settable by
  156. // GetDBOptionsFromString() and add the option to the input string passed to
  157. // DBOptionsFromString()in this test.
  158. // If it is a complicated type, you also need to add the field to
  159. // kDBOptionsBlacklist, and maybe add customized verification for it.
  160. TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
  161. const OffsetGap kDBOptionsBlacklist = {
  162. {offsetof(struct DBOptions, env), sizeof(Env*)},
  163. {offsetof(struct DBOptions, file_system),
  164. sizeof(std::shared_ptr<FileSystem>)},
  165. {offsetof(struct DBOptions, rate_limiter),
  166. sizeof(std::shared_ptr<RateLimiter>)},
  167. {offsetof(struct DBOptions, sst_file_manager),
  168. sizeof(std::shared_ptr<SstFileManager>)},
  169. {offsetof(struct DBOptions, info_log), sizeof(std::shared_ptr<Logger>)},
  170. {offsetof(struct DBOptions, statistics),
  171. sizeof(std::shared_ptr<Statistics>)},
  172. {offsetof(struct DBOptions, db_paths), sizeof(std::vector<DbPath>)},
  173. {offsetof(struct DBOptions, db_log_dir), sizeof(std::string)},
  174. {offsetof(struct DBOptions, wal_dir), sizeof(std::string)},
  175. {offsetof(struct DBOptions, write_buffer_manager),
  176. sizeof(std::shared_ptr<WriteBufferManager>)},
  177. {offsetof(struct DBOptions, listeners),
  178. sizeof(std::vector<std::shared_ptr<EventListener>>)},
  179. {offsetof(struct DBOptions, row_cache), sizeof(std::shared_ptr<Cache>)},
  180. {offsetof(struct DBOptions, wal_filter), sizeof(const WalFilter*)},
  181. {offsetof(struct DBOptions, sst_file_checksum_func),
  182. sizeof(std::shared_ptr<FileChecksumFunc>)},
  183. };
  184. char* options_ptr = new char[sizeof(DBOptions)];
  185. // Count padding bytes by setting all bytes in the memory to a special char,
  186. // copy a well constructed struct to this memory and see how many special
  187. // bytes left.
  188. DBOptions* options = new (options_ptr) DBOptions();
  189. FillWithSpecialChar(options_ptr, sizeof(DBOptions), kDBOptionsBlacklist);
  190. // It based on the behavior of compiler that padding bytes are not changed
  191. // when copying the struct. It's prone to failure when compiler behavior
  192. // changes. We verify there is unset bytes to detect the case.
  193. *options = DBOptions();
  194. int unset_bytes_base =
  195. NumUnsetBytes(options_ptr, sizeof(DBOptions), kDBOptionsBlacklist);
  196. ASSERT_GT(unset_bytes_base, 0);
  197. options->~DBOptions();
  198. options = new (options_ptr) DBOptions();
  199. FillWithSpecialChar(options_ptr, sizeof(DBOptions), kDBOptionsBlacklist);
  200. char* new_options_ptr = new char[sizeof(DBOptions)];
  201. DBOptions* new_options = new (new_options_ptr) DBOptions();
  202. FillWithSpecialChar(new_options_ptr, sizeof(DBOptions), kDBOptionsBlacklist);
  203. // Need to update the option string if a new option is added.
  204. ASSERT_OK(
  205. GetDBOptionsFromString(*options,
  206. "wal_bytes_per_sync=4295048118;"
  207. "delete_obsolete_files_period_micros=4294967758;"
  208. "WAL_ttl_seconds=4295008036;"
  209. "WAL_size_limit_MB=4295036161;"
  210. "max_write_batch_group_size_bytes=1048576;"
  211. "wal_dir=path/to/wal_dir;"
  212. "db_write_buffer_size=2587;"
  213. "max_subcompactions=64330;"
  214. "table_cache_numshardbits=28;"
  215. "max_open_files=72;"
  216. "max_file_opening_threads=35;"
  217. "max_background_jobs=8;"
  218. "base_background_compactions=3;"
  219. "max_background_compactions=33;"
  220. "use_fsync=true;"
  221. "use_adaptive_mutex=false;"
  222. "max_total_wal_size=4295005604;"
  223. "compaction_readahead_size=0;"
  224. "new_table_reader_for_compaction_inputs=false;"
  225. "keep_log_file_num=4890;"
  226. "skip_stats_update_on_db_open=false;"
  227. "skip_checking_sst_file_sizes_on_db_open=false;"
  228. "max_manifest_file_size=4295009941;"
  229. "db_log_dir=path/to/db_log_dir;"
  230. "skip_log_error_on_recovery=true;"
  231. "writable_file_max_buffer_size=1048576;"
  232. "paranoid_checks=true;"
  233. "is_fd_close_on_exec=false;"
  234. "bytes_per_sync=4295013613;"
  235. "strict_bytes_per_sync=true;"
  236. "enable_thread_tracking=false;"
  237. "recycle_log_file_num=0;"
  238. "create_missing_column_families=true;"
  239. "log_file_time_to_roll=3097;"
  240. "max_background_flushes=35;"
  241. "create_if_missing=false;"
  242. "error_if_exists=true;"
  243. "delayed_write_rate=4294976214;"
  244. "manifest_preallocation_size=1222;"
  245. "allow_mmap_writes=false;"
  246. "stats_dump_period_sec=70127;"
  247. "stats_persist_period_sec=54321;"
  248. "persist_stats_to_disk=true;"
  249. "stats_history_buffer_size=14159;"
  250. "allow_fallocate=true;"
  251. "allow_mmap_reads=false;"
  252. "use_direct_reads=false;"
  253. "use_direct_io_for_flush_and_compaction=false;"
  254. "max_log_file_size=4607;"
  255. "random_access_max_buffer_size=1048576;"
  256. "advise_random_on_open=true;"
  257. "fail_if_options_file_error=false;"
  258. "enable_pipelined_write=false;"
  259. "unordered_write=false;"
  260. "allow_concurrent_memtable_write=true;"
  261. "wal_recovery_mode=kPointInTimeRecovery;"
  262. "enable_write_thread_adaptive_yield=true;"
  263. "write_thread_slow_yield_usec=5;"
  264. "write_thread_max_yield_usec=1000;"
  265. "access_hint_on_compaction_start=NONE;"
  266. "info_log_level=DEBUG_LEVEL;"
  267. "dump_malloc_stats=false;"
  268. "allow_2pc=false;"
  269. "avoid_flush_during_recovery=false;"
  270. "avoid_flush_during_shutdown=false;"
  271. "allow_ingest_behind=false;"
  272. "preserve_deletes=false;"
  273. "concurrent_prepare=false;"
  274. "two_write_queues=false;"
  275. "manual_wal_flush=false;"
  276. "seq_per_batch=false;"
  277. "atomic_flush=false;"
  278. "avoid_unnecessary_blocking_io=false;"
  279. "log_readahead_size=0;"
  280. "write_dbid_to_manifest=false",
  281. new_options));
  282. ASSERT_EQ(unset_bytes_base, NumUnsetBytes(new_options_ptr, sizeof(DBOptions),
  283. kDBOptionsBlacklist));
  284. options->~DBOptions();
  285. new_options->~DBOptions();
  286. delete[] options_ptr;
  287. delete[] new_options_ptr;
  288. }
  289. template <typename T1, typename T2>
  290. inline int offset_of(T1 T2::*member) {
  291. static T2 obj;
  292. return int(size_t(&(obj.*member)) - size_t(&obj));
  293. }
  294. // If the test fails, likely a new option is added to ColumnFamilyOptions
  295. // but it cannot be set through GetColumnFamilyOptionsFromString(), or the
  296. // test is not updated accordingly.
  297. // After adding an option, we need to make sure it is settable by
  298. // GetColumnFamilyOptionsFromString() and add the option to the input
  299. // string passed to GetColumnFamilyOptionsFromString()in this test.
  300. // If it is a complicated type, you also need to add the field to
  301. // kColumnFamilyOptionsBlacklist, and maybe add customized verification
  302. // for it.
  303. TEST_F(OptionsSettableTest, ColumnFamilyOptionsAllFieldsSettable) {
  304. // options in the blacklist need to appear in the same order as in
  305. // ColumnFamilyOptions.
  306. const OffsetGap kColumnFamilyOptionsBlacklist = {
  307. {offset_of(&ColumnFamilyOptions::inplace_callback),
  308. sizeof(UpdateStatus(*)(char*, uint32_t*, Slice, std::string*))},
  309. {offset_of(
  310. &ColumnFamilyOptions::memtable_insert_with_hint_prefix_extractor),
  311. sizeof(std::shared_ptr<const SliceTransform>)},
  312. {offset_of(&ColumnFamilyOptions::compression_per_level),
  313. sizeof(std::vector<CompressionType>)},
  314. {offset_of(
  315. &ColumnFamilyOptions::max_bytes_for_level_multiplier_additional),
  316. sizeof(std::vector<int>)},
  317. {offset_of(&ColumnFamilyOptions::memtable_factory),
  318. sizeof(std::shared_ptr<MemTableRepFactory>)},
  319. {offset_of(&ColumnFamilyOptions::table_properties_collector_factories),
  320. sizeof(ColumnFamilyOptions::TablePropertiesCollectorFactories)},
  321. {offset_of(&ColumnFamilyOptions::comparator), sizeof(Comparator*)},
  322. {offset_of(&ColumnFamilyOptions::merge_operator),
  323. sizeof(std::shared_ptr<MergeOperator>)},
  324. {offset_of(&ColumnFamilyOptions::compaction_filter),
  325. sizeof(const CompactionFilter*)},
  326. {offset_of(&ColumnFamilyOptions::compaction_filter_factory),
  327. sizeof(std::shared_ptr<CompactionFilterFactory>)},
  328. {offset_of(&ColumnFamilyOptions::prefix_extractor),
  329. sizeof(std::shared_ptr<const SliceTransform>)},
  330. {offset_of(&ColumnFamilyOptions::snap_refresh_nanos), sizeof(uint64_t)},
  331. {offset_of(&ColumnFamilyOptions::table_factory),
  332. sizeof(std::shared_ptr<TableFactory>)},
  333. {offset_of(&ColumnFamilyOptions::cf_paths), sizeof(std::vector<DbPath>)},
  334. {offset_of(&ColumnFamilyOptions::compaction_thread_limiter),
  335. sizeof(std::shared_ptr<ConcurrentTaskLimiter>)},
  336. };
  337. char* options_ptr = new char[sizeof(ColumnFamilyOptions)];
  338. // Count padding bytes by setting all bytes in the memory to a special char,
  339. // copy a well constructed struct to this memory and see how many special
  340. // bytes left.
  341. ColumnFamilyOptions* options = new (options_ptr) ColumnFamilyOptions();
  342. FillWithSpecialChar(options_ptr, sizeof(ColumnFamilyOptions),
  343. kColumnFamilyOptionsBlacklist);
  344. // It based on the behavior of compiler that padding bytes are not changed
  345. // when copying the struct. It's prone to failure when compiler behavior
  346. // changes. We verify there is unset bytes to detect the case.
  347. *options = ColumnFamilyOptions();
  348. // Deprecatd option which is not initialized. Need to set it to avoid
  349. // Valgrind error
  350. options->max_mem_compaction_level = 0;
  351. int unset_bytes_base = NumUnsetBytes(options_ptr, sizeof(ColumnFamilyOptions),
  352. kColumnFamilyOptionsBlacklist);
  353. ASSERT_GT(unset_bytes_base, 0);
  354. options->~ColumnFamilyOptions();
  355. options = new (options_ptr) ColumnFamilyOptions();
  356. FillWithSpecialChar(options_ptr, sizeof(ColumnFamilyOptions),
  357. kColumnFamilyOptionsBlacklist);
  358. // Following options are not settable through
  359. // GetColumnFamilyOptionsFromString():
  360. options->rate_limit_delay_max_milliseconds = 33;
  361. options->compaction_options_universal = CompactionOptionsUniversal();
  362. options->compression_opts = CompressionOptions();
  363. options->bottommost_compression_opts = CompressionOptions();
  364. options->hard_rate_limit = 0;
  365. options->soft_rate_limit = 0;
  366. options->purge_redundant_kvs_while_flush = false;
  367. options->max_mem_compaction_level = 0;
  368. options->compaction_filter = nullptr;
  369. char* new_options_ptr = new char[sizeof(ColumnFamilyOptions)];
  370. ColumnFamilyOptions* new_options =
  371. new (new_options_ptr) ColumnFamilyOptions();
  372. FillWithSpecialChar(new_options_ptr, sizeof(ColumnFamilyOptions),
  373. kColumnFamilyOptionsBlacklist);
  374. // Need to update the option string if a new option is added.
  375. ASSERT_OK(GetColumnFamilyOptionsFromString(
  376. *options,
  377. "compaction_filter_factory=mpudlojcujCompactionFilterFactory;"
  378. "table_factory=PlainTable;"
  379. "prefix_extractor=rocksdb.CappedPrefix.13;"
  380. "comparator=leveldb.BytewiseComparator;"
  381. "compression_per_level=kBZip2Compression:kBZip2Compression:"
  382. "kBZip2Compression:kNoCompression:kZlibCompression:kBZip2Compression:"
  383. "kSnappyCompression;"
  384. "max_bytes_for_level_base=986;"
  385. "bloom_locality=8016;"
  386. "target_file_size_base=4294976376;"
  387. "memtable_huge_page_size=2557;"
  388. "max_successive_merges=5497;"
  389. "max_sequential_skip_in_iterations=4294971408;"
  390. "arena_block_size=1893;"
  391. "target_file_size_multiplier=35;"
  392. "min_write_buffer_number_to_merge=9;"
  393. "max_write_buffer_number=84;"
  394. "write_buffer_size=1653;"
  395. "max_compaction_bytes=64;"
  396. "max_bytes_for_level_multiplier=60;"
  397. "memtable_factory=SkipListFactory;"
  398. "compression=kNoCompression;"
  399. "bottommost_compression=kDisableCompressionOption;"
  400. "level0_stop_writes_trigger=33;"
  401. "num_levels=99;"
  402. "level0_slowdown_writes_trigger=22;"
  403. "level0_file_num_compaction_trigger=14;"
  404. "compaction_filter=urxcqstuwnCompactionFilter;"
  405. "soft_rate_limit=530.615385;"
  406. "soft_pending_compaction_bytes_limit=0;"
  407. "max_write_buffer_number_to_maintain=84;"
  408. "max_write_buffer_size_to_maintain=2147483648;"
  409. "merge_operator=aabcxehazrMergeOperator;"
  410. "memtable_prefix_bloom_size_ratio=0.4642;"
  411. "memtable_whole_key_filtering=true;"
  412. "memtable_insert_with_hint_prefix_extractor=rocksdb.CappedPrefix.13;"
  413. "paranoid_file_checks=true;"
  414. "force_consistency_checks=true;"
  415. "inplace_update_num_locks=7429;"
  416. "optimize_filters_for_hits=false;"
  417. "level_compaction_dynamic_level_bytes=false;"
  418. "inplace_update_support=false;"
  419. "compaction_style=kCompactionStyleFIFO;"
  420. "compaction_pri=kMinOverlappingRatio;"
  421. "hard_pending_compaction_bytes_limit=0;"
  422. "disable_auto_compactions=false;"
  423. "report_bg_io_stats=true;"
  424. "ttl=60;"
  425. "periodic_compaction_seconds=3600;"
  426. "sample_for_compression=0;"
  427. "compaction_options_fifo={max_table_files_size=3;allow_"
  428. "compaction=false;};",
  429. new_options));
  430. ASSERT_EQ(unset_bytes_base,
  431. NumUnsetBytes(new_options_ptr, sizeof(ColumnFamilyOptions),
  432. kColumnFamilyOptionsBlacklist));
  433. options->~ColumnFamilyOptions();
  434. new_options->~ColumnFamilyOptions();
  435. delete[] options_ptr;
  436. delete[] new_options_ptr;
  437. }
  438. #endif // !__clang__
  439. #endif // OS_LINUX || OS_WIN
  440. #endif // !ROCKSDB_LITE
  441. } // namespace ROCKSDB_NAMESPACE
  442. int main(int argc, char** argv) {
  443. ::testing::InitGoogleTest(&argc, argv);
  444. #ifdef GFLAGS
  445. ParseCommandLineFlags(&argc, &argv, true);
  446. #endif // GFLAGS
  447. return RUN_ALL_TESTS();
  448. }