forked from TrueCloudLab/frostfs-node
[#473] Do not modify traverse plan when [0]
copies number vector is provided
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
b520a3049e
commit
c6df6c84ae
1 changed files with 7 additions and 1 deletions
|
@ -97,10 +97,16 @@ func NewTraverser(opts ...Option) (*Traverser, error) {
|
|||
} else {
|
||||
rem = defaultCopiesVector(cfg.policy)
|
||||
|
||||
// compatibleZeroVector is a bool flag which is set when cfg.copyNumbers
|
||||
// is [0]. In this case we should not modify `rem` slice unless track
|
||||
// copies are ignored, because [0] means that all copies should be
|
||||
// stored before returning OK to the client.
|
||||
compatibleZeroVector := len(cfg.copyNumbers) == 1 && cfg.copyNumbers[0] == 0
|
||||
|
||||
for i := range rem {
|
||||
if !cfg.trackCopies {
|
||||
rem[i] = -1
|
||||
} else if len(cfg.copyNumbers) > i {
|
||||
} else if len(cfg.copyNumbers) > i && !compatibleZeroVector {
|
||||
rem[i] = int(cfg.copyNumbers[i])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue