forked from TrueCloudLab/frostfs-node
[#1992] neofs-node: Allow to open fstree in NOSYNC mode
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
148da5fdbb
commit
b6930f2219
7 changed files with 28 additions and 7 deletions
|
@ -6,6 +6,8 @@ Changelog for NeoFS Node
|
||||||
### Added
|
### Added
|
||||||
### Changed
|
### Changed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Open FSTree in sync mode by default (#1992)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
### Updated
|
### Updated
|
||||||
### Updating from v0.34.0
|
### Updating from v0.34.0
|
||||||
|
|
|
@ -159,6 +159,7 @@ type subStorageCfg struct {
|
||||||
path string
|
path string
|
||||||
perm fs.FileMode
|
perm fs.FileMode
|
||||||
depth uint64
|
depth uint64
|
||||||
|
noSync bool
|
||||||
|
|
||||||
// blobovnicza-specific
|
// blobovnicza-specific
|
||||||
size uint64
|
size uint64
|
||||||
|
@ -258,6 +259,7 @@ func (a *applicationConfiguration) readConfig(c *config.Config) error {
|
||||||
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()
|
||||||
|
sCfg.noSync = sub.NoSync()
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid storage type: %s", storagesCfg[i].Type())
|
return fmt.Errorf("invalid storage type: %s", storagesCfg[i].Type())
|
||||||
}
|
}
|
||||||
|
@ -681,7 +683,8 @@ func (c *cfg) shardOpts() []shardOptsWithID {
|
||||||
Storage: fstree.New(
|
Storage: fstree.New(
|
||||||
fstree.WithPath(sRead.path),
|
fstree.WithPath(sRead.path),
|
||||||
fstree.WithPerm(sRead.perm),
|
fstree.WithPerm(sRead.perm),
|
||||||
fstree.WithDepth(sRead.depth)),
|
fstree.WithDepth(sRead.depth),
|
||||||
|
fstree.WithNoSync(sRead.noSync)),
|
||||||
Policy: func(_ *objectSDK.Object, data []byte) bool {
|
Policy: func(_ *objectSDK.Object, data []byte) bool {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
|
@ -95,7 +95,10 @@ func TestEngineSection(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, "tmp/0/blob", ss[1].Path())
|
require.Equal(t, "tmp/0/blob", ss[1].Path())
|
||||||
require.EqualValues(t, 0644, ss[1].Perm())
|
require.EqualValues(t, 0644, ss[1].Perm())
|
||||||
require.EqualValues(t, 5, fstreeconfig.From((*config.Config)(ss[1])).Depth())
|
|
||||||
|
fst := fstreeconfig.From((*config.Config)(ss[1]))
|
||||||
|
require.EqualValues(t, 5, fst.Depth())
|
||||||
|
require.Equal(t, false, fst.NoSync())
|
||||||
|
|
||||||
require.EqualValues(t, 150, gc.RemoverBatchSize())
|
require.EqualValues(t, 150, gc.RemoverBatchSize())
|
||||||
require.Equal(t, 2*time.Minute, gc.RemoverSleepInterval())
|
require.Equal(t, 2*time.Minute, gc.RemoverSleepInterval())
|
||||||
|
@ -137,7 +140,10 @@ func TestEngineSection(t *testing.T) {
|
||||||
|
|
||||||
require.Equal(t, "tmp/1/blob", ss[1].Path())
|
require.Equal(t, "tmp/1/blob", ss[1].Path())
|
||||||
require.EqualValues(t, 0644, ss[1].Perm())
|
require.EqualValues(t, 0644, ss[1].Perm())
|
||||||
require.EqualValues(t, 5, fstreeconfig.From((*config.Config)(ss[1])).Depth())
|
|
||||||
|
fst := fstreeconfig.From((*config.Config)(ss[1]))
|
||||||
|
require.EqualValues(t, 5, fst.Depth())
|
||||||
|
require.Equal(t, true, fst.NoSync())
|
||||||
|
|
||||||
require.EqualValues(t, 200, gc.RemoverBatchSize())
|
require.EqualValues(t, 200, gc.RemoverBatchSize())
|
||||||
require.Equal(t, 5*time.Minute, gc.RemoverSleepInterval())
|
require.Equal(t, 5*time.Minute, gc.RemoverSleepInterval())
|
||||||
|
|
|
@ -38,3 +38,10 @@ func (x *Config) Depth() uint64 {
|
||||||
|
|
||||||
return DepthDefault
|
return DepthDefault
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NoSync returns the value of "no_sync" config parameter.
|
||||||
|
//
|
||||||
|
// Returns false if the value is not a boolean or is missing.
|
||||||
|
func (x *Config) NoSync() bool {
|
||||||
|
return config.BoolSafe((*config.Config)(x), "no_sync")
|
||||||
|
}
|
||||||
|
|
|
@ -160,6 +160,7 @@ NEOFS_STORAGE_SHARD_1_BLOBSTOR_0_OPENED_CACHE_CAPACITY=50
|
||||||
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_TYPE=fstree
|
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_TYPE=fstree
|
||||||
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_PATH=tmp/1/blob
|
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_PATH=tmp/1/blob
|
||||||
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_PERM=0644
|
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_PERM=0644
|
||||||
|
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_NO_SYNC=true
|
||||||
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_DEPTH=5
|
NEOFS_STORAGE_SHARD_1_BLOBSTOR_1_DEPTH=5
|
||||||
### Pilorama config
|
### Pilorama config
|
||||||
NEOFS_STORAGE_SHARD_1_PILORAMA_PATH="tmp/1/blob/pilorama.db"
|
NEOFS_STORAGE_SHARD_1_PILORAMA_PATH="tmp/1/blob/pilorama.db"
|
||||||
|
|
|
@ -214,6 +214,7 @@
|
||||||
{
|
{
|
||||||
"type": "fstree",
|
"type": "fstree",
|
||||||
"path": "tmp/1/blob",
|
"path": "tmp/1/blob",
|
||||||
|
"no_sync": true,
|
||||||
"perm": "0644",
|
"perm": "0644",
|
||||||
"depth": 5
|
"depth": 5
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,6 +198,7 @@ storage:
|
||||||
path: tmp/1/blob/blobovnicza
|
path: tmp/1/blob/blobovnicza
|
||||||
- type: fstree
|
- type: fstree
|
||||||
path: tmp/1/blob # blobstor path
|
path: tmp/1/blob # blobstor path
|
||||||
|
no_sync: true
|
||||||
|
|
||||||
pilorama:
|
pilorama:
|
||||||
path: tmp/1/blob/pilorama.db
|
path: tmp/1/blob/pilorama.db
|
||||||
|
|
Loading…
Reference in a new issue