diff options
| author | Stefan Boberg <[email protected]> | 2023-05-15 21:25:18 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2023-05-15 21:25:18 +0200 |
| commit | 51c57171d859f1893d181b68c5a2506f7909578c (patch) | |
| tree | 71694f1f03a86bbcf38f9f0a8253e96dea248ecf /src/zenstore/compactcas.cpp | |
| parent | added scrubbing related logging (diff) | |
| download | zen-51c57171d859f1893d181b68c5a2506f7909578c.tar.xz zen-51c57171d859f1893d181b68c5a2506f7909578c.zip | |
added ScrubStorage to GcStorage base class
Diffstat (limited to 'src/zenstore/compactcas.cpp')
| -rw-r--r-- | src/zenstore/compactcas.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp index 47c31eb5a..e4c2c2ecf 100644 --- a/src/zenstore/compactcas.cpp +++ b/src/zenstore/compactcas.cpp @@ -101,8 +101,7 @@ namespace { fmt::format("Invalid content type {} for entry {}", static_cast<uint8_t>(Entry.ContentType), Entry.Key.ToHexString()); return false; } - uint64_t Size = Entry.Location.GetSize(); - if (Size == 0) + if (const uint64_t Size = Entry.Location.GetSize(); Size == 0) { OutReason = fmt::format("Invalid size {} for entry {}", Size, Entry.Key.ToHexString()); return false; @@ -235,6 +234,8 @@ CasContainerStrategy::Flush() void CasContainerStrategy::ScrubStorage(ScrubContext& Ctx) { + ZEN_INFO("scrubbing '{}'", m_BlocksBasePath); + std::vector<IoHash> BadKeys; uint64_t ChunkCount{0}, ChunkBytes{0}; std::vector<BlockStoreLocation> ChunkLocations; @@ -361,7 +362,10 @@ CasContainerStrategy::ScrubStorage(ScrubContext& Ctx) // Let whomever it concerns know about the bad chunks. This could // be used to invalidate higher level data structures more efficiently // than a full validation pass might be able to do - Ctx.ReportBadCidChunks(BadKeys); + if (!BadKeys.empty()) + { + Ctx.ReportBadCidChunks(BadKeys); + } ZEN_INFO("compact cas scrubbed: {} chunks ({})", ChunkCount, NiceBytes(ChunkBytes)); } @@ -500,6 +504,12 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) GcCtx.AddDeletedCids(DeletedChunks); } +GcStorageSize +CasContainerStrategy::StorageSize() const +{ + return {.DiskSize = m_BlockStore.TotalSize()}; +} + void CasContainerStrategy::MakeIndexSnapshot() { |