diff options
| author | Stefan Boberg <[email protected]> | 2021-10-05 22:25:53 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-05 22:25:53 +0200 |
| commit | 20ac7384f8ca558f1fb933eda846604792240ea0 (patch) | |
| tree | e5c95b422b847af50b77807af916e389fcaf83aa /zenstore/filecas.cpp | |
| parent | stats: Mean returns zero when the count is zero (diff) | |
| download | zen-20ac7384f8ca558f1fb933eda846604792240ea0.tar.xz zen-20ac7384f8ca558f1fb933eda846604792240ea0.zip | |
Merged from upstream
Diffstat (limited to 'zenstore/filecas.cpp')
| -rw-r--r-- | zenstore/filecas.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp index 0b18848d5..ee641b80a 100644 --- a/zenstore/filecas.cpp +++ b/zenstore/filecas.cpp @@ -394,7 +394,8 @@ FileCasStrategy::Flush() void FileCasStrategy::Scrub(ScrubContext& Ctx) { - std::vector<IoHash> BadHashes; + std::vector<IoHash> BadHashes; + std::atomic<uint64_t> ChunkCount{0}, ChunkBytes{0}; IterateChunks([&](const IoHash& Hash, BasicFile& Payload) { IoHashStream Hasher; @@ -405,8 +406,13 @@ FileCasStrategy::Scrub(ScrubContext& Ctx) { BadHashes.push_back(Hash); } + + ++ChunkCount; + ChunkBytes.fetch_add(Payload.FileSize()); }); + Ctx.ReportScrubbed(ChunkCount, ChunkBytes); + if (!BadHashes.empty()) { ZEN_ERROR("file CAS scrubbing: {} bad chunks found", BadHashes.size()); @@ -428,7 +434,9 @@ FileCasStrategy::Scrub(ScrubContext& Ctx) } } - Ctx.ReportBadChunks(BadHashes); + Ctx.ReportBadCasChunks(BadHashes); + + ZEN_INFO("file CAS scrubbed: {} chunks ({})", ChunkCount.load(), NiceBytes(ChunkBytes)); } void |