Support partitioned index and filters in stress/crash tests (#4020)

Summary:
- In `db_stress`, support choosing index type and whether to enable filter partitioning, and randomly set those options in crash test
- When partitioned filter is enabled by crash test, force partitioned index to also be enabled since it's a prerequisite
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4020

Test Plan:
currently this is blocked on fixing the bug that crash test caught:

```
$ TEST_TMPDIR=/data/compaction_bench python ./tools/db_crashtest.py blackbox --simple --interval=10 --max_key=10000000
...
Verification failed for column family 0 key 937501: Value not found: NotFound:
Crash-recovery verification failed :(
```

Differential Revision: D8508683

Pulled By: maysamyabandeh

fbshipit-source-id: 0337e5d0558bcef26b1f3699f47265a2c1e99629
main
Andrew Kryczka 5 years ago committed by Facebook Github Bot
parent 20dd828c01
commit dd2a35f13f
  1. 5
      tools/db_crashtest.py
  2. 11
      tools/db_stress.cc

@ -41,6 +41,7 @@ default_params = {
"enable_pipelined_write": 0,
"expected_values_path": expected_values_file.name,
"flush_one_in": 1000000,
"index_type": lambda: random.randint(0, 2),
"max_background_compactions": 20,
"max_bytes_for_level_base": 10485760,
"max_key": 100000000,
@ -48,6 +49,7 @@ default_params = {
"mmap_read": lambda: random.randint(0, 1),
"nooverwritepercent": 1,
"open_files": lambda : random.choice([-1, 500000]),
"partition_filters": lambda: random.randint(0, 1),
"prefixpercent": 5,
"progress_reports": 0,
"readpercent": 45,
@ -174,6 +176,9 @@ def finalize_and_sanitize(src_params):
# Disable compaction TTL in FIFO compaction, because right
# now assertion failures are triggered.
dest_params["compaction_ttl"] = 0
if dest_params["partition_filters"] == 1:
dest_params["index_type"] = 2
dest_params["use_block_based_filter"] = 0
return dest_params

@ -353,6 +353,14 @@ DEFINE_int32(bloom_bits, 10, "Bloom filter bits per key. "
DEFINE_bool(use_block_based_filter, false, "use block based filter"
"instead of full filter for block based table");
DEFINE_bool(partition_filters, false, "use partitioned filters "
"for block-based table");
DEFINE_int32(
index_type,
static_cast<int32_t>(rocksdb::BlockBasedTableOptions::kBinarySearch),
"Type of block-based table index (see `enum IndexType` in table.h)");
DEFINE_string(db, "", "Use the db with the following name.");
DEFINE_string(secondaries_base, "",
@ -2777,6 +2785,9 @@ class StressTest {
block_based_options.index_block_restart_interval =
static_cast<int32_t>(FLAGS_index_block_restart_interval);
block_based_options.filter_policy = filter_policy_;
block_based_options.partition_filters = FLAGS_partition_filters;
block_based_options.index_type =
static_cast<BlockBasedTableOptions::IndexType>(FLAGS_index_type);
options_.table_factory.reset(
NewBlockBasedTableFactory(block_based_options));
options_.db_write_buffer_size = FLAGS_db_write_buffer_size;

Loading…
Cancel
Save