forked from TrueCloudLab/frostfs-node
[#1689] node: Drop node.relay
config
It is not used and not tested properly, so drop it. Change-Id: I7c90c7391ecb4be17459415d209811ba1a693f7a Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
b0f39dca16
commit
5b6cba04cb
9 changed files with 12 additions and 58 deletions
|
@ -6,9 +6,5 @@ import (
|
|||
)
|
||||
|
||||
func parseAttributes(c *cfg) {
|
||||
if nodeconfig.Relay(c.appCfg) {
|
||||
return
|
||||
}
|
||||
|
||||
fatalOnErr(attributes.ReadNodeAttributes(&c.cfgNodeInfo.localInfo, nodeconfig.Attributes(c.appCfg)))
|
||||
}
|
||||
|
|
|
@ -651,7 +651,6 @@ type cfgNetmap struct {
|
|||
|
||||
state *networkState
|
||||
|
||||
needBootstrap bool
|
||||
reBoostrapTurnedOff *atomic.Bool // managed by control service in runtime
|
||||
}
|
||||
|
||||
|
@ -710,11 +709,9 @@ func initCfg(appCfg *config.Config) *cfg {
|
|||
|
||||
key := nodeconfig.Key(appCfg)
|
||||
|
||||
relayOnly := nodeconfig.Relay(appCfg)
|
||||
|
||||
netState := newNetworkState()
|
||||
|
||||
c.shared = initShared(appCfg, key, netState, relayOnly)
|
||||
c.shared = initShared(appCfg, key, netState)
|
||||
|
||||
netState.metrics = c.metricsCollector
|
||||
|
||||
|
@ -734,7 +731,7 @@ func initCfg(appCfg *config.Config) *cfg {
|
|||
|
||||
c.cfgFrostfsID = initFrostfsID(appCfg)
|
||||
|
||||
c.cfgNetmap = initNetmap(appCfg, netState, relayOnly)
|
||||
c.cfgNetmap = initNetmap(appCfg, netState)
|
||||
|
||||
c.cfgGRPC = initCfgGRPC()
|
||||
|
||||
|
@ -780,12 +777,8 @@ func initSdNotify(appCfg *config.Config) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func initShared(appCfg *config.Config, key *keys.PrivateKey, netState *networkState, relayOnly bool) shared {
|
||||
var netAddr network.AddressGroup
|
||||
|
||||
if !relayOnly {
|
||||
netAddr = nodeconfig.BootstrapAddresses(appCfg)
|
||||
}
|
||||
func initShared(appCfg *config.Config, key *keys.PrivateKey, netState *networkState) shared {
|
||||
netAddr := nodeconfig.BootstrapAddresses(appCfg)
|
||||
|
||||
persistate, err := state.NewPersistentStorage(nodeconfig.PersistentState(appCfg).Path())
|
||||
fatalOnErr(err)
|
||||
|
@ -836,18 +829,15 @@ func internalNetConfig(appCfg *config.Config, m metrics.MultinetMetrics) interna
|
|||
return result
|
||||
}
|
||||
|
||||
func initNetmap(appCfg *config.Config, netState *networkState, relayOnly bool) cfgNetmap {
|
||||
func initNetmap(appCfg *config.Config, netState *networkState) cfgNetmap {
|
||||
netmapWorkerPool, err := ants.NewPool(notificationHandlerPoolSize)
|
||||
fatalOnErr(err)
|
||||
|
||||
var reBootstrapTurnedOff atomic.Bool
|
||||
reBootstrapTurnedOff.Store(relayOnly)
|
||||
return cfgNetmap{
|
||||
scriptHash: contractsconfig.Netmap(appCfg),
|
||||
state: netState,
|
||||
workerPool: netmapWorkerPool,
|
||||
needBootstrap: !relayOnly,
|
||||
reBoostrapTurnedOff: &reBootstrapTurnedOff,
|
||||
reBoostrapTurnedOff: &atomic.Bool{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1256,11 +1246,6 @@ func (c *cfg) bootstrap(ctx context.Context) error {
|
|||
return bootstrapOnline(ctx, c)
|
||||
}
|
||||
|
||||
// needBootstrap checks if local node should be registered in network on bootup.
|
||||
func (c *cfg) needBootstrap() bool {
|
||||
return c.cfgNetmap.needBootstrap
|
||||
}
|
||||
|
||||
type dCmp struct {
|
||||
name string
|
||||
reloadFunc func() error
|
||||
|
|
|
@ -131,14 +131,6 @@ func Attributes(c *config.Config) (attrs []string) {
|
|||
return
|
||||
}
|
||||
|
||||
// Relay returns the value of "relay" config parameter
|
||||
// from "node" section.
|
||||
//
|
||||
// Returns false if the value is not set.
|
||||
func Relay(c *config.Config) bool {
|
||||
return config.BoolSafe(c.Sub(subsection), "relay")
|
||||
}
|
||||
|
||||
// PersistentSessions returns structure that provides access to "persistent_sessions"
|
||||
// subsection of "node" section.
|
||||
func PersistentSessions(c *config.Config) PersistentSessionsConfig {
|
||||
|
|
|
@ -29,12 +29,10 @@ func TestNodeSection(t *testing.T) {
|
|||
)
|
||||
|
||||
attribute := Attributes(empty)
|
||||
relay := Relay(empty)
|
||||
persisessionsPath := PersistentSessions(empty).Path()
|
||||
persistatePath := PersistentState(empty).Path()
|
||||
|
||||
require.Empty(t, attribute)
|
||||
require.Equal(t, false, relay)
|
||||
require.Equal(t, "", persisessionsPath)
|
||||
require.Equal(t, PersistentStatePathDefault, persistatePath)
|
||||
})
|
||||
|
@ -45,7 +43,6 @@ func TestNodeSection(t *testing.T) {
|
|||
key := Key(c)
|
||||
addrs := BootstrapAddresses(c)
|
||||
attributes := Attributes(c)
|
||||
relay := Relay(c)
|
||||
wKey := Wallet(c)
|
||||
persisessionsPath := PersistentSessions(c).Path()
|
||||
persistatePath := PersistentState(c).Path()
|
||||
|
@ -87,8 +84,6 @@ func TestNodeSection(t *testing.T) {
|
|||
return false
|
||||
})
|
||||
|
||||
require.Equal(t, true, relay)
|
||||
|
||||
require.Len(t, attributes, 2)
|
||||
require.Equal(t, "Price:11", attributes[0])
|
||||
require.Equal(t, "UN-LOCODE:RU MSK", attributes[1])
|
||||
|
|
|
@ -187,7 +187,7 @@ func addNewEpochNotificationHandlers(c *cfg) {
|
|||
|
||||
c.updateContractNodeInfo(ctx, e)
|
||||
|
||||
if !c.needBootstrap() || c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
||||
if c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -209,14 +209,12 @@ func addNewEpochNotificationHandlers(c *cfg) {
|
|||
// bootstrapNode adds current node to the Network map.
|
||||
// Must be called after initNetmapService.
|
||||
func bootstrapNode(ctx context.Context, c *cfg) {
|
||||
if c.needBootstrap() {
|
||||
if c.IsMaintenance() {
|
||||
c.log.Info(ctx, logs.FrostFSNodeNodeIsUnderMaintenanceSkipInitialBootstrap)
|
||||
return
|
||||
}
|
||||
err := c.bootstrap(ctx)
|
||||
fatalOnErrDetails("bootstrap error", err)
|
||||
if c.IsMaintenance() {
|
||||
c.log.Info(ctx, logs.FrostFSNodeNodeIsUnderMaintenanceSkipInitialBootstrap)
|
||||
return
|
||||
}
|
||||
err := c.bootstrap(ctx)
|
||||
fatalOnErrDetails("bootstrap error", err)
|
||||
}
|
||||
|
||||
func addNetmapNotificationHandler(c *cfg, sTyp string, h event.Handler) {
|
||||
|
@ -352,8 +350,6 @@ func addNewEpochAsyncNotificationHandler(c *cfg, h event.Handler) {
|
|||
)
|
||||
}
|
||||
|
||||
var errRelayBootstrap = errors.New("setting netmap status is forbidden in relay mode")
|
||||
|
||||
func (c *cfg) SetNetmapStatus(ctx context.Context, st control.NetmapStatus) error {
|
||||
switch st {
|
||||
default:
|
||||
|
@ -365,10 +361,6 @@ func (c *cfg) SetNetmapStatus(ctx context.Context, st control.NetmapStatus) erro
|
|||
|
||||
c.stopMaintenance(ctx)
|
||||
|
||||
if !c.needBootstrap() {
|
||||
return errRelayBootstrap
|
||||
}
|
||||
|
||||
if st == control.NetmapStatus_ONLINE {
|
||||
c.cfgNetmap.reBoostrapTurnedOff.Store(false)
|
||||
return bootstrapOnline(ctx, c)
|
||||
|
|
|
@ -22,7 +22,6 @@ FROSTFS_NODE_WALLET_PASSWORD=password
|
|||
FROSTFS_NODE_ADDRESSES="s01.frostfs.devenv:8080 /dns4/s02.frostfs.devenv/tcp/8081 grpc://127.0.0.1:8082 grpcs://localhost:8083"
|
||||
FROSTFS_NODE_ATTRIBUTE_0=Price:11
|
||||
FROSTFS_NODE_ATTRIBUTE_1="UN-LOCODE:RU MSK"
|
||||
FROSTFS_NODE_RELAY=true
|
||||
FROSTFS_NODE_PERSISTENT_SESSIONS_PATH=/sessions
|
||||
FROSTFS_NODE_PERSISTENT_STATE_PATH=/state
|
||||
FROSTFS_NODE_LOCODE_DB_PATH=/path/to/locode/db
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
],
|
||||
"attribute_0": "Price:11",
|
||||
"attribute_1": "UN-LOCODE:RU MSK",
|
||||
"relay": true,
|
||||
"persistent_sessions": {
|
||||
"path": "/sessions"
|
||||
},
|
||||
|
|
|
@ -34,7 +34,6 @@ node:
|
|||
- grpcs://localhost:8083
|
||||
attribute_0: "Price:11"
|
||||
attribute_1: UN-LOCODE:RU MSK
|
||||
relay: true # start Storage node in relay mode without bootstrapping into the Network map
|
||||
persistent_sessions:
|
||||
path: /sessions # path to persistent session tokens file of Storage node (default: in-memory sessions)
|
||||
persistent_state:
|
||||
|
@ -141,7 +140,6 @@ rpc:
|
|||
max_ops: 10000
|
||||
|
||||
storage:
|
||||
# note: shard configuration can be omitted for relay node (see `node.relay`)
|
||||
shard_ro_error_threshold: 100 # amount of errors to occur before shard is made read-only (default: 0, ignore errors)
|
||||
|
||||
shard:
|
||||
|
|
|
@ -410,7 +410,6 @@ node:
|
|||
- "Price:11"
|
||||
- "UN-LOCODE:RU MSK"
|
||||
- "key:value"
|
||||
relay: false
|
||||
persistent_sessions:
|
||||
path: /sessions
|
||||
persistent_state:
|
||||
|
@ -424,7 +423,6 @@ node:
|
|||
| `wallet` | [Wallet config](#wallet-subsection) | | Wallet configuration. Has no effect if `key` is provided. |
|
||||
| `addresses` | `[]string` | | Addresses advertised in the netmap. |
|
||||
| `attribute` | `[]string` | | Node attributes as a list of key-value pairs in `<key>:<value>` format. |
|
||||
| `relay` | `bool` | | Enable relay mode. |
|
||||
| `persistent_sessions` | [Persistent sessions config](#persistent_sessions-subsection) | | Persistent session token store configuration. |
|
||||
| `persistent_state` | [Persistent state config](#persistent_state-subsection) | | Persistent state configuration. |
|
||||
| `locode_db_path` | `string` | empty | Path to UN/LOCODE [database](https://git.frostfs.info/TrueCloudLab/frostfs-locode-db/) for FrostFS. |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue