From 9901e7f681b1afb2977d2517f79b3043f8286e14 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Tue, 24 May 2022 18:25:43 -0700 Subject: [PATCH] Enable checkpoint and backup in db_stress when timestamp is enabled (#10047) Summary: After https://github.com/facebook/rocksdb/issues/10030 and https://github.com/facebook/rocksdb/issues/10004, we can enable checkpoint and backup in stress tests when user-defined timestamp is enabled. This PR has no production risk. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10047 Test Plan: ``` TEST_TMPDIR=/dev/shm make crash_test_with_ts ``` Reviewed By: jowlyzhang Differential Revision: D36641565 Pulled By: riversand963 fbshipit-source-id: d86c9d87efcc34c32d1aa176af691d32b897644a --- db_stress_tool/db_stress_test_base.cc | 17 +++++++++-------- tools/db_crashtest.py | 5 ++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index a342f294a..0c8b7ee08 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -1795,9 +1795,17 @@ Status StressTest::TestCheckpoint(ThreadState* thread, for (size_t i = 0; s.ok() && i < rand_column_families.size(); ++i) { std::string key_str = Key(rand_keys[0]); Slice key = key_str; + std::string ts_str; + Slice ts; + ReadOptions read_opts; + if (FLAGS_user_timestamp_size > 0) { + ts_str = GenerateTimestampForRead(); + ts = ts_str; + read_opts.timestamp = &ts; + } std::string value; Status get_status = checkpoint_db->Get( - ReadOptions(), cf_handles[rand_column_families[i]], key, &value); + read_opts, cf_handles[rand_column_families[i]], key, &value); bool exists = thread->shared->Exists(rand_column_families[i], rand_keys[0]); if (get_status.ok()) { @@ -2764,13 +2772,6 @@ void CheckAndSetOptionsForUserTimestamp(Options& options) { fprintf(stderr, "Secondary instance does not support timestamp.\n"); exit(1); } - if (FLAGS_checkpoint_one_in > 0) { - fprintf(stderr, - "-checkpoint_one_in=%d requires " - "DBImplReadOnly, which is not supported with timestamp\n", - FLAGS_checkpoint_one_in); - exit(1); - } #ifndef ROCKSDB_LITE if (FLAGS_enable_blob_files || FLAGS_use_blob_db) { fprintf(stderr, "BlobDB not supported with timestamp.\n"); diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 581d194f6..81cea63bb 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -341,14 +341,13 @@ ts_params = { "test_cf_consistency": 0, "test_batches_snapshots": 0, "user_timestamp_size": 8, + "delrangepercent": 0, + "delpercent": 5, "use_merge": 0, "use_full_merge_v1": 0, "use_txn": 0, - "read_only": 0, - "backup_one_in": 0, "secondary_catch_up_one_in": 0, "continuous_verification_interval": 0, - "checkpoint_one_in": 0, "enable_blob_files": 0, "use_blob_db": 0, "enable_compaction_filter": 0,