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
  • Loading branch information
carpawell authored Dec 6, 2024
2 parents a9cb16d + 8dd6a65 commit 2d77475
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ 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
- Local object PUT op with copies number set to 1 is allowed now (#3042)

### Removed

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

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

localNodeKey, err := p.keyStorage.GetKey(nil)
if err != nil {
Expand Down Expand Up @@ -170,15 +173,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 2d77475

Please sign in to comment.