forked from TrueCloudLab/frostfs-node
[#1474] neofs-node/config: Remove "shard_num" from the "grpc" section
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>experimental
parent
73a88c2965
commit
c41d9c3fbe
|
@ -15,36 +15,40 @@ const (
|
||||||
ShardPoolSizeDefault = 20
|
ShardPoolSizeDefault = 20
|
||||||
)
|
)
|
||||||
|
|
||||||
// IterateShards iterates over subsections ["0":"N") (N - "shard_num" value)
|
// IterateShards iterates over subsections of "shard" subsection of "storage" section of c,
|
||||||
// of "shard" subsection of "storage" section of c, wrap them into
|
// wrap them into shardconfig.Config and passes to f.
|
||||||
// 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.
|
// Panics if N is not a positive number while shards are required.
|
||||||
func IterateShards(c *config.Config, required bool, f func(*shardconfig.Config)) {
|
func IterateShards(c *config.Config, required bool, f func(*shardconfig.Config)) {
|
||||||
c = c.Sub(subsection)
|
c = c.Sub(subsection)
|
||||||
|
|
||||||
num := config.Uint(c, "shard_num")
|
|
||||||
if num == 0 {
|
|
||||||
if required {
|
|
||||||
panic("no shard configured")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
def := c.Sub("default")
|
def := c.Sub("default")
|
||||||
c = c.Sub("shard")
|
c = c.Sub("shard")
|
||||||
|
|
||||||
for i := uint64(0); i < num; i++ {
|
i := uint64(0)
|
||||||
|
for ; ; i++ {
|
||||||
si := strconv.FormatUint(i, 10)
|
si := strconv.FormatUint(i, 10)
|
||||||
|
|
||||||
sc := shardconfig.From(
|
sc := shardconfig.From(
|
||||||
c.Sub(si),
|
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)
|
(*config.Config)(sc).SetDefault(def)
|
||||||
|
|
||||||
f(sc)
|
f(sc)
|
||||||
}
|
}
|
||||||
|
if i == 0 && required {
|
||||||
|
panic("no shard configured")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShardPoolSize returns the value of "shard_pool_size" config parameter from "storage" section.
|
// ShardPoolSize returns the value of "shard_pool_size" config parameter from "storage" section.
|
||||||
|
|
|
@ -74,7 +74,6 @@ NEOFS_OBJECT_PUT_POOL_SIZE_REMOTE=100
|
||||||
|
|
||||||
# Storage engine section
|
# Storage engine section
|
||||||
NEOFS_STORAGE_SHARD_POOL_SIZE=15
|
NEOFS_STORAGE_SHARD_POOL_SIZE=15
|
||||||
NEOFS_STORAGE_SHARD_NUM=2
|
|
||||||
NEOFS_STORAGE_SHARD_RO_ERROR_THRESHOLD=100
|
NEOFS_STORAGE_SHARD_RO_ERROR_THRESHOLD=100
|
||||||
## 0 shard
|
## 0 shard
|
||||||
### Flag to refill Metabase from BlobStor
|
### Flag to refill Metabase from BlobStor
|
||||||
|
|
|
@ -120,7 +120,6 @@
|
||||||
},
|
},
|
||||||
"storage": {
|
"storage": {
|
||||||
"shard_pool_size": 15,
|
"shard_pool_size": 15,
|
||||||
"shard_num": 2,
|
|
||||||
"shard_ro_error_threshold": 100,
|
"shard_ro_error_threshold": 100,
|
||||||
"shard": {
|
"shard": {
|
||||||
"0": {
|
"0": {
|
||||||
|
|
|
@ -103,7 +103,6 @@ object:
|
||||||
storage:
|
storage:
|
||||||
# note: shard configuration can be omitted for relay node (see `node.relay`)
|
# 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_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)
|
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
|
default: # section with the default shard parameters
|
||||||
resync_metabase: true # sync metabase with blobstor on start, expensive, leave false until complete understanding
|
resync_metabase: true # sync metabase with blobstor on start, expensive, leave false until complete understanding
|
||||||
|
|
Loading…
Reference in New Issue