Move changes from the support branch #129
2 changed files with 8 additions and 3 deletions
|
@ -127,7 +127,7 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
|
||||||
p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes)
|
p.processNodes(c, addrWithType, nn[i], policy.ReplicaNumberByIndex(i), checkedNodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.needLocalCopy {
|
if !c.needLocalCopy && c.removeLocalCopy {
|
||||||
p.log.Info("redundant local object copy detected",
|
p.log.Info("redundant local object copy detected",
|
||||||
zap.Stringer("object", addr),
|
zap.Stringer("object", addr),
|
||||||
)
|
)
|
||||||
|
@ -139,7 +139,11 @@ func (p *Policer) processObject(ctx context.Context, addrWithType objectcore.Add
|
||||||
type processPlacementContext struct {
|
type processPlacementContext struct {
|
||||||
context.Context
|
context.Context
|
||||||
|
|
||||||
|
// needLocalCopy is true if the current node must store an object according to the storage policy.
|
||||||
needLocalCopy bool
|
needLocalCopy bool
|
||||||
|
// removeLocalCopy is true if all copies are stored according to the storage policy
|
||||||
|
// and the current node doesn't need to store an object.
|
||||||
|
removeLocalCopy bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType objectcore.AddressWithType,
|
func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType objectcore.AddressWithType,
|
||||||
|
@ -242,9 +246,11 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType object
|
||||||
} else if uncheckedCopies > 0 {
|
} else if uncheckedCopies > 0 {
|
||||||
// If we have more copies than needed, but some of them are from the maintenance nodes,
|
// If we have more copies than needed, but some of them are from the maintenance nodes,
|
||||||
// save the local copy.
|
// save the local copy.
|
||||||
ctx.needLocalCopy = true
|
|
||||||
p.log.Debug("some of the copies are stored on nodes under maintenance, save local copy",
|
p.log.Debug("some of the copies are stored on nodes under maintenance, save local copy",
|
||||||
zap.Int("count", uncheckedCopies))
|
zap.Int("count", uncheckedCopies))
|
||||||
|
} else if uncheckedCopies == 0 {
|
||||||
|
// Safe to remove: checked all copies, shortage == 0.
|
||||||
|
ctx.removeLocalCopy = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,6 @@ func (s *Service) syncLoop(ctx context.Context) {
|
||||||
s.log.Error("could not calculate container nodes",
|
s.log.Error("could not calculate container nodes",
|
||||||
zap.Stringer("cid", cnr),
|
zap.Stringer("cid", cnr),
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
removed = append(removed, cnr)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue