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,16 +266,9 @@ func (s *Service) syncLoop(ctx context.Context) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ok := s.cnrMap[cnr]
|
|
||||||
if ok {
|
|
||||||
// known container; already in sync.
|
|
||||||
delete(s.cnrMap, cnr)
|
|
||||||
newMap[cnr] = struct{}{}
|
newMap[cnr] = struct{}{}
|
||||||
} else {
|
|
||||||
// unknown container; need to sync.
|
|
||||||
cnrsToSync = append(cnrsToSync, cnr)
|
cnrsToSync = append(cnrsToSync, cnr)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// sync new containers
|
// sync new containers
|
||||||
for _, cnr := range cnrsToSync {
|
for _, cnr := range cnrsToSync {
|
||||||
|
@ -287,14 +280,15 @@ func (s *Service) syncLoop(ctx context.Context) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark as synced
|
|
||||||
newMap[cnr] = struct{}{}
|
|
||||||
|
|
||||||
s.log.Debug("container trees have been synced", zap.Stringer("cid", cnr))
|
s.log.Debug("container trees have been synced", zap.Stringer("cid", cnr))
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove stored redundant trees
|
// remove stored redundant trees
|
||||||
for cnr := range s.cnrMap {
|
for cnr := range s.cnrMap {
|
||||||
|
if _, ok := newMap[cnr]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
s.log.Debug("removing redundant trees...", zap.Stringer("cid", cnr))
|
s.log.Debug("removing redundant trees...", zap.Stringer("cid", cnr))
|
||||||
|
|
||||||
err = s.DropTree(ctx, cnr, "")
|
err = s.DropTree(ctx, cnr, "")
|
||||||
|
|
Loading…
Reference in a new issue