[#796] cli: Fix object nodes command
Some checks failed
Build / Build Components (1.20) (pull_request) Successful in 2m43s
Build / Build Components (1.21) (pull_request) Successful in 3m46s
Vulncheck / Vulncheck (pull_request) Failing after 3m17s
Tests and linters / Lint (pull_request) Successful in 4m53s
Tests and linters / Staticcheck (pull_request) Successful in 6m27s
Tests and linters / Tests (1.20) (pull_request) Successful in 13m55s
Tests and linters / Tests (1.21) (pull_request) Successful in 14m52s
Tests and linters / Tests with -race (pull_request) Successful in 17m59s
DCO action / DCO (pull_request) Failing after 1m36s

Tombstone objects must be present on all container nodes.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>

# Conflicts:
#	cmd/frostfs-cli/modules/object/nodes.go
#
# It looks like you may be committing a cherry-pick.
# If this is not correct, please run
#	git update-ref -d CHERRY_PICK_HEAD
# and try again.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Thu Nov 9 13:33:59 2023 +0300
#
# On branch fix/zombie_object_supportv037
# You are currently cherry-picking commit 78cfb6ae.
#
# Changes to be committed:
#	modified:   cmd/frostfs-cli/modules/object/nodes.go
#
This commit is contained in:
Dmitrii Stepanov 2023-11-09 13:33:59 +03:00
parent 0dc7013844
commit 3131c3e3d5

View file

@ -34,7 +34,7 @@ type objectNodesInfo struct {
containerID cid.ID
objectID oid.ID
relatedObjectIDs []oid.ID
isLock bool
isLockOrTombstone bool
}
type boolError struct {
@ -103,7 +103,7 @@ func getObjectInfo(cmd *cobra.Command, cnrID cid.ID, objID oid.ID, cli *client.C
return &objectNodesInfo{
containerID: cnrID,
objectID: objID,
isLock: res.Header().Type() == objectSDK.TypeLock,
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
@ -213,7 +213,8 @@ func getRequiredPlacement(cmd *cobra.Command, objInfo *objectNodesInfo, placemen
}
func getActualPlacement(cmd *cobra.Command, netmap *netmapSDK.NetMap, requiredPlacement map[uint64]netmapSDK.NodeInfo,
pk *ecdsa.PrivateKey, objInfo *objectNodesInfo) map[uint64]boolError {
pk *ecdsa.PrivateKey, objInfo *objectNodesInfo,
) map[uint64]boolError {
result := make(map[uint64]boolError)
resultMtx := &sync.Mutex{}