forked from TrueCloudLab/frostfs-node
[#2165] services/tree: Always synchronize all containers
In case of split-brain we must synchronize everything. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d3054e577a
commit
de9957e076
1 changed files with 6 additions and 12 deletions
|
@ -266,15 +266,8 @@ func (s *Service) syncLoop(ctx context.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
_, ok := s.cnrMap[cnr]
|
||||
if ok {
|
||||
// known container; already in sync.
|
||||
delete(s.cnrMap, cnr)
|
||||
newMap[cnr] = struct{}{}
|
||||
} else {
|
||||
// unknown container; need to sync.
|
||||
cnrsToSync = append(cnrsToSync, cnr)
|
||||
}
|
||||
newMap[cnr] = struct{}{}
|
||||
cnrsToSync = append(cnrsToSync, cnr)
|
||||
}
|
||||
|
||||
// sync new containers
|
||||
|
@ -287,14 +280,15 @@ func (s *Service) syncLoop(ctx context.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
// mark as synced
|
||||
newMap[cnr] = struct{}{}
|
||||
|
||||
s.log.Debug("container trees have been synced", zap.Stringer("cid", cnr))
|
||||
}
|
||||
|
||||
// remove stored redundant trees
|
||||
for cnr := range s.cnrMap {
|
||||
if _, ok := newMap[cnr]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
s.log.Debug("removing redundant trees...", zap.Stringer("cid", cnr))
|
||||
|
||||
err = s.DropTree(ctx, cnr, "")
|
||||
|
|
Loading…
Reference in a new issue