mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-02 06:05:53 +00:00
utils/disk_space_monitor: add error injection to suppress threshold checks
Add the `suppress_disk_space_threshold_checks` error injection point to the disk space monitor. When enabled, the threshold listener short-circuits without evaluating disk utilization. This is useful for tests that override disk capacity via `data_file_capacity`, where the real disk usage causes the monitor to incorrectly report critical utilization and activate out-of-space prevention mechanisms.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "utils/disk_space_monitor.hh"
|
||||
#include "utils/assert.hh"
|
||||
#include "utils/error_injection.hh"
|
||||
#include "utils/log.hh"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
@@ -31,8 +32,9 @@ disk_space_monitor::disk_space_monitor(abort_source& as, std::filesystem::path d
|
||||
, _data_dir(std::move(data_dir))
|
||||
, _cfg(std::move(cfg))
|
||||
, _threshold_subscription(listen([this](const disk_space_monitor& dsm) -> future<> {
|
||||
const bool dsm_disabled = utils::get_local_injector().is_enabled("suppress_disk_space_threshold_checks");
|
||||
const float current_disk_utilization = dsm.disk_utilization();
|
||||
if (current_disk_utilization < 0.0f) {
|
||||
if (current_disk_utilization < 0.0f || dsm_disabled) {
|
||||
co_return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user