From 27224ec4da12a7d80db13d8b2f3a67ec9335ee14 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 31 Mar 2022 10:20:06 +0200 Subject: Don hard fail on removing files we no longer care about --- zenstore/compactcas.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'zenstore/compactcas.cpp') diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index dfaf72727..300420cea 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -1552,7 +1552,13 @@ CasContainerStrategy::OpenContainer(bool IsNewStore) { // Log removing unreferenced block // Clear out unused blocks - std::filesystem::remove(Path); + ZEN_INFO("removing unused block in {} at {}", m_Config.RootDirectory / m_ContainerBaseName, Path); + std::error_code Ec; + std::filesystem::remove(Path, Ec); + if (Ec) + { + ZEN_WARN("Failed to delete file '{}' reason: '{}'", Path, Ec.message()); + } continue; } std::filesystem::path BlockPath = GetBlockPath(m_BlocksBasePath, BlockIndex); @@ -1593,7 +1599,12 @@ CasContainerStrategy::OpenContainer(bool IsNewStore) NiceBytes(m_MaxBlockSize), NiceBytes(Space.Free)); - std::filesystem::remove(GCReservePath); + std::error_code Ec; + std::filesystem::remove(GCReservePath, Ec); + if (Ec) + { + ZEN_WARN("Failed to delete gc reserve file '{}' reason: '{}'", GCReservePath, Ec.message()); + } } } else -- cgit v1.2.3