mirror of
https://github.com/facebook/rocksdb.git
synced 2026-07-07 14:47:40 +08:00
Add enable_remote_compaction option to DB Stress (#13378)
Summary: First step to add (simulated) Remote Compaction in Stress Test. More PRs to come. Just first PR to add the FLAG to enable it. `DbStressCompactionService` will return `kUseLocal` for all compactions. Pull Request resolved: https://github.com/facebook/rocksdb/pull/13378 Test Plan: ``` python3 -u tools/db_crashtest.py whitebox --enable_remote_compaction=1 ``` ``` python3 -u tools/db_crashtest.py blackbox --enable_remote_compaction=1 ``` Reviewed By: hx235 Differential Revision: D69269568 Pulled By: jaykorean fbshipit-source-id: 5119bb6afd4d52f66923fb095150d3132226f7ba
This commit is contained in:
committed by
Facebook GitHub Bot
parent
62531da510
commit
302254d928
@@ -422,6 +422,7 @@ DECLARE_bool(allow_unprepared_value);
|
||||
DECLARE_string(file_temperature_age_thresholds);
|
||||
DECLARE_uint32(commit_bypass_memtable_one_in);
|
||||
DECLARE_bool(track_and_verify_wals);
|
||||
DECLARE_bool(enable_remote_compaction);
|
||||
|
||||
constexpr long KB = 1024;
|
||||
constexpr int kRandomValueMaxFactor = 3;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
||||
// This source code is licensed under both the GPLv2 (found in the
|
||||
// COPYING file in the root directory) and Apache 2.0 License
|
||||
// (found in the LICENSE.Apache file in the root directory).
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "rocksdb/options.h"
|
||||
|
||||
namespace ROCKSDB_NAMESPACE {
|
||||
|
||||
// Service to simulate Remote Compaction in Stress Test
|
||||
class DbStressCompactionService : public CompactionService {
|
||||
public:
|
||||
explicit DbStressCompactionService() {}
|
||||
|
||||
static const char* kClassName() { return "DbStressCompactionService"; }
|
||||
|
||||
const char* Name() const override { return kClassName(); }
|
||||
|
||||
CompactionServiceScheduleResponse Schedule(
|
||||
const CompactionServiceJobInfo& /*info*/,
|
||||
const std::string& /*compaction_service_input*/) override {
|
||||
CompactionServiceScheduleResponse response(
|
||||
"Implement Me", CompactionServiceJobStatus::kUseLocal);
|
||||
return response;
|
||||
}
|
||||
|
||||
CompactionServiceJobStatus Wait(const std::string& /*scheduled_job_id*/,
|
||||
std::string* /*result*/) override {
|
||||
// TODO - Implement
|
||||
return CompactionServiceJobStatus::kUseLocal;
|
||||
}
|
||||
|
||||
// TODO - Implement
|
||||
void CancelAwaitingJobs() override {}
|
||||
};
|
||||
|
||||
} // namespace ROCKSDB_NAMESPACE
|
||||
@@ -851,6 +851,9 @@ DEFINE_bool(track_and_verify_wals,
|
||||
ROCKSDB_NAMESPACE::Options().track_and_verify_wals,
|
||||
"See Options::track_and_verify_wals");
|
||||
|
||||
DEFINE_bool(enable_remote_compaction, false,
|
||||
"Enable (simulated) Remote Compaction");
|
||||
|
||||
static bool ValidateInt32Percent(const char* flagname, int32_t value) {
|
||||
if (value < 0 || value > 100) {
|
||||
fprintf(stderr, "Invalid value for --%s: %d, 0<= pct <=100 \n", flagname,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifdef GFLAGS
|
||||
#include "db_stress_tool/db_stress_common.h"
|
||||
#include "db_stress_tool/db_stress_compaction_filter.h"
|
||||
#include "db_stress_tool/db_stress_compaction_service.h"
|
||||
#include "db_stress_tool/db_stress_driver.h"
|
||||
#include "db_stress_tool/db_stress_filters.h"
|
||||
#include "db_stress_tool/db_stress_table_properties_collector.h"
|
||||
@@ -4297,6 +4298,11 @@ void InitializeOptionsFromFlags(
|
||||
static_cast<CacheTier>(FLAGS_lowest_used_cache_tier);
|
||||
options.inplace_update_support = FLAGS_inplace_update_support;
|
||||
options.uncache_aggressiveness = FLAGS_uncache_aggressiveness;
|
||||
|
||||
// Remote Compaction
|
||||
if (FLAGS_enable_remote_compaction) {
|
||||
options.compaction_service = std::make_shared<DbStressCompactionService>();
|
||||
}
|
||||
}
|
||||
|
||||
void InitializeOptionsGeneral(
|
||||
|
||||
@@ -344,6 +344,7 @@ default_params = {
|
||||
"paranoid_memory_checks": lambda: random.choice([0] * 7 + [1]),
|
||||
"allow_unprepared_value": lambda: random.choice([0, 1]),
|
||||
"track_and_verify_wals": lambda: random.choice([0, 1]),
|
||||
"enable_remote_compaction": lambda: random.choice([0, 1]),
|
||||
}
|
||||
_TEST_DIR_ENV_VAR = "TEST_TMPDIR"
|
||||
# If TEST_TMPDIR_EXPECTED is not specified, default value will be TEST_TMPDIR
|
||||
|
||||
Reference in New Issue
Block a user