Enable compact filter for blob in dbstress and dbbench (#8011)

Summary:
As title.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8011

Test Plan:
```
./db_bench -enable_blob_files=1 -use_keep_filter=1 -disable_auto_compactions=1
/db_stress -enable_blob_files=1 -enable_compaction_filter=1 -acquire_snapshot_one_in=0 -compact_range_one_in=0 -iterpercent=0 -test_batches_snapshots=0 -readpercent=10 -prefixpercent=20 -writepercent=55 -delpercent=15 -continuous_verification_interval=0
```

Reviewed By: ltamasi

Differential Revision: D26736061

Pulled By: riversand963

fbshipit-source-id: 1c7834903c28431ce23324c4f259ed71255614e2
This commit is contained in:
Yanqin Jin 2021-03-01 17:23:11 -08:00 committed by Facebook GitHub Bot
parent 9fdc9fbeea
commit 1f11d07f24
4 changed files with 20 additions and 15 deletions

View File

@ -242,9 +242,13 @@ void StressTest::FinishInitDb(SharedState* shared) {
PreloadDbAndReopenAsReadOnly(FLAGS_max_key, shared); PreloadDbAndReopenAsReadOnly(FLAGS_max_key, shared);
} }
if (FLAGS_enable_compaction_filter) { if (FLAGS_enable_compaction_filter) {
reinterpret_cast<DbStressCompactionFilterFactory*>( auto* compaction_filter_factory =
options_.compaction_filter_factory.get()) reinterpret_cast<DbStressCompactionFilterFactory*>(
->SetSharedState(shared); options_.compaction_filter_factory.get());
assert(compaction_filter_factory);
compaction_filter_factory->SetSharedState(shared);
fprintf(stdout, "Compaction filter factory: %s\n",
compaction_filter_factory->Name());
} }
} }
@ -2218,12 +2222,11 @@ void StressTest::Open() {
if ((options_.enable_blob_files || options_.enable_blob_garbage_collection || if ((options_.enable_blob_files || options_.enable_blob_garbage_collection ||
FLAGS_allow_setting_blob_options_dynamically) && FLAGS_allow_setting_blob_options_dynamically) &&
(FLAGS_use_merge || FLAGS_enable_compaction_filter || (FLAGS_use_merge || FLAGS_backup_one_in > 0 ||
FLAGS_backup_one_in > 0 || FLAGS_best_efforts_recovery)) { FLAGS_best_efforts_recovery)) {
fprintf( fprintf(stderr,
stderr, "Integrated BlobDB is currently incompatible with Merge, "
"Integrated BlobDB is currently incompatible with Merge, compaction " "backup/restore, and best-effort recovery\n");
"filters, backup/restore, and best-effort recovery\n");
exit(1); exit(1);
} }

View File

@ -163,8 +163,12 @@ int db_stress_tool(int argc, char** argv) {
if ((FLAGS_readpercent + FLAGS_prefixpercent + FLAGS_writepercent + if ((FLAGS_readpercent + FLAGS_prefixpercent + FLAGS_writepercent +
FLAGS_delpercent + FLAGS_delrangepercent + FLAGS_iterpercent) != 100) { FLAGS_delpercent + FLAGS_delrangepercent + FLAGS_iterpercent) != 100) {
fprintf(stderr, fprintf(stderr,
"Error: Read+Prefix+Write+Delete+DeleteRange+Iterate percents != " "Error: "
"100!\n"); "Read(%d)+Prefix(%d)+Write(%d)+Delete(%d)+DeleteRange(%d)"
"+Iterate(%d) percents != "
"100!\n",
FLAGS_readpercent, FLAGS_prefixpercent, FLAGS_writepercent,
FLAGS_delpercent, FLAGS_delrangepercent, FLAGS_iterpercent);
exit(1); exit(1);
} }
if (FLAGS_disable_wal == 1 && FLAGS_reopen > 0) { if (FLAGS_disable_wal == 1 && FLAGS_reopen > 0) {

View File

@ -7496,10 +7496,9 @@ int db_bench_tool(int argc, char** argv) {
} }
if ((FLAGS_enable_blob_files || FLAGS_enable_blob_garbage_collection) && if ((FLAGS_enable_blob_files || FLAGS_enable_blob_garbage_collection) &&
(FLAGS_use_keep_filter || !FLAGS_merge_operator.empty())) { !FLAGS_merge_operator.empty()) {
fprintf(stderr, fprintf(stderr,
"Integrated BlobDB is currently incompatible with Merge and " "Integrated BlobDB is currently incompatible with Merge.\n");
"compaction filters\n");
exit(1); exit(1);
} }

View File

@ -278,7 +278,6 @@ blob_params = {
"blob_garbage_collection_age_cutoff": lambda: random.choice([0.0, 0.25, 0.5, 0.75, 1.0]), "blob_garbage_collection_age_cutoff": lambda: random.choice([0.0, 0.25, 0.5, 0.75, 1.0]),
# The following are currently incompatible with the integrated BlobDB # The following are currently incompatible with the integrated BlobDB
"use_merge": 0, "use_merge": 0,
"enable_compaction_filter": 0,
"backup_one_in": 0, "backup_one_in": 0,
} }