[#51] add address to logs
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
749b4e9ab5
commit
0039a8fcac
4 changed files with 11 additions and 10 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1646,7 +1646,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 %w", relations.ErrNoSplitInfo)
|
||||
default:
|
||||
return nil, fmt.Errorf("failed to get raw object header: %w", err)
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@ func (c *treeClient) dial(ctx context.Context) error {
|
|||
var err error
|
||||
c.client, err = c.createClient()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("couldn't dial '%s': %w", c.address, err)
|
||||
}
|
||||
|
||||
if _, err = rpcapi.Healthcheck(c.client, &tree.HealthcheckRequest{}, rpcclient.WithContext(ctx)); err != nil {
|
||||
return fmt.Errorf("healthcheck tree service: %w", err)
|
||||
return fmt.Errorf("healthcheck tree service '%s': %w", c.address, err)
|
||||
}
|
||||
|
||||
c.healthy = true
|
||||
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ func (p *Pool) Dial(ctx context.Context) error {
|
|||
for j, node := range nodes {
|
||||
clients[j] = newTreeClient(node.Address(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout)
|
||||
if err := clients[j].dial(ctx); err != nil {
|
||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", node.Address()), zap.Error(err))
|
||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.Error(err))
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*tre
|
|||
|
||||
newTreeCl := newTreeClient(addr.URIAddr(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout)
|
||||
if err = newTreeCl.dial(ctx); err != nil {
|
||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.String("address", addr.URIAddr()), zap.Error(err))
|
||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.Error(err))
|
||||
|
||||
// We have to close connection here after failed `dial()`.
|
||||
// This is NOT necessary in object pool and regular tree pool without netmap support, because:
|
||||
|
@ -1103,7 +1103,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
|
||||
|
|
Loading…
Add table
Reference in a new issue