diff options
| author | Dan Engelbrecht <[email protected]> | 2024-11-15 10:06:39 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-11-15 10:06:39 +0100 |
| commit | aca6f56fde841454b13ed18136008b0ffe946aed (patch) | |
| tree | 3770efa6c789b45de8ea3ec426da7a77e7813775 /src/zenstore/cache/cachedisklayer.cpp | |
| parent | fixed some issues with ZenServerInstance::SpawnServer (#218) (diff) | |
| download | zen-aca6f56fde841454b13ed18136008b0ffe946aed.tar.xz zen-aca6f56fde841454b13ed18136008b0ffe946aed.zip | |
oplog prep gc fix (#216)
- Added option gc-validation to zenserver that does a check for missing references in all oplog post full GC. Enabled by default.
- Feature: Added option gc-validation to zen gc command to control reference validation. Enabled by default.
- Added more details in post GC log.
- Fixed race condition in oplog writes which could cause used attachments to be incorrectly removed by GC
Diffstat (limited to 'src/zenstore/cache/cachedisklayer.cpp')
| -rw-r--r-- | src/zenstore/cache/cachedisklayer.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index 4aafb9828..93b639a51 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -3454,6 +3454,12 @@ ZenCacheDiskLayer::CacheBucket::CreateReferenceCheckers(GcCtx& Ctx) return {new DiskBucketReferenceChecker(*this)}; } +std::vector<GcReferenceValidator*> +ZenCacheDiskLayer::CacheBucket::CreateReferenceValidators(GcCtx& /*Ctx*/) +{ + return {}; +} + void ZenCacheDiskLayer::CacheBucket::CompactState(RwLock::ExclusiveLockScope&, std::vector<BucketPayload>& Payloads, @@ -3594,12 +3600,10 @@ ZenCacheDiskLayer::GetOrCreateBucket(std::string_view InBucket) CacheBucket* Result = Bucket.get(); m_Buckets.emplace(BucketName, std::move(Bucket)); - m_UpdateCaptureLock.WithExclusiveLock([&]() { - if (m_CapturedBuckets) - { - m_CapturedBuckets->push_back(std::string(BucketName)); - } - }); + if (m_CapturedBuckets) + { + m_CapturedBuckets->push_back(std::string(BucketName)); + } return Result; } @@ -4176,7 +4180,7 @@ ZenCacheDiskLayer::GetGcReferencerLocks() void ZenCacheDiskLayer::EnableUpdateCapture() { - m_UpdateCaptureLock.WithExclusiveLock([&]() { + m_Lock.WithExclusiveLock([&]() { if (m_UpdateCaptureRefCounter == 0) { ZEN_ASSERT(!m_CapturedBuckets); @@ -4193,7 +4197,7 @@ ZenCacheDiskLayer::EnableUpdateCapture() void ZenCacheDiskLayer::DisableUpdateCapture() { - m_UpdateCaptureLock.WithExclusiveLock([&]() { + m_Lock.WithExclusiveLock([&]() { ZEN_ASSERT(m_CapturedBuckets); ZEN_ASSERT(m_UpdateCaptureRefCounter > 0); m_UpdateCaptureRefCounter--; @@ -4205,9 +4209,8 @@ ZenCacheDiskLayer::DisableUpdateCapture() } std::vector<std::string> -ZenCacheDiskLayer::GetCapturedBuckets() +ZenCacheDiskLayer::GetCapturedBucketsLocked() { - RwLock::SharedLockScope _(m_UpdateCaptureLock); if (m_CapturedBuckets) { return *m_CapturedBuckets; |