aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/main.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-12-11 11:48:23 +0100
committerGitHub <[email protected]>2023-12-11 11:48:23 +0100
commit37920b41048acffa30cf156d7d36bfc17ba15c0e (patch)
tree15c4f652a54470e359a9b9dcd194e89cb10eaaf9 /src/zenserver/main.cpp
parentmulti-line logging improvements (#597) (diff)
downloadzen-37920b41048acffa30cf156d7d36bfc17ba15c0e.tar.xz
zen-37920b41048acffa30cf156d7d36bfc17ba15c0e.zip
improved scrubbing of oplogs and filecas (#596)
- Improvement: Scrub command now validates compressed buffer hashes in filecas storage (used for large chunks) - Improvement: Added --dry, --no-gc and --no-cas options to zen scrub command - Improvement: Implemented oplog scrubbing (previously was a no-op) - Improvement: Implemented support for running scrubbint at startup with --scrub=<options>
Diffstat (limited to 'src/zenserver/main.cpp')
-rw-r--r--src/zenserver/main.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp
index 6901323e3..868b5131c 100644
--- a/src/zenserver/main.cpp
+++ b/src/zenserver/main.cpp
@@ -338,9 +338,24 @@ main(int argc, char* argv[])
ZenServerOptions ServerOptions;
ParseCliOptions(argc, argv, ServerOptions);
- if (ServerOptions.IsCleanStart || !ServerOptions.BaseSnapshotDir.empty())
+ std::string_view DeleteReason;
+
+ if (ServerOptions.IsCleanStart)
+ {
+ DeleteReason = "clean start requested"sv;
+ }
+ else if (!ServerOptions.BaseSnapshotDir.empty())
+ {
+ DeleteReason = "will initialize state from base snapshot"sv;
+ }
+
+ if (!DeleteReason.empty())
{
- DeleteDirectories(ServerOptions.DataDir);
+ if (std::filesystem::exists(ServerOptions.DataDir))
+ {
+ ZEN_CONSOLE_INFO("deleting files from '{}' ({})", ServerOptions.DataDir, DeleteReason);
+ DeleteDirectories(ServerOptions.DataDir);
+ }
}
if (!std::filesystem::exists(ServerOptions.DataDir))