aboutsummaryrefslogtreecommitdiff
path: root/zenstore
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-04-26 13:36:02 +0200
committerGitHub <[email protected]>2022-04-26 13:36:02 +0200
commitf7476199742256fed6f867afb6db8cecdacfe547 (patch)
tree43cc47fdc9fea18668e7f6ce95f9a84851fa33dc /zenstore
parentCompute tweaks (#78) (diff)
downloadzen-f7476199742256fed6f867afb6db8cecdacfe547.tar.xz
zen-f7476199742256fed6f867afb6db8cecdacfe547.zip
Batch log removal of Cid and take proper lock when modifying m_CidMap (#80)v1.0.0.4
* Batch log removal of Cid and take proper lock when modifying m_CidMap * variable name casing * Don't access m_Buckets without a lock
Diffstat (limited to 'zenstore')
-rw-r--r--zenstore/cidstore.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/zenstore/cidstore.cpp b/zenstore/cidstore.cpp
index 509d21abe..55bec817f 100644
--- a/zenstore/cidstore.cpp
+++ b/zenstore/cidstore.cpp
@@ -234,23 +234,22 @@ struct CidStore::Impl
void RemoveCids(CasChunkSet& CasChunks)
{
- RwLock::ExclusiveLockScope _(m_Lock);
-
- for (auto It = m_CidMap.begin(), End = m_CidMap.end(); It != End;)
+ std::vector<IndexEntry> RemovedEntries;
+ RemovedEntries.reserve(CasChunks.GetSize());
{
- if (CasChunks.ContainsChunk(It->second))
- {
- const IoHash& BadHash = It->first;
-
- // Log a tombstone record
- LogMapping(BadHash, IoHash::Zero);
- It = m_CidMap.erase(It);
- }
- else
+ RwLock::ExclusiveLockScope _(m_Lock);
+ for (auto It = m_CidMap.begin(), End = m_CidMap.end(); It != End;)
{
+ if (CasChunks.ContainsChunk(It->second))
+ {
+ RemovedEntries.push_back({It->first, IoHash::Zero});
+ It = m_CidMap.erase(It);
+ continue;
+ }
++It;
}
}
+ m_LogFile.Append(RemovedEntries);
}
uint64_t m_LastScrubTime = 0;