forked from TrueCloudLab/frostfs-node
[#983] blobstor: Allow to specify wait before drop time
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
1c504dca5c
commit
702351a5d1
7 changed files with 45 additions and 15 deletions
|
@ -178,12 +178,13 @@ type subStorageCfg struct {
|
||||||
noSync bool
|
noSync bool
|
||||||
|
|
||||||
// blobovnicza-specific
|
// blobovnicza-specific
|
||||||
size uint64
|
size uint64
|
||||||
width uint64
|
width uint64
|
||||||
leafWidth uint64
|
leafWidth uint64
|
||||||
openedCacheSize int
|
openedCacheSize int
|
||||||
initWorkerCount int
|
initWorkerCount int
|
||||||
initInAdvance bool
|
initInAdvance bool
|
||||||
|
rebuildDropTimeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// readConfig fills applicationConfiguration with raw configuration values
|
// readConfig fills applicationConfiguration with raw configuration values
|
||||||
|
@ -303,6 +304,7 @@ func (a *applicationConfiguration) setShardStorageConfig(newConfig *shardCfg, ol
|
||||||
sCfg.openedCacheSize = sub.OpenedCacheSize()
|
sCfg.openedCacheSize = sub.OpenedCacheSize()
|
||||||
sCfg.initWorkerCount = sub.InitWorkerCount()
|
sCfg.initWorkerCount = sub.InitWorkerCount()
|
||||||
sCfg.initInAdvance = sub.InitInAdvance()
|
sCfg.initInAdvance = sub.InitInAdvance()
|
||||||
|
sCfg.rebuildDropTimeout = sub.RebuildDropTimeout()
|
||||||
case fstree.Type:
|
case fstree.Type:
|
||||||
sub := fstreeconfig.From((*config.Config)(storagesCfg[i]))
|
sub := fstreeconfig.From((*config.Config)(storagesCfg[i]))
|
||||||
sCfg.depth = sub.Depth()
|
sCfg.depth = sub.Depth()
|
||||||
|
@ -887,6 +889,7 @@ func (c *cfg) getSubstorageOpts(shCfg shardCfg) []blobstor.SubStorage {
|
||||||
blobovniczatree.WithOpenedCacheSize(sRead.openedCacheSize),
|
blobovniczatree.WithOpenedCacheSize(sRead.openedCacheSize),
|
||||||
blobovniczatree.WithInitWorkerCount(sRead.initWorkerCount),
|
blobovniczatree.WithInitWorkerCount(sRead.initWorkerCount),
|
||||||
blobovniczatree.WithInitInAdvance(sRead.initInAdvance),
|
blobovniczatree.WithInitInAdvance(sRead.initInAdvance),
|
||||||
|
blobovniczatree.WithWaitBeforeDropDB(sRead.rebuildDropTimeout),
|
||||||
blobovniczatree.WithLogger(c.log),
|
blobovniczatree.WithLogger(c.log),
|
||||||
blobovniczatree.WithObjectSizeLimit(shCfg.smallSizeObjectLimit),
|
blobovniczatree.WithObjectSizeLimit(shCfg.smallSizeObjectLimit),
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,7 @@ func TestEngineSection(t *testing.T) {
|
||||||
require.EqualValues(t, 10, blz.LeafWidth())
|
require.EqualValues(t, 10, blz.LeafWidth())
|
||||||
require.EqualValues(t, 10, blz.InitWorkerCount())
|
require.EqualValues(t, 10, blz.InitWorkerCount())
|
||||||
require.EqualValues(t, true, blz.InitInAdvance())
|
require.EqualValues(t, true, blz.InitInAdvance())
|
||||||
|
require.EqualValues(t, 30*time.Second, blz.RebuildDropTimeout())
|
||||||
|
|
||||||
require.Equal(t, "tmp/0/blob", ss[1].Path())
|
require.Equal(t, "tmp/0/blob", ss[1].Path())
|
||||||
require.EqualValues(t, 0o644, ss[1].Perm())
|
require.EqualValues(t, 0o644, ss[1].Perm())
|
||||||
|
@ -151,6 +152,7 @@ func TestEngineSection(t *testing.T) {
|
||||||
require.EqualValues(t, 50, blz.OpenedCacheSize())
|
require.EqualValues(t, 50, blz.OpenedCacheSize())
|
||||||
require.EqualValues(t, 10, blz.LeafWidth())
|
require.EqualValues(t, 10, blz.LeafWidth())
|
||||||
require.EqualValues(t, blobovniczaconfig.InitWorkerCountDefault, blz.InitWorkerCount())
|
require.EqualValues(t, blobovniczaconfig.InitWorkerCountDefault, blz.InitWorkerCount())
|
||||||
|
require.EqualValues(t, blobovniczaconfig.RebuildDropTimeoutDefault, blz.RebuildDropTimeout())
|
||||||
|
|
||||||
require.Equal(t, "tmp/1/blob", ss[1].Path())
|
require.Equal(t, "tmp/1/blob", ss[1].Path())
|
||||||
require.EqualValues(t, 0o644, ss[1].Perm())
|
require.EqualValues(t, 0o644, ss[1].Perm())
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package blobovniczaconfig
|
package blobovniczaconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
||||||
boltdbconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/boltdb"
|
boltdbconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/boltdb"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/blobovniczatree"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/blobovniczatree"
|
||||||
|
@ -25,6 +27,9 @@ const (
|
||||||
|
|
||||||
// InitWorkerCountDefault is a default workers count to initialize Blobovnicza's.
|
// InitWorkerCountDefault is a default workers count to initialize Blobovnicza's.
|
||||||
InitWorkerCountDefault = 5
|
InitWorkerCountDefault = 5
|
||||||
|
|
||||||
|
// RebuildDropTimeoutDefault is a default timeout value to wait before drop single blobovnicza.
|
||||||
|
RebuildDropTimeoutDefault = 10 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// From wraps config section into Config.
|
// From wraps config section into Config.
|
||||||
|
@ -141,3 +146,17 @@ func (x *Config) InitInAdvance() bool {
|
||||||
"init_in_advance",
|
"init_in_advance",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RebuildDropTimeout returns the value of "rebuild_drop_timeout" config parameter.
|
||||||
|
//
|
||||||
|
// Returns RebuildDropTimeoutDefault if the value is not defined or invalid.
|
||||||
|
func (x *Config) RebuildDropTimeout() time.Duration {
|
||||||
|
d := config.DurationSafe(
|
||||||
|
(*config.Config)(x),
|
||||||
|
"rebuild_drop_timeout",
|
||||||
|
)
|
||||||
|
if d > 0 {
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
return RebuildDropTimeoutDefault
|
||||||
|
}
|
||||||
|
|
|
@ -129,6 +129,7 @@ FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_OPENED_CACHE_CAPACITY=50
|
||||||
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_LEAF_WIDTH=10
|
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_LEAF_WIDTH=10
|
||||||
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_INIT_WORKER_COUNT=10
|
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_INIT_WORKER_COUNT=10
|
||||||
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_INIT_IN_ADVANCE=TRUE
|
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_INIT_IN_ADVANCE=TRUE
|
||||||
|
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_0_REBUILD_DROP_TIMEOUT=30s
|
||||||
### FSTree config
|
### FSTree config
|
||||||
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_1_TYPE=fstree
|
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_1_TYPE=fstree
|
||||||
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_1_PATH=tmp/0/blob
|
FROSTFS_STORAGE_SHARD_0_BLOBSTOR_1_PATH=tmp/0/blob
|
||||||
|
|
|
@ -176,7 +176,8 @@
|
||||||
"opened_cache_capacity": 50,
|
"opened_cache_capacity": 50,
|
||||||
"leaf_width": 10,
|
"leaf_width": 10,
|
||||||
"init_worker_count": 10,
|
"init_worker_count": 10,
|
||||||
"init_in_advance": true
|
"init_in_advance": true,
|
||||||
|
"rebuild_drop_timeout": "30s"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "fstree",
|
"type": "fstree",
|
||||||
|
|
|
@ -190,6 +190,7 @@ storage:
|
||||||
path: tmp/0/blob/blobovnicza
|
path: tmp/0/blob/blobovnicza
|
||||||
init_worker_count: 10 #count of workers to initialize blobovniczas
|
init_worker_count: 10 #count of workers to initialize blobovniczas
|
||||||
init_in_advance: true
|
init_in_advance: true
|
||||||
|
rebuild_drop_timeout: 30s # timeout before drop single blobovnicza
|
||||||
- type: fstree
|
- type: fstree
|
||||||
path: tmp/0/blob # blobstor path
|
path: tmp/0/blob # blobstor path
|
||||||
|
|
||||||
|
|
|
@ -225,14 +225,17 @@ blobstor:
|
||||||
| `depth` | `int` | `4` | File-system tree depth. |
|
| `depth` | `int` | `4` | File-system tree depth. |
|
||||||
|
|
||||||
#### `blobovnicza` type options
|
#### `blobovnicza` type options
|
||||||
| Parameter | Type | Default value | Description |
|
| Parameter | Type | Default value | Description |
|
||||||
|-------------------------|-----------|---------------|-------------------------------------------------------|
|
| ----------------------- | ---------- | ------------- | --------------------------------------------------------------------- |
|
||||||
| `path` | `string` | | Path to the root of the blobstor. |
|
| `path` | `string` | | Path to the root of the blobstor. |
|
||||||
| `perm` | file mode | `0660` | Default permission for created files and directories. |
|
| `perm` | file mode | `0660` | Default permission for created files and directories. |
|
||||||
| `size` | `size` | `1 G` | Maximum size of a single blobovnicza |
|
| `size` | `size` | `1 G` | Maximum size of a single blobovnicza |
|
||||||
| `depth` | `int` | `2` | Blobovnicza tree depth. |
|
| `depth` | `int` | `2` | Blobovnicza tree depth. |
|
||||||
| `width` | `int` | `16` | Blobovnicza tree width. |
|
| `width` | `int` | `16` | Blobovnicza tree width. |
|
||||||
| `opened_cache_capacity` | `int` | `16` | Maximum number of simultaneously opened blobovniczas. |
|
| `opened_cache_capacity` | `int` | `16` | Maximum number of simultaneously opened blobovniczas. |
|
||||||
|
| `init_worker_count` | `int` | `5` | Maximum number of concurrent initialization workers. |
|
||||||
|
| `init_in_advance` | `bool` | `false` | If `true`, than all the blobovnicza files will be created on startup. |
|
||||||
|
| `rebuild_drop_timeout` | `duration` | `10s` | Timeout before drop empty blobovnicza file during rebuild. |
|
||||||
|
|
||||||
### `gc` subsection
|
### `gc` subsection
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue