Skip to content

Commit

Permalink
node/object: Fix Put op condition checking requests with copies number
Browse files Browse the repository at this point in the history
Regression from 5076fe2.

Previously, the operation always failed on in-container nodes for
requests with specified number of copies. Actually, it must fail
requests with TTL=1 regardless of container composition.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Dec 4, 2024
1 parent f831c75 commit 5a972a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog for NeoFS Node

### Fixed
- Fail gracefully on error from config validation (#3037)
- False-negative object PUT from container node with set copies number (#3042)

### Changed

Expand Down
9 changes: 5 additions & 4 deletions pkg/services/object/put/streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func (p *Streamer) initTarget(prm *PutInitPrm) error {
}

func (p *Streamer) preparePrm(prm *PutInitPrm) error {
localOnly := prm.common.LocalOnly()
if localOnly && prm.copiesNumber > 0 {
return errors.New("storage of multiple object replicas is requested for a local operation")
}
var err error

localNodeKey, err := p.keyStorage.GetKey(nil)
Expand Down Expand Up @@ -170,15 +174,12 @@ nextSet:
for j := range cnrNodes[i] {
prm.localNodeInContainer = p.neoFSNet.IsLocalNodePublicKey(cnrNodes[i][j].PublicKey())
if prm.localNodeInContainer {
if prm.copiesNumber > 0 {
return errors.New("storage of multiple object replicas is requested for a local operation")
}
prm.localNodePos[0], prm.localNodePos[1] = i, j
break nextSet
}
}
}
if !prm.localNodeInContainer && prm.common.LocalOnly() {
if !prm.localNodeInContainer && localOnly {
return errors.New("local operation on the node not compliant with the container storage policy")
}

Expand Down

0 comments on commit 5a972a4

Please sign in to comment.