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