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) {
|
func parseAttributes(c *cfg) {
|
||||||
if nodeconfig.Relay(c.appCfg) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fatalOnErr(attributes.ReadNodeAttributes(&c.cfgNodeInfo.localInfo, nodeconfig.Attributes(c.appCfg)))
|
fatalOnErr(attributes.ReadNodeAttributes(&c.cfgNodeInfo.localInfo, nodeconfig.Attributes(c.appCfg)))
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,7 +651,6 @@ type cfgNetmap struct {
|
||||||
|
|
||||||
state *networkState
|
state *networkState
|
||||||
|
|
||||||
needBootstrap bool
|
|
||||||
reBoostrapTurnedOff *atomic.Bool // managed by control service in runtime
|
reBoostrapTurnedOff *atomic.Bool // managed by control service in runtime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,11 +709,9 @@ func initCfg(appCfg *config.Config) *cfg {
|
||||||
|
|
||||||
key := nodeconfig.Key(appCfg)
|
key := nodeconfig.Key(appCfg)
|
||||||
|
|
||||||
relayOnly := nodeconfig.Relay(appCfg)
|
|
||||||
|
|
||||||
netState := newNetworkState()
|
netState := newNetworkState()
|
||||||
|
|
||||||
c.shared = initShared(appCfg, key, netState, relayOnly)
|
c.shared = initShared(appCfg, key, netState)
|
||||||
|
|
||||||
netState.metrics = c.metricsCollector
|
netState.metrics = c.metricsCollector
|
||||||
|
|
||||||
|
@ -734,7 +731,7 @@ func initCfg(appCfg *config.Config) *cfg {
|
||||||
|
|
||||||
c.cfgFrostfsID = initFrostfsID(appCfg)
|
c.cfgFrostfsID = initFrostfsID(appCfg)
|
||||||
|
|
||||||
c.cfgNetmap = initNetmap(appCfg, netState, relayOnly)
|
c.cfgNetmap = initNetmap(appCfg, netState)
|
||||||
|
|
||||||
c.cfgGRPC = initCfgGRPC()
|
c.cfgGRPC = initCfgGRPC()
|
||||||
|
|
||||||
|
@ -780,12 +777,8 @@ func initSdNotify(appCfg *config.Config) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func initShared(appCfg *config.Config, key *keys.PrivateKey, netState *networkState, relayOnly bool) shared {
|
func initShared(appCfg *config.Config, key *keys.PrivateKey, netState *networkState) shared {
|
||||||
var netAddr network.AddressGroup
|
netAddr := nodeconfig.BootstrapAddresses(appCfg)
|
||||||
|
|
||||||
if !relayOnly {
|
|
||||||
netAddr = nodeconfig.BootstrapAddresses(appCfg)
|
|
||||||
}
|
|
||||||
|
|
||||||
persistate, err := state.NewPersistentStorage(nodeconfig.PersistentState(appCfg).Path())
|
persistate, err := state.NewPersistentStorage(nodeconfig.PersistentState(appCfg).Path())
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
@ -836,18 +829,15 @@ func internalNetConfig(appCfg *config.Config, m metrics.MultinetMetrics) interna
|
||||||
return result
|
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)
|
netmapWorkerPool, err := ants.NewPool(notificationHandlerPoolSize)
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
|
||||||
var reBootstrapTurnedOff atomic.Bool
|
|
||||||
reBootstrapTurnedOff.Store(relayOnly)
|
|
||||||
return cfgNetmap{
|
return cfgNetmap{
|
||||||
scriptHash: contractsconfig.Netmap(appCfg),
|
scriptHash: contractsconfig.Netmap(appCfg),
|
||||||
state: netState,
|
state: netState,
|
||||||
workerPool: netmapWorkerPool,
|
workerPool: netmapWorkerPool,
|
||||||
needBootstrap: !relayOnly,
|
reBoostrapTurnedOff: &atomic.Bool{},
|
||||||
reBoostrapTurnedOff: &reBootstrapTurnedOff,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1256,11 +1246,6 @@ func (c *cfg) bootstrap(ctx context.Context) error {
|
||||||
return bootstrapOnline(ctx, c)
|
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 {
|
type dCmp struct {
|
||||||
name string
|
name string
|
||||||
reloadFunc func() error
|
reloadFunc func() error
|
||||||
|
|
|
@ -131,14 +131,6 @@ func Attributes(c *config.Config) (attrs []string) {
|
||||||
return
|
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"
|
// PersistentSessions returns structure that provides access to "persistent_sessions"
|
||||||
// subsection of "node" section.
|
// subsection of "node" section.
|
||||||
func PersistentSessions(c *config.Config) PersistentSessionsConfig {
|
func PersistentSessions(c *config.Config) PersistentSessionsConfig {
|
||||||
|
|
|
@ -29,12 +29,10 @@ func TestNodeSection(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
attribute := Attributes(empty)
|
attribute := Attributes(empty)
|
||||||
relay := Relay(empty)
|
|
||||||
persisessionsPath := PersistentSessions(empty).Path()
|
persisessionsPath := PersistentSessions(empty).Path()
|
||||||
persistatePath := PersistentState(empty).Path()
|
persistatePath := PersistentState(empty).Path()
|
||||||
|
|
||||||
require.Empty(t, attribute)
|
require.Empty(t, attribute)
|
||||||
require.Equal(t, false, relay)
|
|
||||||
require.Equal(t, "", persisessionsPath)
|
require.Equal(t, "", persisessionsPath)
|
||||||
require.Equal(t, PersistentStatePathDefault, persistatePath)
|
require.Equal(t, PersistentStatePathDefault, persistatePath)
|
||||||
})
|
})
|
||||||
|
@ -45,7 +43,6 @@ func TestNodeSection(t *testing.T) {
|
||||||
key := Key(c)
|
key := Key(c)
|
||||||
addrs := BootstrapAddresses(c)
|
addrs := BootstrapAddresses(c)
|
||||||
attributes := Attributes(c)
|
attributes := Attributes(c)
|
||||||
relay := Relay(c)
|
|
||||||
wKey := Wallet(c)
|
wKey := Wallet(c)
|
||||||
persisessionsPath := PersistentSessions(c).Path()
|
persisessionsPath := PersistentSessions(c).Path()
|
||||||
persistatePath := PersistentState(c).Path()
|
persistatePath := PersistentState(c).Path()
|
||||||
|
@ -87,8 +84,6 @@ func TestNodeSection(t *testing.T) {
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
require.Equal(t, true, relay)
|
|
||||||
|
|
||||||
require.Len(t, attributes, 2)
|
require.Len(t, attributes, 2)
|
||||||
require.Equal(t, "Price:11", attributes[0])
|
require.Equal(t, "Price:11", attributes[0])
|
||||||
require.Equal(t, "UN-LOCODE:RU MSK", attributes[1])
|
require.Equal(t, "UN-LOCODE:RU MSK", attributes[1])
|
||||||
|
|
|
@ -187,7 +187,7 @@ func addNewEpochNotificationHandlers(c *cfg) {
|
||||||
|
|
||||||
c.updateContractNodeInfo(ctx, e)
|
c.updateContractNodeInfo(ctx, e)
|
||||||
|
|
||||||
if !c.needBootstrap() || c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
if c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,14 +209,12 @@ func addNewEpochNotificationHandlers(c *cfg) {
|
||||||
// bootstrapNode adds current node to the Network map.
|
// bootstrapNode adds current node to the Network map.
|
||||||
// Must be called after initNetmapService.
|
// Must be called after initNetmapService.
|
||||||
func bootstrapNode(ctx context.Context, c *cfg) {
|
func bootstrapNode(ctx context.Context, c *cfg) {
|
||||||
if c.needBootstrap() {
|
if c.IsMaintenance() {
|
||||||
if c.IsMaintenance() {
|
c.log.Info(ctx, logs.FrostFSNodeNodeIsUnderMaintenanceSkipInitialBootstrap)
|
||||||
c.log.Info(ctx, logs.FrostFSNodeNodeIsUnderMaintenanceSkipInitialBootstrap)
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
err := c.bootstrap(ctx)
|
|
||||||
fatalOnErrDetails("bootstrap error", err)
|
|
||||||
}
|
}
|
||||||
|
err := c.bootstrap(ctx)
|
||||||
|
fatalOnErrDetails("bootstrap error", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addNetmapNotificationHandler(c *cfg, sTyp string, h event.Handler) {
|
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 {
|
func (c *cfg) SetNetmapStatus(ctx context.Context, st control.NetmapStatus) error {
|
||||||
switch st {
|
switch st {
|
||||||
default:
|
default:
|
||||||
|
@ -365,10 +361,6 @@ func (c *cfg) SetNetmapStatus(ctx context.Context, st control.NetmapStatus) erro
|
||||||
|
|
||||||
c.stopMaintenance(ctx)
|
c.stopMaintenance(ctx)
|
||||||
|
|
||||||
if !c.needBootstrap() {
|
|
||||||
return errRelayBootstrap
|
|
||||||
}
|
|
||||||
|
|
||||||
if st == control.NetmapStatus_ONLINE {
|
if st == control.NetmapStatus_ONLINE {
|
||||||
c.cfgNetmap.reBoostrapTurnedOff.Store(false)
|
c.cfgNetmap.reBoostrapTurnedOff.Store(false)
|
||||||
return bootstrapOnline(ctx, c)
|
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_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_0=Price:11
|
||||||
FROSTFS_NODE_ATTRIBUTE_1="UN-LOCODE:RU MSK"
|
FROSTFS_NODE_ATTRIBUTE_1="UN-LOCODE:RU MSK"
|
||||||
FROSTFS_NODE_RELAY=true
|
|
||||||
FROSTFS_NODE_PERSISTENT_SESSIONS_PATH=/sessions
|
FROSTFS_NODE_PERSISTENT_SESSIONS_PATH=/sessions
|
||||||
FROSTFS_NODE_PERSISTENT_STATE_PATH=/state
|
FROSTFS_NODE_PERSISTENT_STATE_PATH=/state
|
||||||
FROSTFS_NODE_LOCODE_DB_PATH=/path/to/locode/db
|
FROSTFS_NODE_LOCODE_DB_PATH=/path/to/locode/db
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
],
|
],
|
||||||
"attribute_0": "Price:11",
|
"attribute_0": "Price:11",
|
||||||
"attribute_1": "UN-LOCODE:RU MSK",
|
"attribute_1": "UN-LOCODE:RU MSK",
|
||||||
"relay": true,
|
|
||||||
"persistent_sessions": {
|
"persistent_sessions": {
|
||||||
"path": "/sessions"
|
"path": "/sessions"
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,6 @@ node:
|
||||||
- grpcs://localhost:8083
|
- grpcs://localhost:8083
|
||||||
attribute_0: "Price:11"
|
attribute_0: "Price:11"
|
||||||
attribute_1: UN-LOCODE:RU MSK
|
attribute_1: UN-LOCODE:RU MSK
|
||||||
relay: true # start Storage node in relay mode without bootstrapping into the Network map
|
|
||||||
persistent_sessions:
|
persistent_sessions:
|
||||||
path: /sessions # path to persistent session tokens file of Storage node (default: in-memory sessions)
|
path: /sessions # path to persistent session tokens file of Storage node (default: in-memory sessions)
|
||||||
persistent_state:
|
persistent_state:
|
||||||
|
@ -141,7 +140,6 @@ rpc:
|
||||||
max_ops: 10000
|
max_ops: 10000
|
||||||
|
|
||||||
storage:
|
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_ro_error_threshold: 100 # amount of errors to occur before shard is made read-only (default: 0, ignore errors)
|
||||||
|
|
||||||
shard:
|
shard:
|
||||||
|
|
|
@ -410,7 +410,6 @@ node:
|
||||||
- "Price:11"
|
- "Price:11"
|
||||||
- "UN-LOCODE:RU MSK"
|
- "UN-LOCODE:RU MSK"
|
||||||
- "key:value"
|
- "key:value"
|
||||||
relay: false
|
|
||||||
persistent_sessions:
|
persistent_sessions:
|
||||||
path: /sessions
|
path: /sessions
|
||||||
persistent_state:
|
persistent_state:
|
||||||
|
@ -424,7 +423,6 @@ node:
|
||||||
| `wallet` | [Wallet config](#wallet-subsection) | | Wallet configuration. Has no effect if `key` is provided. |
|
| `wallet` | [Wallet config](#wallet-subsection) | | Wallet configuration. Has no effect if `key` is provided. |
|
||||||
| `addresses` | `[]string` | | Addresses advertised in the netmap. |
|
| `addresses` | `[]string` | | Addresses advertised in the netmap. |
|
||||||
| `attribute` | `[]string` | | Node attributes as a list of key-value pairs in `<key>:<value>` format. |
|
| `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_sessions` | [Persistent sessions config](#persistent_sessions-subsection) | | Persistent session token store configuration. |
|
||||||
| `persistent_state` | [Persistent state config](#persistent_state-subsection) | | Persistent state 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. |
|
| `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