db_stress_gflags.cc 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  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. #ifdef GFLAGS
  10. #include "db_stress_tool/db_stress_common.h"
  11. static bool ValidateUint32Range(const char* flagname, uint64_t value) {
  12. if (value > std::numeric_limits<uint32_t>::max()) {
  13. fprintf(stderr, "Invalid value for --%s: %lu, overflow\n", flagname,
  14. (unsigned long)value);
  15. return false;
  16. }
  17. return true;
  18. }
  19. DEFINE_uint64(seed, 2341234, "Seed for PRNG");
  20. static const bool FLAGS_seed_dummy __attribute__((__unused__)) =
  21. RegisterFlagValidator(&FLAGS_seed, &ValidateUint32Range);
  22. DEFINE_bool(read_only, false, "True if open DB in read-only mode during tests");
  23. DEFINE_int64(max_key, 1 * KB * KB,
  24. "Max number of key/values to place in database");
  25. DEFINE_int32(max_key_len, 3, "Maximum length of a key in 8-byte units");
  26. DEFINE_string(key_len_percent_dist, "",
  27. "Percentages of keys of various lengths. For example, 1,30,69 "
  28. "means 1% of keys are 8 bytes, 30% are 16 bytes, and 69% are "
  29. "24 bytes. If not specified, it will be evenly distributed");
  30. DEFINE_int32(key_window_scale_factor, 10,
  31. "This value will be multiplied by 100 to come up with a window "
  32. "size for varying the key length");
  33. DEFINE_int32(column_families, 10, "Number of column families");
  34. DEFINE_double(
  35. hot_key_alpha, 0,
  36. "Use Zipfian distribution to generate the key "
  37. "distribution. If it is not specified, write path will use random "
  38. "distribution to generate the keys. The parameter is [0, double_max]). "
  39. "However, the larger alpha is, the more shewed will be. If alpha is "
  40. "larger than 2, it is likely that only 1 key will be accessed. The "
  41. "Recommended value is [0.8-1.5]. The distribution is also related to "
  42. "max_key and total iterations of generating the hot key. ");
  43. DEFINE_string(
  44. options_file, "",
  45. "The path to a RocksDB options file. If specified, then db_stress will "
  46. "run with the RocksDB options in the default column family of the "
  47. "specified options file. Note that, when an options file is provided, "
  48. "db_stress will ignore the flag values for all options that may be passed "
  49. "via options file.");
  50. DEFINE_int64(
  51. active_width, 0,
  52. "Number of keys in active span of the key-range at any given time. The "
  53. "span begins with its left endpoint at key 0, gradually moves rightwards, "
  54. "and ends with its right endpoint at max_key. If set to 0, active_width "
  55. "will be sanitized to be equal to max_key.");
  56. // TODO(noetzli) Add support for single deletes
  57. DEFINE_bool(test_batches_snapshots, false,
  58. "If set, the test uses MultiGet(), MultiPut() and MultiDelete()"
  59. " which read/write/delete multiple keys in a batch. In this mode,"
  60. " we do not verify db content by comparing the content with the "
  61. "pre-allocated array. Instead, we do partial verification inside"
  62. " MultiGet() by checking various values in a batch. Benefit of"
  63. " this mode:\n"
  64. "\t(a) No need to acquire mutexes during writes (less cache "
  65. "flushes in multi-core leading to speed up)\n"
  66. "\t(b) No long validation at the end (more speed up)\n"
  67. "\t(c) Test snapshot and atomicity of batch writes");
  68. DEFINE_bool(atomic_flush, false,
  69. "If set, enables atomic flush in the options.\n");
  70. DEFINE_bool(test_cf_consistency, false,
  71. "If set, runs the stress test dedicated to verifying writes to "
  72. "multiple column families are consistent. Setting this implies "
  73. "`atomic_flush=true` is set true if `disable_wal=false`.\n");
  74. DEFINE_int32(threads, 32, "Number of concurrent threads to run.");
  75. DEFINE_int32(ttl, -1,
  76. "Opens the db with this ttl value if this is not -1. "
  77. "Carefully specify a large value such that verifications on "
  78. "deleted values don't fail");
  79. DEFINE_int32(value_size_mult, 8,
  80. "Size of value will be this number times rand_int(1,3) bytes");
  81. DEFINE_int32(compaction_readahead_size, 0, "Compaction readahead size");
  82. DEFINE_bool(enable_pipelined_write, false, "Pipeline WAL/memtable writes");
  83. DEFINE_bool(verify_before_write, false, "Verify before write");
  84. DEFINE_bool(histogram, false, "Print histogram of operation timings");
  85. DEFINE_bool(destroy_db_initially, true,
  86. "Destroys the database dir before start if this is true");
  87. DEFINE_bool(verbose, false, "Verbose");
  88. DEFINE_bool(progress_reports, true,
  89. "If true, db_stress will report number of finished operations");
  90. DEFINE_uint64(db_write_buffer_size,
  91. ROCKSDB_NAMESPACE::Options().db_write_buffer_size,
  92. "Number of bytes to buffer in all memtables before compacting");
  93. DEFINE_int32(
  94. write_buffer_size,
  95. static_cast<int32_t>(ROCKSDB_NAMESPACE::Options().write_buffer_size),
  96. "Number of bytes to buffer in memtable before compacting");
  97. DEFINE_int32(max_write_buffer_number,
  98. ROCKSDB_NAMESPACE::Options().max_write_buffer_number,
  99. "The number of in-memory memtables. "
  100. "Each memtable is of size FLAGS_write_buffer_size.");
  101. DEFINE_int32(min_write_buffer_number_to_merge,
  102. ROCKSDB_NAMESPACE::Options().min_write_buffer_number_to_merge,
  103. "The minimum number of write buffers that will be merged together "
  104. "before writing to storage. This is cheap because it is an "
  105. "in-memory merge. If this feature is not enabled, then all these "
  106. "write buffers are flushed to L0 as separate files and this "
  107. "increases read amplification because a get request has to check "
  108. "in all of these files. Also, an in-memory merge may result in "
  109. "writing less data to storage if there are duplicate records in"
  110. " each of these individual write buffers.");
  111. DEFINE_int32(max_write_buffer_number_to_maintain,
  112. ROCKSDB_NAMESPACE::Options().max_write_buffer_number_to_maintain,
  113. "The total maximum number of write buffers to maintain in memory "
  114. "including copies of buffers that have already been flushed. "
  115. "Unlike max_write_buffer_number, this parameter does not affect "
  116. "flushing. This controls the minimum amount of write history "
  117. "that will be available in memory for conflict checking when "
  118. "Transactions are used. If this value is too low, some "
  119. "transactions may fail at commit time due to not being able to "
  120. "determine whether there were any write conflicts. Setting this "
  121. "value to 0 will cause write buffers to be freed immediately "
  122. "after they are flushed. If this value is set to -1, "
  123. "'max_write_buffer_number' will be used.");
  124. DEFINE_int64(max_write_buffer_size_to_maintain,
  125. ROCKSDB_NAMESPACE::Options().max_write_buffer_size_to_maintain,
  126. "The total maximum size of write buffers to maintain in memory "
  127. "including copies of buffers that have already been flushed. "
  128. "Unlike max_write_buffer_number, this parameter does not affect "
  129. "flushing. This controls the minimum amount of write history "
  130. "that will be available in memory for conflict checking when "
  131. "Transactions are used. If this value is too low, some "
  132. "transactions may fail at commit time due to not being able to "
  133. "determine whether there were any write conflicts. Setting this "
  134. "value to 0 will cause write buffers to be freed immediately "
  135. "after they are flushed. If this value is set to -1, "
  136. "'max_write_buffer_number' will be used.");
  137. DEFINE_double(memtable_prefix_bloom_size_ratio,
  138. ROCKSDB_NAMESPACE::Options().memtable_prefix_bloom_size_ratio,
  139. "creates prefix blooms for memtables, each with size "
  140. "`write_buffer_size * memtable_prefix_bloom_size_ratio`.");
  141. DEFINE_bool(memtable_whole_key_filtering,
  142. ROCKSDB_NAMESPACE::Options().memtable_whole_key_filtering,
  143. "Enable whole key filtering in memtables.");
  144. DEFINE_int32(open_files, ROCKSDB_NAMESPACE::Options().max_open_files,
  145. "Maximum number of files to keep open at the same time "
  146. "(use default if == 0)");
  147. DEFINE_int64(compressed_cache_size, -1,
  148. "Number of bytes to use as a cache of compressed data."
  149. " Negative means use default settings.");
  150. DEFINE_int32(compaction_style, ROCKSDB_NAMESPACE::Options().compaction_style,
  151. "");
  152. DEFINE_int32(level0_file_num_compaction_trigger,
  153. ROCKSDB_NAMESPACE::Options().level0_file_num_compaction_trigger,
  154. "Level0 compaction start trigger");
  155. DEFINE_int32(level0_slowdown_writes_trigger,
  156. ROCKSDB_NAMESPACE::Options().level0_slowdown_writes_trigger,
  157. "Number of files in level-0 that will slow down writes");
  158. DEFINE_int32(level0_stop_writes_trigger,
  159. ROCKSDB_NAMESPACE::Options().level0_stop_writes_trigger,
  160. "Number of files in level-0 that will trigger put stop.");
  161. DEFINE_int32(block_size,
  162. static_cast<int32_t>(
  163. ROCKSDB_NAMESPACE::BlockBasedTableOptions().block_size),
  164. "Number of bytes in a block.");
  165. DEFINE_int32(format_version,
  166. static_cast<int32_t>(
  167. ROCKSDB_NAMESPACE::BlockBasedTableOptions().format_version),
  168. "Format version of SST files.");
  169. DEFINE_int32(
  170. index_block_restart_interval,
  171. ROCKSDB_NAMESPACE::BlockBasedTableOptions().index_block_restart_interval,
  172. "Number of keys between restart points "
  173. "for delta encoding of keys in index block.");
  174. DEFINE_int32(max_background_compactions,
  175. ROCKSDB_NAMESPACE::Options().max_background_compactions,
  176. "The maximum number of concurrent background compactions "
  177. "that can occur in parallel.");
  178. DEFINE_int32(num_bottom_pri_threads, 0,
  179. "The number of threads in the bottom-priority thread pool (used "
  180. "by universal compaction only).");
  181. DEFINE_int32(compaction_thread_pool_adjust_interval, 0,
  182. "The interval (in milliseconds) to adjust compaction thread pool "
  183. "size. Don't change it periodically if the value is 0.");
  184. DEFINE_int32(compaction_thread_pool_variations, 2,
  185. "Range of background thread pool size variations when adjusted "
  186. "periodically.");
  187. DEFINE_int32(max_background_flushes,
  188. ROCKSDB_NAMESPACE::Options().max_background_flushes,
  189. "The maximum number of concurrent background flushes "
  190. "that can occur in parallel.");
  191. DEFINE_int32(universal_size_ratio, 0,
  192. "The ratio of file sizes that trigger"
  193. " compaction in universal style");
  194. DEFINE_int32(universal_min_merge_width, 0,
  195. "The minimum number of files to "
  196. "compact in universal style compaction");
  197. DEFINE_int32(universal_max_merge_width, 0,
  198. "The max number of files to compact"
  199. " in universal style compaction");
  200. DEFINE_int32(universal_max_size_amplification_percent, 0,
  201. "The max size amplification for universal style compaction");
  202. DEFINE_int32(clear_column_family_one_in, 1000000,
  203. "With a chance of 1/N, delete a column family and then recreate "
  204. "it again. If N == 0, never drop/create column families. "
  205. "When test_batches_snapshots is true, this flag has no effect");
  206. DEFINE_int32(get_live_files_and_wal_files_one_in, 1000000,
  207. "With a chance of 1/N, call GetLiveFiles, GetSortedWalFiles "
  208. "and GetCurrentWalFile to verify if it returns correctly. If "
  209. "N == 0, never call the three interfaces.");
  210. DEFINE_int32(set_options_one_in, 0,
  211. "With a chance of 1/N, change some random options");
  212. DEFINE_int32(set_in_place_one_in, 0,
  213. "With a chance of 1/N, toggle in place support option");
  214. DEFINE_int64(cache_size, 2LL * KB * KB * KB,
  215. "Number of bytes to use as a cache of uncompressed data.");
  216. DEFINE_bool(cache_index_and_filter_blocks, false,
  217. "True if indexes/filters should be cached in block cache.");
  218. DEFINE_bool(use_clock_cache, false,
  219. "Replace default LRU block cache with clock cache.");
  220. DEFINE_uint64(subcompactions, 1,
  221. "Maximum number of subcompactions to divide L0-L1 compactions "
  222. "into.");
  223. DEFINE_uint64(periodic_compaction_seconds, 1000,
  224. "Files older than this value will be picked up for compaction.");
  225. DEFINE_uint64(compaction_ttl, 1000,
  226. "Files older than TTL will be compacted to the next level.");
  227. DEFINE_bool(allow_concurrent_memtable_write, false,
  228. "Allow multi-writers to update mem tables in parallel.");
  229. DEFINE_bool(enable_write_thread_adaptive_yield, true,
  230. "Use a yielding spin loop for brief writer thread waits.");
  231. #ifndef ROCKSDB_LITE
  232. // BlobDB Options
  233. DEFINE_bool(use_blob_db, false, "Use BlobDB.");
  234. DEFINE_uint64(blob_db_min_blob_size,
  235. ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().min_blob_size,
  236. "Smallest blob to store in a file. Blobs smaller than this "
  237. "will be inlined with the key in the LSM tree.");
  238. DEFINE_uint64(blob_db_bytes_per_sync,
  239. ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().bytes_per_sync,
  240. "Sync blob files once per every N bytes written.");
  241. DEFINE_uint64(blob_db_file_size,
  242. ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().blob_file_size,
  243. "Target size of each blob file.");
  244. DEFINE_bool(
  245. blob_db_enable_gc,
  246. ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().enable_garbage_collection,
  247. "Enable BlobDB garbage collection.");
  248. DEFINE_double(
  249. blob_db_gc_cutoff,
  250. ROCKSDB_NAMESPACE::blob_db::BlobDBOptions().garbage_collection_cutoff,
  251. "Cutoff ratio for BlobDB garbage collection.");
  252. #endif // !ROCKSDB_LITE
  253. static const bool FLAGS_subcompactions_dummy __attribute__((__unused__)) =
  254. RegisterFlagValidator(&FLAGS_subcompactions, &ValidateUint32Range);
  255. static bool ValidateInt32Positive(const char* flagname, int32_t value) {
  256. if (value < 0) {
  257. fprintf(stderr, "Invalid value for --%s: %d, must be >=0\n", flagname,
  258. value);
  259. return false;
  260. }
  261. return true;
  262. }
  263. DEFINE_int32(reopen, 10, "Number of times database reopens");
  264. static const bool FLAGS_reopen_dummy __attribute__((__unused__)) =
  265. RegisterFlagValidator(&FLAGS_reopen, &ValidateInt32Positive);
  266. DEFINE_double(bloom_bits, 10,
  267. "Bloom filter bits per key. "
  268. "Negative means use default settings.");
  269. DEFINE_bool(use_block_based_filter, false,
  270. "use block based filter"
  271. "instead of full filter for block based table");
  272. DEFINE_bool(partition_filters, false,
  273. "use partitioned filters "
  274. "for block-based table");
  275. DEFINE_int32(
  276. index_type,
  277. static_cast<int32_t>(
  278. ROCKSDB_NAMESPACE::BlockBasedTableOptions::kBinarySearch),
  279. "Type of block-based table index (see `enum IndexType` in table.h)");
  280. DEFINE_string(db, "", "Use the db with the following name.");
  281. DEFINE_string(secondaries_base, "",
  282. "Use this path as the base path for secondary instances.");
  283. DEFINE_bool(test_secondary, false, "Test secondary instance.");
  284. DEFINE_string(
  285. expected_values_path, "",
  286. "File where the array of expected uint32_t values will be stored. If "
  287. "provided and non-empty, the DB state will be verified against these "
  288. "values after recovery. --max_key and --column_family must be kept the "
  289. "same across invocations of this program that use the same "
  290. "--expected_values_path.");
  291. DEFINE_bool(verify_checksum, false,
  292. "Verify checksum for every block read from storage");
  293. DEFINE_bool(mmap_read, ROCKSDB_NAMESPACE::Options().allow_mmap_reads,
  294. "Allow reads to occur via mmap-ing files");
  295. DEFINE_bool(mmap_write, ROCKSDB_NAMESPACE::Options().allow_mmap_writes,
  296. "Allow writes to occur via mmap-ing files");
  297. DEFINE_bool(use_direct_reads, ROCKSDB_NAMESPACE::Options().use_direct_reads,
  298. "Use O_DIRECT for reading data");
  299. DEFINE_bool(use_direct_io_for_flush_and_compaction,
  300. ROCKSDB_NAMESPACE::Options().use_direct_io_for_flush_and_compaction,
  301. "Use O_DIRECT for writing data");
  302. DEFINE_bool(statistics, false, "Create database statistics");
  303. DEFINE_bool(sync, false, "Sync all writes to disk");
  304. DEFINE_bool(use_fsync, false, "If true, issue fsync instead of fdatasync");
  305. DEFINE_int32(kill_random_test, 0,
  306. "If non-zero, kill at various points in source code with "
  307. "probability 1/this");
  308. static const bool FLAGS_kill_random_test_dummy __attribute__((__unused__)) =
  309. RegisterFlagValidator(&FLAGS_kill_random_test, &ValidateInt32Positive);
  310. extern int rocksdb_kill_odds;
  311. DEFINE_string(kill_prefix_blacklist, "",
  312. "If non-empty, kill points with prefix in the list given will be"
  313. " skipped. Items are comma-separated.");
  314. extern std::vector<std::string> rocksdb_kill_prefix_blacklist;
  315. DEFINE_bool(disable_wal, false, "If true, do not write WAL for write.");
  316. DEFINE_uint64(recycle_log_file_num,
  317. ROCKSDB_NAMESPACE::Options().recycle_log_file_num,
  318. "Number of old WAL files to keep around for later recycling");
  319. DEFINE_int64(target_file_size_base,
  320. ROCKSDB_NAMESPACE::Options().target_file_size_base,
  321. "Target level-1 file size for compaction");
  322. DEFINE_int32(target_file_size_multiplier, 1,
  323. "A multiplier to compute target level-N file size (N >= 2)");
  324. DEFINE_uint64(max_bytes_for_level_base,
  325. ROCKSDB_NAMESPACE::Options().max_bytes_for_level_base,
  326. "Max bytes for level-1");
  327. DEFINE_double(max_bytes_for_level_multiplier, 2,
  328. "A multiplier to compute max bytes for level-N (N >= 2)");
  329. DEFINE_int32(range_deletion_width, 10,
  330. "The width of the range deletion intervals.");
  331. DEFINE_uint64(rate_limiter_bytes_per_sec, 0, "Set options.rate_limiter value.");
  332. DEFINE_bool(rate_limit_bg_reads, false,
  333. "Use options.rate_limiter on compaction reads");
  334. DEFINE_bool(use_txn, false,
  335. "Use TransactionDB. Currently the default write policy is "
  336. "TxnDBWritePolicy::WRITE_PREPARED");
  337. DEFINE_uint64(txn_write_policy, 0,
  338. "The transaction write policy. Default is "
  339. "TxnDBWritePolicy::WRITE_COMMITTED. Note that this should not be "
  340. "changed accross crashes.");
  341. DEFINE_bool(unordered_write, false,
  342. "Turn on the unordered_write feature. This options is currently "
  343. "tested only in combination with use_txn=true and "
  344. "txn_write_policy=TxnDBWritePolicy::WRITE_PREPARED.");
  345. DEFINE_int32(backup_one_in, 0,
  346. "If non-zero, then CreateNewBackup() will be called once for "
  347. "every N operations on average. 0 indicates CreateNewBackup() "
  348. "is disabled.");
  349. DEFINE_int32(checkpoint_one_in, 0,
  350. "If non-zero, then CreateCheckpoint() will be called once for "
  351. "every N operations on average. 0 indicates CreateCheckpoint() "
  352. "is disabled.");
  353. DEFINE_int32(ingest_external_file_one_in, 0,
  354. "If non-zero, then IngestExternalFile() will be called once for "
  355. "every N operations on average. 0 indicates IngestExternalFile() "
  356. "is disabled.");
  357. DEFINE_int32(ingest_external_file_width, 1000,
  358. "The width of the ingested external files.");
  359. DEFINE_int32(compact_files_one_in, 0,
  360. "If non-zero, then CompactFiles() will be called once for every N "
  361. "operations on average. 0 indicates CompactFiles() is disabled.");
  362. DEFINE_int32(compact_range_one_in, 0,
  363. "If non-zero, then CompactRange() will be called once for every N "
  364. "operations on average. 0 indicates CompactRange() is disabled.");
  365. DEFINE_int32(flush_one_in, 0,
  366. "If non-zero, then Flush() will be called once for every N ops "
  367. "on average. 0 indicates calls to Flush() are disabled.");
  368. DEFINE_int32(pause_background_one_in, 0,
  369. "If non-zero, then PauseBackgroundWork()+Continue will be called "
  370. "once for every N ops on average. 0 disables.");
  371. DEFINE_int32(compact_range_width, 10000,
  372. "The width of the ranges passed to CompactRange().");
  373. DEFINE_int32(acquire_snapshot_one_in, 0,
  374. "If non-zero, then acquires a snapshot once every N operations on "
  375. "average.");
  376. DEFINE_bool(compare_full_db_state_snapshot, false,
  377. "If set we compare state of entire db (in one of the threads) with"
  378. "each snapshot.");
  379. DEFINE_uint64(snapshot_hold_ops, 0,
  380. "If non-zero, then releases snapshots N operations after they're "
  381. "acquired.");
  382. DEFINE_bool(long_running_snapshots, false,
  383. "If set, hold on some some snapshots for much longer time.");
  384. DEFINE_bool(use_multiget, false,
  385. "If set, use the batched MultiGet API for reads");
  386. static bool ValidateInt32Percent(const char* flagname, int32_t value) {
  387. if (value < 0 || value > 100) {
  388. fprintf(stderr, "Invalid value for --%s: %d, 0<= pct <=100 \n", flagname,
  389. value);
  390. return false;
  391. }
  392. return true;
  393. }
  394. DEFINE_int32(readpercent, 10,
  395. "Ratio of reads to total workload (expressed as a percentage)");
  396. static const bool FLAGS_readpercent_dummy __attribute__((__unused__)) =
  397. RegisterFlagValidator(&FLAGS_readpercent, &ValidateInt32Percent);
  398. DEFINE_int32(prefixpercent, 20,
  399. "Ratio of prefix iterators to total workload (expressed as a"
  400. " percentage)");
  401. static const bool FLAGS_prefixpercent_dummy __attribute__((__unused__)) =
  402. RegisterFlagValidator(&FLAGS_prefixpercent, &ValidateInt32Percent);
  403. DEFINE_int32(writepercent, 45,
  404. "Ratio of writes to total workload (expressed as a percentage)");
  405. static const bool FLAGS_writepercent_dummy __attribute__((__unused__)) =
  406. RegisterFlagValidator(&FLAGS_writepercent, &ValidateInt32Percent);
  407. DEFINE_int32(delpercent, 15,
  408. "Ratio of deletes to total workload (expressed as a percentage)");
  409. static const bool FLAGS_delpercent_dummy __attribute__((__unused__)) =
  410. RegisterFlagValidator(&FLAGS_delpercent, &ValidateInt32Percent);
  411. DEFINE_int32(delrangepercent, 0,
  412. "Ratio of range deletions to total workload (expressed as a "
  413. "percentage). Cannot be used with test_batches_snapshots");
  414. static const bool FLAGS_delrangepercent_dummy __attribute__((__unused__)) =
  415. RegisterFlagValidator(&FLAGS_delrangepercent, &ValidateInt32Percent);
  416. DEFINE_int32(nooverwritepercent, 60,
  417. "Ratio of keys without overwrite to total workload (expressed as "
  418. " a percentage)");
  419. static const bool FLAGS_nooverwritepercent_dummy __attribute__((__unused__)) =
  420. RegisterFlagValidator(&FLAGS_nooverwritepercent, &ValidateInt32Percent);
  421. DEFINE_int32(iterpercent, 10,
  422. "Ratio of iterations to total workload"
  423. " (expressed as a percentage)");
  424. static const bool FLAGS_iterpercent_dummy __attribute__((__unused__)) =
  425. RegisterFlagValidator(&FLAGS_iterpercent, &ValidateInt32Percent);
  426. DEFINE_uint64(num_iterations, 10, "Number of iterations per MultiIterate run");
  427. static const bool FLAGS_num_iterations_dummy __attribute__((__unused__)) =
  428. RegisterFlagValidator(&FLAGS_num_iterations, &ValidateUint32Range);
  429. DEFINE_string(compression_type, "snappy",
  430. "Algorithm to use to compress the database");
  431. DEFINE_int32(compression_max_dict_bytes, 0,
  432. "Maximum size of dictionary used to prime the compression "
  433. "library.");
  434. DEFINE_int32(compression_zstd_max_train_bytes, 0,
  435. "Maximum size of training data passed to zstd's dictionary "
  436. "trainer.");
  437. DEFINE_string(bottommost_compression_type, "disable",
  438. "Algorithm to use to compress bottommost level of the database. "
  439. "\"disable\" means disabling the feature");
  440. DEFINE_string(checksum_type, "kCRC32c", "Algorithm to use to checksum blocks");
  441. DEFINE_string(hdfs, "", "Name of hdfs environment");
  442. DEFINE_string(env_uri, "",
  443. "URI for env lookup. Mutually exclusive with --hdfs");
  444. DEFINE_uint64(ops_per_thread, 1200000, "Number of operations per thread.");
  445. static const bool FLAGS_ops_per_thread_dummy __attribute__((__unused__)) =
  446. RegisterFlagValidator(&FLAGS_ops_per_thread, &ValidateUint32Range);
  447. DEFINE_uint64(log2_keys_per_lock, 2, "Log2 of number of keys per lock");
  448. static const bool FLAGS_log2_keys_per_lock_dummy __attribute__((__unused__)) =
  449. RegisterFlagValidator(&FLAGS_log2_keys_per_lock, &ValidateUint32Range);
  450. DEFINE_uint64(max_manifest_file_size, 16384, "Maximum size of a MANIFEST file");
  451. DEFINE_bool(in_place_update, false, "On true, does inplace update in memtable");
  452. DEFINE_int32(secondary_catch_up_one_in, 0,
  453. "If non-zero, the secondaries attemp to catch up with the primary "
  454. "once for every N operations on average. 0 indicates the "
  455. "secondaries do not try to catch up after open.");
  456. DEFINE_string(memtablerep, "skip_list", "");
  457. inline static bool ValidatePrefixSize(const char* flagname, int32_t value) {
  458. if (value < -1 || value > 8) {
  459. fprintf(stderr, "Invalid value for --%s: %d. -1 <= PrefixSize <= 8\n",
  460. flagname, value);
  461. return false;
  462. }
  463. return true;
  464. }
  465. DEFINE_int32(prefix_size, 7,
  466. "Control the prefix size for HashSkipListRep. "
  467. "-1 is disabled.");
  468. static const bool FLAGS_prefix_size_dummy __attribute__((__unused__)) =
  469. RegisterFlagValidator(&FLAGS_prefix_size, &ValidatePrefixSize);
  470. DEFINE_bool(use_merge, false,
  471. "On true, replaces all writes with a Merge "
  472. "that behaves like a Put");
  473. DEFINE_bool(use_full_merge_v1, false,
  474. "On true, use a merge operator that implement the deprecated "
  475. "version of FullMerge");
  476. DEFINE_int32(sync_wal_one_in, 0,
  477. "If non-zero, then SyncWAL() will be called once for every N ops "
  478. "on average. 0 indicates that calls to SyncWAL() are disabled.");
  479. DEFINE_bool(avoid_unnecessary_blocking_io,
  480. ROCKSDB_NAMESPACE::Options().avoid_unnecessary_blocking_io,
  481. "If true, some expensive cleaning up operations will be moved from "
  482. "user reads to high-pri background threads.");
  483. DEFINE_bool(write_dbid_to_manifest,
  484. ROCKSDB_NAMESPACE::Options().write_dbid_to_manifest,
  485. "Write DB_ID to manifest");
  486. DEFINE_uint64(max_write_batch_group_size_bytes,
  487. ROCKSDB_NAMESPACE::Options().max_write_batch_group_size_bytes,
  488. "Max write batch group size");
  489. DEFINE_bool(level_compaction_dynamic_level_bytes,
  490. ROCKSDB_NAMESPACE::Options().level_compaction_dynamic_level_bytes,
  491. "Use dynamic level");
  492. DEFINE_int32(verify_checksum_one_in, 0,
  493. "If non-zero, then DB::VerifyChecksum() will be called to do"
  494. " checksum verification of all the files in the database once for"
  495. " every N ops on average. 0 indicates that calls to"
  496. " VerifyChecksum() are disabled.");
  497. DEFINE_int32(verify_db_one_in, 0,
  498. "If non-zero, call VerifyDb() once for every N ops. 0 indicates "
  499. "that VerifyDb() will not be called in OperateDb(). Note that "
  500. "enabling this can slow down tests.");
  501. DEFINE_int32(continuous_verification_interval, 1000,
  502. "While test is running, verify db every N milliseconds. 0 "
  503. "disables continuous verification.");
  504. DEFINE_int32(approximate_size_one_in, 64,
  505. "If non-zero, DB::GetApproximateSizes() will be called against"
  506. " random key ranges.");
  507. #endif // GFLAGS