From e5c304536b89d4b9f9e4267d10dae108c61c78ac Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 12 Dec 2022 14:38:41 +0300 Subject: [PATCH] [#2161] pilorama: Do not apply already existing operations Speeds up synchronization a bit. Signed-off-by: Evgenii Stratonikov --- CHANGELOG.md | 1 + pkg/local_object_storage/pilorama/boltdb.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc38e4b..abf1aa01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Changelog for NeoFS Node - `neofs-cli container delete` command pre-checks container ownership (#2106) - Policer cache size is now 1024 (#2158) - Tree service now synchronizes with container nodes in a random order (#2127) +- Pilorama no longer tries to apply already applied operations (#2161) ### Fixed - Open FSTree in sync mode by default (#1992) diff --git a/pkg/local_object_storage/pilorama/boltdb.go b/pkg/local_object_storage/pilorama/boltdb.go index 35cd23e8..d6a7d676 100644 --- a/pkg/local_object_storage/pilorama/boltdb.go +++ b/pkg/local_object_storage/pilorama/boltdb.go @@ -299,6 +299,12 @@ func (t *boltForest) applyOperation(logBucket, treeBucket *bbolt.Bucket, lm *Log var tmp LogMove var cKey [17]byte + var logKey [8]byte + binary.BigEndian.PutUint64(logKey[:], lm.Time) + if logBucket.Get(logKey[:]) != nil { + return nil + } + c := logBucket.Cursor() key, value := c.Last()