forked from TrueCloudLab/frostfs-node
[#1765] Use hex format to print storage node ID
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
5a2daadd37
commit
8714fc42b5
13 changed files with 19 additions and 25 deletions
|
@ -29,6 +29,7 @@ Changelog for NeoFS Node
|
||||||
- Unify help messages in CLI (#1854)
|
- Unify help messages in CLI (#1854)
|
||||||
- `evacuate`, `set-mode` and `flush-cache` control subcommands now accept a list of shard ids (#1867)
|
- `evacuate`, `set-mode` and `flush-cache` control subcommands now accept a list of shard ids (#1867)
|
||||||
- Reading `object` commands of NeoFS CLI don't open remote sessions (#1865)
|
- Reading `object` commands of NeoFS CLI don't open remote sessions (#1865)
|
||||||
|
- Use hex format to print storage node ID (#1765)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Description of command `netmap nodeinfo` (#1821)
|
- Description of command `netmap nodeinfo` (#1821)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/mr-tron/base58"
|
|
||||||
nodeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/node"
|
nodeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/node"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||||
|
@ -110,7 +110,7 @@ func (n notificationWriter) Notify(topic string, address oid.Address) {
|
||||||
func initNotifications(c *cfg) {
|
func initNotifications(c *cfg) {
|
||||||
if nodeconfig.Notification(c.appCfg).Enabled() {
|
if nodeconfig.Notification(c.appCfg).Enabled() {
|
||||||
topic := nodeconfig.Notification(c.appCfg).DefaultTopic()
|
topic := nodeconfig.Notification(c.appCfg).DefaultTopic()
|
||||||
pubKey := base58.Encode(c.cfgNodeInfo.localInfo.PublicKey())
|
pubKey := hex.EncodeToString(c.cfgNodeInfo.localInfo.PublicKey())
|
||||||
|
|
||||||
if topic == "" {
|
if topic == "" {
|
||||||
topic = pubKey
|
topic = pubKey
|
||||||
|
|
4
go.mod
4
go.mod
|
@ -17,9 +17,9 @@ require (
|
||||||
github.com/nspcc-dev/hrw v1.0.9
|
github.com/nspcc-dev/hrw v1.0.9
|
||||||
github.com/nspcc-dev/neo-go v0.99.2
|
github.com/nspcc-dev/neo-go v0.99.2
|
||||||
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220809123759-3094d3e0c14b // indirect
|
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220809123759-3094d3e0c14b // indirect
|
||||||
github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20221004142957-5fc2644c680d
|
github.com/nspcc-dev/neofs-api-go/v2 v2.13.2-0.20221005093543-3a91383f24a9
|
||||||
github.com/nspcc-dev/neofs-contract v0.15.5-0.20220930133158-d95bc535894c
|
github.com/nspcc-dev/neofs-contract v0.15.5-0.20220930133158-d95bc535894c
|
||||||
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20221005093951-1325b4f27218
|
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.6.0.20221013072718-21eef1ae7f7d
|
||||||
github.com/nspcc-dev/tzhash v1.6.1
|
github.com/nspcc-dev/tzhash v1.6.1
|
||||||
github.com/panjf2000/ants/v2 v2.4.0
|
github.com/panjf2000/ants/v2 v2.4.0
|
||||||
github.com/paulmach/orb v0.2.2
|
github.com/paulmach/orb v0.2.2
|
||||||
|
|
BIN
go.sum
BIN
go.sum
Binary file not shown.
|
@ -3,7 +3,6 @@ package audit
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
|
||||||
|
|
||||||
clientcore "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
clientcore "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||||
netmapcore "github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
netmapcore "github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||||
|
@ -134,7 +133,7 @@ func (ap *Processor) findStorageGroups(cnr cid.ID, shuffled netmapcore.Nodes) []
|
||||||
for i := range shuffled { // consider iterating over some part of container
|
for i := range shuffled { // consider iterating over some part of container
|
||||||
log := ap.log.With(
|
log := ap.log.With(
|
||||||
zap.Stringer("cid", cnr),
|
zap.Stringer("cid", cnr),
|
||||||
zap.String("key", hex.EncodeToString(shuffled[0].PublicKey())),
|
zap.String("key", netmap.StringifyPublicKey(shuffled[0])),
|
||||||
zap.Int("try", i),
|
zap.Int("try", i),
|
||||||
zap.Int("total_tries", ln),
|
zap.Int("total_tries", ln),
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,6 @@ package netmap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||||
|
@ -50,7 +49,7 @@ func (c *cleanupTable) update(snapshot netmap.NetMap, now uint64) {
|
||||||
for i := range nmNodes {
|
for i := range nmNodes {
|
||||||
binNodeInfo := nmNodes[i].Marshal()
|
binNodeInfo := nmNodes[i].Marshal()
|
||||||
|
|
||||||
keyString := hex.EncodeToString(nmNodes[i].PublicKey())
|
keyString := netmap.StringifyPublicKey(nmNodes[i])
|
||||||
|
|
||||||
access, ok := c.lastAccess[keyString]
|
access, ok := c.lastAccess[keyString]
|
||||||
if ok {
|
if ok {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package netmap
|
package netmap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
|
@ -30,7 +29,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
for i := range infos {
|
for i := range infos {
|
||||||
binNodeInfo := infos[i].Marshal()
|
binNodeInfo := infos[i].Marshal()
|
||||||
|
|
||||||
mapInfos[hex.EncodeToString(infos[i].PublicKey())] = binNodeInfo
|
mapInfos[netmap.StringifyPublicKey(infos[i])] = binNodeInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run("update", func(t *testing.T) {
|
t.Run("update", func(t *testing.T) {
|
||||||
|
@ -47,7 +46,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run("update with flagged", func(t *testing.T) {
|
t.Run("update with flagged", func(t *testing.T) {
|
||||||
key := hex.EncodeToString(infos[0].PublicKey())
|
key := netmap.StringifyPublicKey(infos[0])
|
||||||
c.flag(key)
|
c.flag(key)
|
||||||
|
|
||||||
c.update(networkMap, 2)
|
c.update(networkMap, 2)
|
||||||
|
@ -60,7 +59,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
c := newCleanupTable(true, 1)
|
c := newCleanupTable(true, 1)
|
||||||
c.update(networkMap, 1)
|
c.update(networkMap, 1)
|
||||||
|
|
||||||
key := hex.EncodeToString(infos[1].PublicKey())
|
key := netmap.StringifyPublicKey(infos[1])
|
||||||
require.False(t, c.touch(key, 11, mapInfos[key]))
|
require.False(t, c.touch(key, 11, mapInfos[key]))
|
||||||
require.EqualValues(t, 11, c.lastAccess[key].epoch)
|
require.EqualValues(t, 11, c.lastAccess[key].epoch)
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
c := newCleanupTable(true, 1)
|
c := newCleanupTable(true, 1)
|
||||||
c.update(networkMap, 1)
|
c.update(networkMap, 1)
|
||||||
|
|
||||||
key := hex.EncodeToString(infos[1].PublicKey())
|
key := netmap.StringifyPublicKey(infos[1])
|
||||||
c.flag(key)
|
c.flag(key)
|
||||||
require.True(t, c.lastAccess[key].removeFlag)
|
require.True(t, c.lastAccess[key].removeFlag)
|
||||||
|
|
||||||
|
@ -113,7 +112,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
|
|
||||||
t.Run("some nodes to remove", func(t *testing.T) {
|
t.Run("some nodes to remove", func(t *testing.T) {
|
||||||
cnt := 0
|
cnt := 0
|
||||||
key := hex.EncodeToString(infos[1].PublicKey())
|
key := netmap.StringifyPublicKey(infos[1])
|
||||||
|
|
||||||
require.True(t, c.touch(key, 4, mapInfos[key])) // one node was updated
|
require.True(t, c.touch(key, 4, mapInfos[key])) // one node was updated
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
||||||
// marshal updated node info structure
|
// marshal updated node info structure
|
||||||
nodeInfoBinary := nodeInfo.Marshal()
|
nodeInfoBinary := nodeInfo.Marshal()
|
||||||
|
|
||||||
keyString := hex.EncodeToString(nodeInfo.PublicKey())
|
keyString := netmap.StringifyPublicKey(nodeInfo)
|
||||||
|
|
||||||
updated := np.netmapSnapshot.touch(keyString, np.epochState.EpochCounter(), nodeInfoBinary)
|
updated := np.netmapSnapshot.touch(keyString, np.epochState.EpochCounter(), nodeInfoBinary)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package innerring
|
||||||
import (
|
import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"encoding/hex"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
@ -309,7 +308,7 @@ func (s *Server) handleSubnetRemoval(e event.Event) {
|
||||||
func (s *Server) processCandidate(txHash neogoutil.Uint256, removedID subnetid.ID, c netmap.NodeInfo) {
|
func (s *Server) processCandidate(txHash neogoutil.Uint256, removedID subnetid.ID, c netmap.NodeInfo) {
|
||||||
removeSubnet := false
|
removeSubnet := false
|
||||||
log := s.log.With(
|
log := s.log.With(
|
||||||
zap.String("public_key", hex.EncodeToString(c.PublicKey())),
|
zap.String("public_key", netmap.StringifyPublicKey(c)),
|
||||||
zap.String("removed_subnet", removedID.String()),
|
zap.String("removed_subnet", removedID.String()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package auditor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -143,7 +142,7 @@ func (c *Context) collectHashes(p *gamePair) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log.Debug("could not get payload range hash",
|
c.log.Debug("could not get payload range hash",
|
||||||
zap.Stringer("id", p.id),
|
zap.Stringer("id", p.id),
|
||||||
zap.String("node", hex.EncodeToString(n.PublicKey())),
|
zap.String("node", netmap.StringifyPublicKey(n)),
|
||||||
zap.String("error", err.Error()),
|
zap.String("error", err.Error()),
|
||||||
)
|
)
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -2,12 +2,12 @@ package auditor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/util/rand"
|
"github.com/nspcc-dev/neofs-node/pkg/util/rand"
|
||||||
containerSDK "github.com/nspcc-dev/neofs-sdk-go/container"
|
containerSDK "github.com/nspcc-dev/neofs-sdk-go/container"
|
||||||
|
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||||
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||||
storagegroupSDK "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
|
storagegroupSDK "github.com/nspcc-dev/neofs-sdk-go/storagegroup"
|
||||||
"github.com/nspcc-dev/tzhash/tz"
|
"github.com/nspcc-dev/tzhash/tz"
|
||||||
|
@ -83,7 +83,7 @@ func (c *Context) checkStorageGroupPoR(sgID oid.ID, sg storagegroupSDK.StorageGr
|
||||||
hdr, err := c.cnrCom.GetHeader(getHeaderPrm)
|
hdr, err := c.cnrCom.GetHeader(getHeaderPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log.Debug("can't head object",
|
c.log.Debug("can't head object",
|
||||||
zap.String("remote_node", hex.EncodeToString(flat[j].PublicKey())),
|
zap.String("remote_node", netmap.StringifyPublicKey(flat[j])),
|
||||||
zap.Stringer("oid", members[i]),
|
zap.Stringer("oid", members[i]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package policer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
||||||
|
@ -153,7 +152,7 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr oid.Address,
|
||||||
shortage--
|
shortage--
|
||||||
|
|
||||||
p.log.Debug("consider node under maintenance as OK",
|
p.log.Debug("consider node under maintenance as OK",
|
||||||
zap.String("node", hex.EncodeToString(node.PublicKey())),
|
zap.String("node", netmap.StringifyPublicKey(node)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package replicator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||||
putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put"
|
putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put"
|
||||||
|
@ -49,7 +48,7 @@ func (p *Replicator) HandleTask(ctx context.Context, task Task, res TaskResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
log := p.log.With(
|
log := p.log.With(
|
||||||
zap.String("node", hex.EncodeToString(task.nodes[i].PublicKey())),
|
zap.String("node", netmap.StringifyPublicKey(task.nodes[i])),
|
||||||
zap.Stringer("object", task.addr),
|
zap.Stringer("object", task.addr),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue