[#796] cli: Fix object nodes command
DCO action / DCO (pull_request) Successful in 2m23s Details
Vulncheck / Vulncheck (pull_request) Successful in 2m55s Details
Build / Build Components (1.21) (pull_request) Successful in 4m18s Details
Build / Build Components (1.20) (pull_request) Successful in 4m22s Details
Tests and linters / Tests (1.21) (pull_request) Successful in 6m2s Details
Tests and linters / Lint (pull_request) Successful in 6m11s Details
Tests and linters / Staticcheck (pull_request) Successful in 5m55s Details
Tests and linters / Tests (1.20) (pull_request) Successful in 6m29s Details
Tests and linters / Tests with -race (pull_request) Successful in 7m47s Details

Tombstone objects must be present on all container nodes.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
pull/796/head
Dmitrii Stepanov 2023-11-09 13:33:59 +03:00
parent 0f75e48138
commit 78cfb6aea8
1 changed files with 8 additions and 8 deletions

View File

@ -31,10 +31,10 @@ const (
)
type objectNodesInfo struct {
containerID cid.ID
objectID oid.ID
relatedObjectIDs []oid.ID
isLock bool
containerID cid.ID
objectID oid.ID
relatedObjectIDs []oid.ID
isLockOrTombstone bool
}
type boolError struct {
@ -101,9 +101,9 @@ func getObjectInfo(cmd *cobra.Command, cnrID cid.ID, objID oid.ID, cli *client.C
res, err := internalclient.HeadObject(cmd.Context(), prmHead)
if err == nil {
return &objectNodesInfo{
containerID: cnrID,
objectID: objID,
isLock: res.Header().Type() == objectSDK.TypeLock,
containerID: cnrID,
objectID: objID,
isLockOrTombstone: res.Header().Type() == objectSDK.TypeLock || res.Header().Type() == objectSDK.TypeTombstone,
}
}
@ -191,7 +191,7 @@ func getRequiredPlacement(cmd *cobra.Command, objInfo *objectNodesInfo, placemen
numOfReplicas := placementPolicy.ReplicaNumberByIndex(repIdx)
var nodeIdx uint32
for _, n := range rep {
if !objInfo.isLock && nodeIdx == numOfReplicas { // lock object should be on all container nodes
if !objInfo.isLockOrTombstone && nodeIdx == numOfReplicas { // lock and tombstone objects should be on all container nodes
break
}
nodes[n.Hash()] = n