forked from TrueCloudLab/frostfs-node
[#845] node: Configure Object PUT remote and local pools separately
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ee20200c2e
commit
0e3e8db5c0
6 changed files with 27 additions and 10 deletions
|
@ -435,12 +435,12 @@ func initObjectPool(cfg *config.Config) (pool cfgObjectRoutines) {
|
|||
|
||||
optNonBlocking := ants.WithNonblocking(true)
|
||||
|
||||
pool.putRemote, err = ants.NewPool(objectconfig.Put(cfg).PoolSize(), optNonBlocking)
|
||||
pool.putRemote, err = ants.NewPool(objectconfig.Put(cfg).PoolSizeRemote(), optNonBlocking)
|
||||
if err != nil {
|
||||
fatalOnErr(err)
|
||||
}
|
||||
|
||||
pool.putLocal, err = ants.NewPool(objectconfig.Put(cfg).PoolSize(), optNonBlocking)
|
||||
pool.putLocal, err = ants.NewPool(objectconfig.Put(cfg).PoolSizeLocal(), optNonBlocking)
|
||||
if err != nil {
|
||||
fatalOnErr(err)
|
||||
}
|
||||
|
|
|
@ -28,11 +28,23 @@ func Put(c *config.Config) PutConfig {
|
|||
}
|
||||
}
|
||||
|
||||
// PoolSize returns value of "pool_size" config parameter.
|
||||
// PoolSizeRemote returns value of "pool_size_remote" config parameter.
|
||||
//
|
||||
// Returns PutPoolSizeDefault if value is not positive number.
|
||||
func (g PutConfig) PoolSize() int {
|
||||
v := config.Int(g.cfg, "pool_size")
|
||||
func (g PutConfig) PoolSizeRemote() int {
|
||||
v := config.Int(g.cfg, "pool_size_remote")
|
||||
if v > 0 {
|
||||
return int(v)
|
||||
}
|
||||
|
||||
return PutPoolSizeDefault
|
||||
}
|
||||
|
||||
// PoolSizeLocal returns value of "pool_size_local" config parameter.
|
||||
//
|
||||
// Returns PutPoolSizeDefault if value is not positive number.
|
||||
func (g PutConfig) PoolSizeLocal() int {
|
||||
v := config.Int(g.cfg, "pool_size_local")
|
||||
if v > 0 {
|
||||
return int(v)
|
||||
}
|
||||
|
|
|
@ -13,13 +13,15 @@ func TestObjectSection(t *testing.T) {
|
|||
t.Run("defaults", func(t *testing.T) {
|
||||
empty := configtest.EmptyConfig()
|
||||
|
||||
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSize())
|
||||
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeRemote())
|
||||
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeLocal())
|
||||
})
|
||||
|
||||
const path = "../../../../config/example/node"
|
||||
|
||||
var fileConfigTest = func(c *config.Config) {
|
||||
require.Equal(t, 100, objectconfig.Put(c).PoolSize())
|
||||
require.Equal(t, 100, objectconfig.Put(c).PoolSizeRemote())
|
||||
require.Equal(t, 101, objectconfig.Put(c).PoolSizeLocal())
|
||||
}
|
||||
|
||||
configtest.ForEachFileType(path, fileConfigTest)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue