[#51] add address to logs
All checks were successful
Code generation / Generate proto (pull_request) Successful in 31s
DCO / DCO (pull_request) Successful in 31s
Tests and linters / Tests (pull_request) Successful in 47s
Tests and linters / Lint (pull_request) Successful in 1m53s

Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
Pavel Pogodaev 2025-01-24 12:41:07 +03:00
parent c3f7378887
commit ed6e71bfe2
4 changed files with 24 additions and 10 deletions

View file

@ -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"
@ -134,7 +135,7 @@ func (it *internalTarget) putAsStream(ctx context.Context, o *object.Object) err
it.res.OID = res.StoredObjectID()
it.res.Epoch = res.StoredEpoch()
}
return err
return fmt.Errorf("put as stream '%s': %w", it.address, err)
}
func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (bool, error) {
@ -151,7 +152,7 @@ func (it *internalTarget) tryPutSingle(ctx context.Context, o *object.Object) (b
res, err := it.client.ObjectPutSingle(ctx, cliPrm)
if err != nil && status.Code(err) == codes.Unimplemented {
return false, err
return false, fmt.Errorf("address '%s': %w", it.address, err)
}
if err == nil {
@ -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)
}

View file

@ -2769,7 +2769,7 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (object.Object
err := p.initCallContext(&cc, prm.prmCommon, prmContext{})
if err != nil {
return obj, err
return obj, fmt.Errorf("head object : %w", err)
}
return obj, p.call(ctx, &cc, func() error {
@ -3197,6 +3197,7 @@ 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, _ := p.connection()
var prm PrmObjectHead
prm.SetAddress(addr)
@ -3217,7 +3218,7 @@ func (p *Pool) GetSplitInfo(ctx context.Context, cnrID cid.ID, objID oid.ID, tok
case errors.As(err, &errSplit):
return errSplit.SplitInfo(), nil
case err == nil || errors.As(err, &errECInfo):
return nil, relations.ErrNoSplitInfo
return nil, fmt.Errorf("failed to get raw object header via client %s %w", cp.address(), relations.ErrNoSplitInfo)
default:
return nil, fmt.Errorf("failed to get raw object header: %w", err)
}
@ -3251,6 +3252,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)
@ -3268,7 +3273,7 @@ func (p *Pool) GetLeftSibling(ctx context.Context, cnrID cid.ID, objID oid.ID, t
idMember, ok := res.PreviousID()
if !ok {
return oid.ID{}, relations.ErrNoLeftSibling
return oid.ID{}, fmt.Errorf("address '%s' %w", cp.address(), relations.ErrNoLeftSibling)
}
return idMember, nil
}
@ -3287,6 +3292,10 @@ 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 {
@ -3299,7 +3308,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,6 +3328,10 @@ 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 {
@ -3331,7 +3344,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

View file

@ -127,5 +127,5 @@ func (c *treeClient) close() error {
if c.client == nil || c.client.Conn() == nil {
return nil
}
return c.client.Conn().Close()
return fmt.Errorf("address '%s', %w", c.address, c.client.Conn().Close())
}

View file

@ -1039,7 +1039,7 @@ func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*tre
// - regular tree pool is going to reuse connection by calling `redialIfNecessary()`.
// Tree pool with netmap support does not operate with background goroutine, so we have to close connection immediately.
if err = newTreeCl.close(); err != nil {
p.log(zap.WarnLevel, "failed to close recently dialed tree client", zap.String("address", addr.URIAddr()), zap.Error(err))
p.log(zap.WarnLevel, "failed to close recently dialed tree client", zap.Error(err))
}
return false