From a06e438c9fc930bd8d18f69dd1defed513b95ad3 Mon Sep 17 00:00:00 2001 From: Marcin Copik Date: Fri, 18 Oct 2024 19:20:23 +0200 Subject: [PATCH] [process] In disk swapper, create directories to report swapping even for empty processes --- process/controller/src/swapper.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/process/controller/src/swapper.cpp b/process/controller/src/swapper.cpp index 858bc64..f0cb35e 100644 --- a/process/controller/src/swapper.cpp +++ b/process/controller/src/swapper.cpp @@ -124,6 +124,9 @@ namespace praas::process::swapper { fs::path full_path = fs::path{swap_location} / location / "state"; if(fs::exists(full_path)) { + // There is at least some info. + success = true; + spdlog::debug("Reading state swap data from {}", full_path.string()); success = _process_swapin_dir(full_path, [&mailbox](const std::string& key, runtime::internal::Buffer && data) mutable { @@ -156,7 +159,9 @@ namespace praas::process::swapper { return true; } ); - + if(!success) { + return false; + } } full_path = fs::path{swap_location} / location / "files"; @@ -180,6 +185,11 @@ namespace praas::process::swapper { { size_t total_size = 0; + // Create directory even if nothing present - just to make + fs::create_directories(fs::path{swap_location} / location / "state"); + fs::create_directories(fs::path{swap_location} / location / "messages"); + fs::create_directories(fs::path{swap_location} / location / "file"); + for(const auto& [key, message] : msgs) { fs::path full_path;