[#1474] neofs-node/config: Remove "shard_num" from the "grpc" section

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-02 17:19:56 +03:00 committed by LeL
parent 73a88c2965
commit c41d9c3fbe
4 changed files with 17 additions and 16 deletions

View file

@ -15,36 +15,40 @@ const (
ShardPoolSizeDefault = 20
)
// IterateShards iterates over subsections ["0":"N") (N - "shard_num" value)
// of "shard" subsection of "storage" section of c, wrap them into
// shardconfig.Config and passes to f.
// IterateShards iterates over subsections of "shard" subsection of "storage" section of c,
// wrap them into shardconfig.Config and passes to f.
//
// Section names are expected to be consecutive integer numbers, starting from 0.
//
// Panics if N is not a positive number while shards are required.
func IterateShards(c *config.Config, required bool, f func(*shardconfig.Config)) {
c = c.Sub(subsection)
num := config.Uint(c, "shard_num")
if num == 0 {
if required {
panic("no shard configured")
}
return
}
def := c.Sub("default")
c = c.Sub("shard")
for i := uint64(0); i < num; i++ {
i := uint64(0)
for ; ; i++ {
si := strconv.FormatUint(i, 10)
sc := shardconfig.From(
c.Sub(si),
)
// Path for the blobstor can't be present in the default section, because different shards
// must have different paths, so if it is missing, the shard is not here.
// At the same time checking for "blobstor" section doesn't work proper
// with configuration via the environment.
if (*config.Config)(sc).Value("blobstor.path") == nil {
break
}
(*config.Config)(sc).SetDefault(def)
f(sc)
}
if i == 0 && required {
panic("no shard configured")
}
}
// ShardPoolSize returns the value of "shard_pool_size" config parameter from "storage" section.

View file

@ -74,7 +74,6 @@ NEOFS_OBJECT_PUT_POOL_SIZE_REMOTE=100
# Storage engine section
NEOFS_STORAGE_SHARD_POOL_SIZE=15
NEOFS_STORAGE_SHARD_NUM=2
NEOFS_STORAGE_SHARD_RO_ERROR_THRESHOLD=100
## 0 shard
### Flag to refill Metabase from BlobStor

View file

@ -120,7 +120,6 @@
},
"storage": {
"shard_pool_size": 15,
"shard_num": 2,
"shard_ro_error_threshold": 100,
"shard": {
"0": {

View file

@ -103,7 +103,6 @@ object:
storage:
# note: shard configuration can be omitted for relay node (see `node.relay`)
shard_pool_size: 15 # size of per-shard worker pools used for PUT operations
shard_num: 2 # total number of shards
shard_ro_error_threshold: 100 # amount of errors to occur before shard is made read-only (default: 0, ignore errors)
default: # section with the default shard parameters
resync_metabase: true # sync metabase with blobstor on start, expensive, leave false until complete understanding