diff options
| author | Per Larsson <[email protected]> | 2021-12-13 19:46:36 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-12-13 19:46:36 +0100 |
| commit | 3e666bec6605931114c1d78d48bffeeb75e3e61b (patch) | |
| tree | c8db57d3f2f7f9d6947ad6a6f8ac0b38289e4f77 /zenstore/cidstore.cpp | |
| parent | Fixed bug in z$ GC. (diff) | |
| download | zen-3e666bec6605931114c1d78d48bffeeb75e3e61b.tar.xz zen-3e666bec6605931114c1d78d48bffeeb75e3e61b.zip | |
Remove Cid to CAS chunk mapping after GC.
Diffstat (limited to 'zenstore/cidstore.cpp')
| -rw-r--r-- | zenstore/cidstore.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/zenstore/cidstore.cpp b/zenstore/cidstore.cpp index 4ddf34c79..33dc216b5 100644 --- a/zenstore/cidstore.cpp +++ b/zenstore/cidstore.cpp @@ -233,6 +233,27 @@ struct CidStore::Impl Ctx.ReportBadCasChunks(BadChunks); } + void RemoveCids(CasChunkSet& CasChunks) + { + RwLock::ExclusiveLockScope _(m_Lock); + + for (auto It = m_CidMap.begin(), End = m_CidMap.end(); It != End;) + { + if (CasChunks.ContainsChunk(It->second)) + { + const IoHash& BadHash = It->first; + + // Log a tombstone record + LogMapping(BadHash, IoHash::Zero); + It = m_CidMap.erase(It); + } + else + { + ++It; + } + } + } + uint64_t m_LastScrubTime = 0; }; @@ -289,6 +310,12 @@ CidStore::Scrub(ScrubContext& Ctx) m_Impl->Scrub(Ctx); } +void +CidStore::RemoveCids(CasChunkSet& CasChunks) +{ + m_Impl->RemoveCids(CasChunks); +} + CasStoreSize CidStore::CasSize() const { |