Skip to content

Commit

Permalink
Enable compaction filter for db_stress with user-defined timestamp (f…
Browse files Browse the repository at this point in the history
…acebook#10259)

Summary:
Before this PR, when user-defined timestamp is enabled, db_stress disables compaction filter.

This is no longer necessary after this PR, since the `DbStressCompactionFilter` is now aware of
the presence of timestamps.

Pull Request resolved: facebook#10259

Test Plan: TEST_TMPDIR=/dev/shm make crash_test_with_ts

Reviewed By: ajkr

Differential Revision: D37459692

Pulled By: riversand963

fbshipit-source-id: 8fe62e90a63bd9317fe1bb95a2b4984080c9e5ef
  • Loading branch information
riversand963 authored and facebook-github-bot committed Jun 27, 2022
1 parent c73d2a9 commit d3de592
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
11 changes: 8 additions & 3 deletions db_stress_tool/db_stress_compaction_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ class DbStressCompactionFilter : public CompactionFilter {
return Decision::kKeep;
}
uint64_t key_num = 0;
bool ok = GetIntVal(key.ToString(), &key_num);
assert(ok);
(void)ok;
{
Slice ukey_without_ts = key;
assert(ukey_without_ts.size() >= FLAGS_user_timestamp_size);
ukey_without_ts.remove_suffix(FLAGS_user_timestamp_size);
[[maybe_unused]] bool ok =
GetIntVal(ukey_without_ts.ToString(), &key_num);
assert(ok);
}
port::Mutex* key_mutex = state_->GetMutexForKey(cf_id_, key_num);
if (!key_mutex->TryLock()) {
return Decision::kKeep;
Expand Down
4 changes: 0 additions & 4 deletions db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2697,10 +2697,6 @@ void CheckAndSetOptionsForUserTimestamp(Options& options) {
exit(1);
}
#endif // !ROCKSDB_LITE
if (FLAGS_enable_compaction_filter) {
fprintf(stderr, "CompactionFilter not supported with timestamp.\n");
exit(1);
}
if (FLAGS_test_cf_consistency || FLAGS_test_batches_snapshots) {
fprintf(stderr,
"Due to per-key ts-seq ordering constraint, only the (default) "
Expand Down
1 change: 0 additions & 1 deletion tools/db_crashtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ def is_direct_io_supported(dbname):
"use_txn": 0,
"enable_blob_files": 0,
"use_blob_db": 0,
"enable_compaction_filter": 0,
"ingest_external_file_one_in": 0,
}

Expand Down

0 comments on commit d3de592

Please sign in to comment.