diff options
| author | Stefan Boberg <[email protected]> | 2021-10-04 15:27:45 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-04 15:27:45 +0200 |
| commit | 2356411f391ae65544ef1cd3810945f3ebf8e8dc (patch) | |
| tree | cc838ddc32d7e6198af7b2f6532c7d686040e216 /zenstore | |
| parent | monitoring: added stubs for /stats and /status endpoints (diff) | |
| download | zen-2356411f391ae65544ef1cd3810945f3ebf8e8dc.tar.xz zen-2356411f391ae65544ef1cd3810945f3ebf8e8dc.zip | |
zenserver: Changed initialization flow
- HTTP server is now started earlier, so it can be queried while scrubbing/recovery runs
- Stats/status services are initialized before anything else, so they can be used to monitor progress while scrubbing happens
- Structured cache initialization is now in a separate function
- Scrubbing now emits some summary stats at the point of completion
Diffstat (limited to 'zenstore')
| -rw-r--r-- | zenstore/cidstore.cpp | 2 | ||||
| -rw-r--r-- | zenstore/compactcas.cpp | 2 | ||||
| -rw-r--r-- | zenstore/filecas.cpp | 12 |
3 files changed, 12 insertions, 4 deletions
diff --git a/zenstore/cidstore.cpp b/zenstore/cidstore.cpp index df5c32d25..7a5d7bcf4 100644 --- a/zenstore/cidstore.cpp +++ b/zenstore/cidstore.cpp @@ -204,7 +204,7 @@ struct CidStore::Impl // TODO: Should compute a snapshot index here - Ctx.ReportBadChunks(BadChunks); + Ctx.ReportBadCasChunks(BadChunks); } uint64_t m_LastScrubTime = 0; diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index 5fc3ac356..612f87c7c 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -254,7 +254,7 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx) // be used to invalidate higher level data structures more efficiently // than a full validation pass might be able to do - Ctx.ReportBadChunks(BadChunkHashes); + Ctx.ReportBadCasChunks(BadChunkHashes); } void 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 |