[#1120] cli: Fix object nodes
for linking objects
Do not use linking objects to get placement for complex object. Linking objects should be stored on all container nodes, also they are not required. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
ada1b9f737
commit
654384990c
2 changed files with 13 additions and 8 deletions
|
@ -109,9 +109,11 @@ func getPhyObjects(cmd *cobra.Command, cnrID cid.ID, objID oid.ID, cli *client.C
|
|||
res, err := internalclient.HeadObject(cmd.Context(), prmHead)
|
||||
if err == nil {
|
||||
obj := phyObject{
|
||||
containerID: cnrID,
|
||||
objectID: objID,
|
||||
storedOnAllContainerNodes: res.Header().Type() == objectSDK.TypeLock || res.Header().Type() == objectSDK.TypeTombstone,
|
||||
containerID: cnrID,
|
||||
objectID: objID,
|
||||
storedOnAllContainerNodes: res.Header().Type() == objectSDK.TypeLock ||
|
||||
res.Header().Type() == objectSDK.TypeTombstone ||
|
||||
len(res.Header().Children()) > 0,
|
||||
}
|
||||
if res.Header().ECHeader() != nil {
|
||||
obj.ecHeader = &ecHeader{
|
||||
|
@ -143,7 +145,7 @@ func getComplexObjectParts(cmd *cobra.Command, cnrID cid.ID, objID oid.ID, cli *
|
|||
func getCompexObjectMembers(cmd *cobra.Command, cnrID cid.ID, objID oid.ID, cli *client.Client, prmHead internalclient.HeadObjectPrm, errSplitInfo *objectSDK.SplitInfoError) []oid.ID {
|
||||
splitInfo := errSplitInfo.SplitInfo()
|
||||
|
||||
if members, ok := tryGetSplitMembersByLinkingObject(cmd, splitInfo, prmHead, cnrID); ok {
|
||||
if members, ok := tryGetSplitMembersByLinkingObject(cmd, splitInfo, prmHead, cnrID, false); ok {
|
||||
return members
|
||||
}
|
||||
|
||||
|
@ -412,6 +414,7 @@ func isObjectStoredOnNode(ctx context.Context, cmd *cobra.Command, cnrID cid.ID,
|
|||
if errors.As(err, ¬Found) || errors.As(err, &removed) {
|
||||
return false, nil
|
||||
}
|
||||
cmd.Printf("failed to get object %s from client\n", objID.EncodeToString())
|
||||
return false, err
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID,
|
|||
|
||||
splitInfo := errSplit.SplitInfo()
|
||||
|
||||
if members, ok := tryGetSplitMembersByLinkingObject(cmd, splitInfo, prmHead, cnr); ok {
|
||||
if members, ok := tryGetSplitMembersByLinkingObject(cmd, splitInfo, prmHead, cnr, true); ok {
|
||||
return members
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID,
|
|||
return tryRestoreChainInReverse(cmd, splitInfo, prmHead, cli, cnr, obj)
|
||||
}
|
||||
|
||||
func tryGetSplitMembersByLinkingObject(cmd *cobra.Command, splitInfo *objectSDK.SplitInfo, prmHead internal.HeadObjectPrm, cnr cid.ID) ([]oid.ID, bool) {
|
||||
func tryGetSplitMembersByLinkingObject(cmd *cobra.Command, splitInfo *objectSDK.SplitInfo, prmHead internal.HeadObjectPrm, cnr cid.ID, withLinking bool) ([]oid.ID, bool) {
|
||||
// collect split chain by the descending ease of operations (ease is evaluated heuristically).
|
||||
// If any approach fails, we don't try the next since we assume that it will fail too.
|
||||
|
||||
|
@ -402,8 +402,10 @@ func tryGetSplitMembersByLinkingObject(cmd *cobra.Command, splitInfo *objectSDK.
|
|||
|
||||
common.PrintVerbose(cmd, "Received split members from the linking object: %v", children)
|
||||
|
||||
// include linking object
|
||||
return append(children, idLinking), true
|
||||
if withLinking {
|
||||
return append(children, idLinking), true
|
||||
}
|
||||
return children, true
|
||||
}
|
||||
|
||||
// linking object is not required for
|
||||
|
|
Loading…
Reference in a new issue