diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-31 10:20:06 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-03-31 11:29:28 +0200 |
| commit | 27224ec4da12a7d80db13d8b2f3a67ec9335ee14 (patch) | |
| tree | 9bb2c3bfef12182374e14ce15741bb9a8c027bf5 | |
| parent | Truncate migrated and new blocks after gc to save disk space (diff) | |
| download | zen-27224ec4da12a7d80db13d8b2f3a67ec9335ee14.tar.xz zen-27224ec4da12a7d80db13d8b2f3a67ec9335ee14.zip | |
Don hard fail on removing files we no longer care about
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 3 | ||||
| -rw-r--r-- | zenserver/projectstore.cpp | 5 | ||||
| -rw-r--r-- | zenstore/compactcas.cpp | 15 |
3 files changed, 17 insertions, 6 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 95e9e2dba..eec548f1b 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -193,7 +193,8 @@ void ZenCacheStore::GatherReferences(GcContext& GcCtx) { Stopwatch Timer; - const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("cache gathered all references from '{}' in {}", m_RootDir, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); + const auto Guard = MakeGuard( + [this, &Timer] { ZEN_INFO("cache gathered all references from '{}' in {}", m_RootDir, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); access_tracking::AccessTimes AccessTimes; m_MemLayer.GatherAccessTimes(AccessTimes); diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp index 6b18bce3f..bee143bd8 100644 --- a/zenserver/projectstore.cpp +++ b/zenserver/projectstore.cpp @@ -972,9 +972,8 @@ void ProjectStore::GatherReferences(GcContext& GcCtx) { Stopwatch Timer; - const auto Guard = MakeGuard([this, &Timer] { - ZEN_INFO("project store gathered all references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); - }); + const auto Guard = + MakeGuard([this, &Timer] { ZEN_INFO("project store gathered all references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); DiscoverProjects(); 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 |