forked from TrueCloudLab/frostfs-node
[#1442] services/tree: Fix log message for failed Apply
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
01d2e06a9b
commit
3caa982283
1 changed files with 7 additions and 11 deletions
|
@ -4,18 +4,15 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
clientcore "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/pilorama"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
||||
cidSDK "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
netmapSDK "github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type movePair struct {
|
||||
|
@ -62,24 +59,23 @@ func (s *Service) replicate(ctx context.Context, op movePair) error {
|
|||
return fmt.Errorf("can't get container nodes: %w", err)
|
||||
}
|
||||
|
||||
var node clientcore.NodeInfo
|
||||
for _, n := range nodes {
|
||||
if bytes.Equal(n.PublicKey(), s.rawPub) {
|
||||
continue
|
||||
}
|
||||
|
||||
var lastErr error
|
||||
var lastAddr string
|
||||
|
||||
n.IterateNetworkEndpoints(func(addr string) bool {
|
||||
cc, err := grpc.DialContext(ctx, addr)
|
||||
lastAddr = addr
|
||||
|
||||
c, err := dialTreeService(ctx, addr)
|
||||
if err != nil {
|
||||
lastErr = err
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO cache clients
|
||||
c := NewTreeServiceClient(cc)
|
||||
|
||||
_, lastErr = c.Apply(ctx, req)
|
||||
return lastErr == nil
|
||||
})
|
||||
|
@ -87,8 +83,8 @@ func (s *Service) replicate(ctx context.Context, op movePair) error {
|
|||
if lastErr != nil {
|
||||
s.log.Warn("failed to sent update to the node",
|
||||
zap.String("last_error", lastErr.Error()),
|
||||
zap.String("address", network.StringifyGroup(node.AddressGroup())),
|
||||
zap.String("key", base64.StdEncoding.EncodeToString(node.PublicKey())))
|
||||
zap.String("address", lastAddr),
|
||||
zap.String("key", hex.EncodeToString(n.PublicKey())))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue