diff --git a/pool/object_put_pool_transformer.go b/pool/object_put_pool_transformer.go index e596aeb..fd6ab28 100644 --- a/pool/object_put_pool_transformer.go +++ b/pool/object_put_pool_transformer.go @@ -2,6 +2,7 @@ package pool import ( "context" + "fmt" sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" @@ -166,5 +167,5 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b } return true, nil } - return true, err + return true, fmt.Errorf("try put single '%s': %w", it.address, err) } diff --git a/pool/pool.go b/pool/pool.go index 1f69577..02b4976 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -2670,6 +2670,10 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error { prmCtx.useDefaultSession() prmCtx.useVerb(session.VerbObjectDelete) prmCtx.useAddress(prm.addr) + cp, err := p.connection() + if err != nil { + return err + } if prm.stoken == nil { // collect phy objects only if we are about to open default session var tokens relations.Tokens @@ -2677,7 +2681,7 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error { relatives, err := relations.ListAllRelations(ctx, p, prm.addr.Container(), prm.addr.Object(), tokens) if err != nil { - return fmt.Errorf("failed to collect relatives: %w", err) + return fmt.Errorf("failed to collect relatives via client %s: %w", cp.address(), err) } if len(relatives) != 0 { @@ -2691,7 +2695,7 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error { var cc callContext cc.sessionTarget = prm.UseSession - err := p.initCallContext(&cc, prm.prmCommon, prmCtx) + err = p.initCallContext(&cc, prm.prmCommon, prmCtx) if err != nil { return err } @@ -3197,6 +3201,10 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok var addr oid.Address addr.SetContainer(cnrID) addr.SetObject(objID) + cp, err := p.connection() + if err != nil { + return nil, err + } var prm PrmObjectHead prm.SetAddress(addr) @@ -3208,7 +3216,7 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok } prm.MarkRaw() - _, err := p.HeadObject(ctx, prm) + _, err = p.HeadObject(ctx, prm) var errSplit *object.SplitInfoError var errECInfo *object.ECInfoError @@ -3219,7 +3227,7 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok case err == nil || errors.As(err, &errECInfo): return nil, relations.ErrNoSplitInfo default: - return nil, fmt.Errorf("failed to get raw object header: %w", err) + return nil, fmt.Errorf("failed to get raw object header by addr: %s %w", cp.address(), err) } } @@ -3228,6 +3236,10 @@ func (p *Pool) ListChildrenByLinker(ctx context.Context, cnrID cid.ID, objID oid var addr oid.Address addr.SetContainer(cnrID) addr.SetObject(objID) + cp, err := p.connection() + if err != nil { + return nil, err + } var prm PrmObjectHead prm.SetAddress(addr) @@ -3240,7 +3252,7 @@ func (p *Pool) ListChildrenByLinker(ctx context.Context, cnrID cid.ID, objID oid res, err := p.HeadObject(ctx, prm) if err != nil { - return nil, fmt.Errorf("failed to get linking object's header: %w", err) + return nil, fmt.Errorf("failed to get linking object's header by addr: %s %w", cp.address(), err) } return res.Children(), nil @@ -3251,6 +3263,10 @@ func (p *Pool) GetLeftSibling(ctx context.Context, cnrID cid.ID, objID oid.ID, t var addr oid.Address addr.SetContainer(cnrID) addr.SetObject(objID) + cp, err := p.connection() + if err != nil { + return oid.ID{}, err + } var prm PrmObjectHead prm.SetAddress(addr) @@ -3263,7 +3279,7 @@ func (p *Pool) GetLeftSibling(ctx context.Context, cnrID cid.ID, objID oid.ID, t res, err := p.HeadObject(ctx, prm) if err != nil { - return oid.ID{}, fmt.Errorf("failed to read split chain member's header: %w", err) + return oid.ID{}, fmt.Errorf("failed to read split chain member's header by addr: %s %w", cp.address(), err) } idMember, ok := res.PreviousID() @@ -3287,10 +3303,14 @@ func (p *Pool) FindSiblingBySplitID(ctx context.Context, cnrID cid.ID, splitID * if tokens.Session != nil { prm.UseSession(*tokens.Session) } + cp, err := p.connection() + if err != nil { + return nil, err + } res, err := p.SearchObjects(ctx, prm) if err != nil { - return nil, fmt.Errorf("failed to search objects by split ID: %w", err) + return nil, fmt.Errorf("failed to search objects by split ID by addr %s: %w", cp.address(), err) } var members []oid.ID @@ -3299,7 +3319,7 @@ func (p *Pool) FindSiblingBySplitID(ctx context.Context, cnrID cid.ID, splitID * return false }) if err != nil { - return nil, fmt.Errorf("failed to iterate found objects: %w", err) + return nil, fmt.Errorf("failed to iterate found objects by addr %s: %w", cp.address(), err) } return members, nil @@ -3319,10 +3339,14 @@ func (p *Pool) FindSiblingByParentID(ctx context.Context, cnrID cid.ID, objID oi if tokens.Session != nil { prm.UseSession(*tokens.Session) } + cp, err := p.connection() + if err != nil { + return nil, err + } resSearch, err := p.SearchObjects(ctx, prm) if err != nil { - return nil, fmt.Errorf("failed to find object children: %w", err) + return nil, fmt.Errorf("failed to find object children by addr %s: %w", cp.address(), err) } var res []oid.ID @@ -3331,7 +3355,7 @@ func (p *Pool) FindSiblingByParentID(ctx context.Context, cnrID cid.ID, objID oi return false }) if err != nil { - return nil, fmt.Errorf("failed to iterate found objects: %w", err) + return nil, fmt.Errorf("failed to iterate found objects by addr %s: %w", cp.address(), err) } return res, nil diff --git a/pool/tree/pool.go b/pool/tree/pool.go index ddfdc0e..b9de34e 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -657,7 +657,7 @@ func (p *Pool) Close() error { for _, group := range p.innerPools { for _, cl := range group.clients { if closeErr := cl.close(); closeErr != nil { - p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr)) + p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr), zap.String("addr", cl.endpoint())) err = closeErr } } @@ -676,7 +676,7 @@ func (p *Pool) closeClientMapConnections() (err error) { for _, cl := range p.clientMap { if closeErr := cl.close(); closeErr != nil { - p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr)) + p.log(zapcore.ErrorLevel, "close client connection", zap.Error(closeErr), zap.String("addr", cl.endpoint())) err = closeErr } } @@ -962,7 +962,7 @@ LOOP: treeCl, err = p.getNewTreeClient(ctx, cnrNode) if err != nil { finErr = finalError(finErr, err) - p.log(zap.DebugLevel, "failed to create tree client", zap.String("request_id", reqID), zap.Int("remaining attempts", attempts)) + p.log(zap.DebugLevel, "failed to create tree client", zap.String("request_id", reqID), zap.Int("remaining attempts", attempts), zap.String("addr", treeCl.endpoint())) continue }