From 669a8869b5414c0e8708dd90b1f4aa297d091887 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 21 Nov 2023 16:58:43 +0100 Subject: add command line options for compact block threshold and gc verbose (#557) - Feature: Added new options to zenserver for GC V2 - `--gc-compactblock-threshold` GCV2 - how much of a compact block should be used to skip compacting the block, default is 90% - `--gc-verbose` GCV2 - enable more verbose output when running a GC pass - Feature: Added new options to `zen gc` command for GC V2 - `--compactblockthreshold` GCV2 - how much of a compact block should be used to skip compacting the block, default is 90% - `--verbose` GCV2 - enable more verbose output when running a GC pass - Feature: Added new parameters for endpoint `admin/gc` (PUT) - `compactblockthreshold` GCV2 - how much of a compact block should be used to skip compacting the block, default is 90% - `verbose` GCV2 - enable more verbose output when running a GC pass --- src/zenserver/admin/admin.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/zenserver/admin/admin.cpp') diff --git a/src/zenserver/admin/admin.cpp b/src/zenserver/admin/admin.cpp index 0b302c36e..f1d9f8d7c 100644 --- a/src/zenserver/admin/admin.cpp +++ b/src/zenserver/admin/admin.cpp @@ -219,6 +219,9 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler, Response << "DiskSizeSoftLimit" << NiceBytes(State.Config.DiskSizeSoftLimit); Response << "MinimumFreeDiskSpaceToAllowWrites" << NiceBytes(State.Config.MinimumFreeDiskSpaceToAllowWrites); Response << "LightweightInterval" << ToTimeSpan(State.Config.LightweightInterval); + Response << "UseGCVersion" << ((State.Config.UseGCVersion == GcVersion::kV1) ? "1" : "2"); + Response << "CompactBlockUsageThresholdPercent" << State.Config.CompactBlockUsageThresholdPercent; + Response << "Verbose" << State.Config.Verbose; } Response.EndObject(); Response << "AreDiskWritesBlocked" << State.AreDiskWritesBlocked; @@ -326,6 +329,19 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler, GcParams.ForceGCVersion = GcVersion::kV2; } + if (auto Param = Params.GetValue("compactblockthreshold"); Param.empty() == false) + { + if (auto Value = ParseInt(Param)) + { + GcParams.CompactBlockUsageThresholdPercent = Value.value(); + } + } + + if (auto Param = Params.GetValue("verbose"); Param.empty() == false) + { + GcParams.Verbose = Param == "true"sv; + } + const bool Started = m_GcScheduler.TriggerGc(GcParams); CbObjectWriter Response; -- cgit v1.2.3