diff options
| author | Dan Engelbrecht <[email protected]> | 2024-08-14 18:19:16 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-08-14 18:19:16 +0200 |
| commit | 0831e5161a3cca3446d488f172e7b8f0be7d38dc (patch) | |
| tree | d252c08b47876fc21f5d040410c87859f8ba4b77 /src | |
| parent | added `--detach` option to zenserver (#115) (diff) | |
| download | zen-0831e5161a3cca3446d488f172e7b8f0be7d38dc.tar.xz zen-0831e5161a3cca3446d488f172e7b8f0be7d38dc.zip | |
improved logging removing unimportant information (#116)
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenstore/gc.cpp | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index 8ed74b54b..ec1eb3722 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -1124,8 +1124,6 @@ GcManager::CollectGarbage(const GcSettings& Settings) } StoreCompactors.clear(); } - - ZEN_INFO("GCV2: Completed in {}", NiceTimeSpanMs(TotalTimer.GetElapsedTimeMs())); } return Sum(Result); @@ -2205,28 +2203,39 @@ GcScheduler::CollectGarbage(const GcClock::TimePoint& CacheExpireTime, GcClock::TimePoint GcStartTime = GcClock::Now(); GcResult Result = m_GcManager.CollectGarbage(Settings); - ZEN_INFO( - "GCV2: Found {} expired items out of {}, deleted {}. " - "Found {} unreferenced Cid entries out of {}, deleted {}. " - "Freed {} on disk and {} of memory in {}. " - "CacheExpireTime: {}, ProjectStoreExpireTime: {}, CollectSmallObjects: {}, " - "IsDeleteMode: {}, SkipCidDelete: {}", - Result.ReferencerStatSum.RemoveExpiredDataStats.FoundCount, - Result.ReferencerStatSum.RemoveExpiredDataStats.CheckedCount, - Result.ReferencerStatSum.RemoveExpiredDataStats.DeletedCount, - - Result.ReferenceStoreStatSum.RemoveUnreferencedDataStats.FoundCount, - Result.ReferenceStoreStatSum.RemoveUnreferencedDataStats.CheckedCount, - Result.ReferenceStoreStatSum.RemoveUnreferencedDataStats.DeletedCount, - - NiceBytes(Result.CompactStoresStatSum.RemovedDisk), - NiceBytes(Result.ReferencerStatSum.RemoveExpiredDataStats.FreedMemory), - NiceTimeSpanMs(Result.ElapsedMS.count()), - Settings.CacheExpireTime, - Settings.ProjectStoreExpireTime, - Settings.CollectSmallObjects, - Settings.IsDeleteMode, - Settings.SkipCidDelete); + ExtendableStringBuilder<256> SB; + if (Result.WasCancelled) + { + SB.Append(fmt::format("Cancelled after {}", NiceTimeSpanMs(Result.ElapsedMS.count()))); + } + else + { + SB.Append( + fmt::format("CacheExpireTime: {}, ProjectStoreExpireTime: {}, CollectSmallObjects: {}, IsDeleteMode: {}, " + "SkipCidDelete: {}\n", + Settings.CacheExpireTime, + Settings.ProjectStoreExpireTime, + Settings.CollectSmallObjects, + Settings.IsDeleteMode, + Settings.SkipCidDelete)); + SB.Append(fmt::format(" Found {} expired items out of {}, deleted {}.\n", + Result.ReferencerStatSum.RemoveExpiredDataStats.FoundCount, + Result.ReferencerStatSum.RemoveExpiredDataStats.CheckedCount, + Result.ReferencerStatSum.RemoveExpiredDataStats.DeletedCount)); + if (!Settings.SkipCidDelete) + { + SB.Append(fmt::format(" Found {} unreferenced Cid entries out of {}, deleted {}.\n", + Result.ReferenceStoreStatSum.RemoveUnreferencedDataStats.FoundCount, + Result.ReferenceStoreStatSum.RemoveUnreferencedDataStats.CheckedCount, + Result.ReferenceStoreStatSum.RemoveUnreferencedDataStats.DeletedCount)); + } + SB.Append(fmt::format(" Freed {} on disk and {} of memory in {}.\n", + NiceBytes(Result.CompactStoresStatSum.RemovedDisk), + NiceBytes(Result.ReferencerStatSum.RemoveExpiredDataStats.FreedMemory), + NiceTimeSpanMs(Result.ElapsedMS.count()))); + } + + ZEN_INFO("GCV2: {}", SB.ToView()); AppendGCLog(GcStartTime, Settings, Result); |