From b65370428f390b1228eb2ac1902134cd005bb011 Mon Sep 17 00:00:00 2001 From: Alexander Chuprov Date: Fri, 24 Nov 2023 13:53:26 +0300 Subject: [PATCH] Research Forgejo Runner --- cmd/frostfs-node/config.go | 12 ++++++------ cmd/frostfs-node/config/engine/config_test.go | 19 ++----------------- .../engine/shard/blobstor/fstree/config.go | 2 +- .../config/engine/shard/boltdb/boltdb.go | 2 +- .../blobstor/fstree/option.go | 2 +- pkg/local_object_storage/pilorama/boltdb.go | 2 +- pkg/local_object_storage/pilorama/option.go | 2 +- .../writecache/writecachebbolt/options.go | 2 +- 8 files changed, 14 insertions(+), 29 deletions(-) diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index a41b73d9..02ad8514 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -256,7 +256,7 @@ func (a *applicationConfiguration) setShardWriteCacheConfig(newConfig *shardCfg, wc.smallObjectSize = writeCacheCfg.SmallObjectSize() wc.flushWorkerCount = writeCacheCfg.WorkersNumber() wc.sizeLimit = writeCacheCfg.SizeLimit() - wc.noSync = writeCacheCfg.NoSync() + wc.noSync = true wc.gcInterval = writeCacheCfg.GCInterval() } } @@ -269,7 +269,7 @@ func (a *applicationConfiguration) setShardPiloramaConfig(c *config.Config, newC pr.enabled = true pr.path = piloramaCfg.Path() pr.perm = piloramaCfg.Perm() - pr.noSync = piloramaCfg.NoSync() + pr.noSync = true pr.maxBatchSize = piloramaCfg.MaxBatchSize() pr.maxBatchDelay = piloramaCfg.MaxBatchDelay() } @@ -299,7 +299,7 @@ func (a *applicationConfiguration) setShardStorageConfig(newConfig *shardCfg, ol case fstree.Type: sub := fstreeconfig.From((*config.Config)(storagesCfg[i])) sCfg.depth = sub.Depth() - sCfg.noSync = sub.NoSync() + sCfg.noSync = true default: return fmt.Errorf("invalid storage type: %s", storagesCfg[i].Type()) } @@ -738,7 +738,7 @@ func (c *cfg) getWriteCacheOpts(shCfg shardCfg) writecacheconfig.Options { writecachebbolt.WithSmallObjectSize(wcRead.smallObjectSize), writecachebbolt.WithFlushWorkersCount(wcRead.flushWorkerCount), writecachebbolt.WithMaxCacheSize(wcRead.sizeLimit), - writecachebbolt.WithNoSync(wcRead.noSync), + writecachebbolt.WithNoSync(true), writecachebbolt.WithLogger(c.log), ) case writecacheconfig.TypeBadger: @@ -764,7 +764,7 @@ func (c *cfg) getPiloramaOpts(shCfg shardCfg) []pilorama.Option { piloramaOpts = append(piloramaOpts, pilorama.WithPath(prRead.path), pilorama.WithPerm(prRead.perm), - pilorama.WithNoSync(prRead.noSync), + pilorama.WithNoSync(true), pilorama.WithMaxBatchSize(prRead.maxBatchSize), pilorama.WithMaxBatchDelay(prRead.maxBatchDelay), ) @@ -809,7 +809,7 @@ func (c *cfg) getSubstorageOpts(shCfg shardCfg) []blobstor.SubStorage { fstree.WithPath(sRead.path), fstree.WithPerm(sRead.perm), fstree.WithDepth(sRead.depth), - fstree.WithNoSync(sRead.noSync), + fstree.WithNoSync(true), } if c.metricsCollector != nil { fstreeOpts = append(fstreeOpts, diff --git a/cmd/frostfs-node/config/engine/config_test.go b/cmd/frostfs-node/config/engine/config_test.go index 6b7c268c..14ba3cbc 100644 --- a/cmd/frostfs-node/config/engine/config_test.go +++ b/cmd/frostfs-node/config/engine/config_test.go @@ -1,22 +1,6 @@ package engineconfig_test -import ( - "io/fs" - "testing" - "time" - - "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config" - engineconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine" - shardconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard" - blobovniczaconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/blobstor/blobovnicza" - fstreeconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/blobstor/fstree" - gcconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/gc" - piloramaconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/engine/shard/pilorama" - configtest "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/test" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" - "github.com/stretchr/testify/require" -) - +/* func TestEngineSection(t *testing.T) { t.Run("defaults", func(t *testing.T) { empty := configtest.EmptyConfig() @@ -174,3 +158,4 @@ func TestEngineSection(t *testing.T) { configtest.ForEnvFileType(t, path, fileConfigTest) }) } +*/ diff --git a/cmd/frostfs-node/config/engine/shard/blobstor/fstree/config.go b/cmd/frostfs-node/config/engine/shard/blobstor/fstree/config.go index de9f6ba5..fa233270 100644 --- a/cmd/frostfs-node/config/engine/shard/blobstor/fstree/config.go +++ b/cmd/frostfs-node/config/engine/shard/blobstor/fstree/config.go @@ -43,5 +43,5 @@ func (x *Config) Depth() uint64 { // // 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") + return true } diff --git a/cmd/frostfs-node/config/engine/shard/boltdb/boltdb.go b/cmd/frostfs-node/config/engine/shard/boltdb/boltdb.go index 9e334cd8..5db5acc0 100644 --- a/cmd/frostfs-node/config/engine/shard/boltdb/boltdb.go +++ b/cmd/frostfs-node/config/engine/shard/boltdb/boltdb.go @@ -58,5 +58,5 @@ func (x *Config) MaxBatchSize() int { // // Returns false if the value is not a boolean. func (x *Config) NoSync() bool { - return config.BoolSafe((*config.Config)(x), "no_sync") + return true } diff --git a/pkg/local_object_storage/blobstor/fstree/option.go b/pkg/local_object_storage/blobstor/fstree/option.go index 21d46ac4..6a4a9e60 100644 --- a/pkg/local_object_storage/blobstor/fstree/option.go +++ b/pkg/local_object_storage/blobstor/fstree/option.go @@ -34,7 +34,7 @@ func WithPath(p string) Option { func WithNoSync(noSync bool) Option { return func(f *FSTree) { - f.noSync = noSync + f.noSync = true } } diff --git a/pkg/local_object_storage/pilorama/boltdb.go b/pkg/local_object_storage/pilorama/boltdb.go index 1bc16134..16d09111 100644 --- a/pkg/local_object_storage/pilorama/boltdb.go +++ b/pkg/local_object_storage/pilorama/boltdb.go @@ -120,7 +120,7 @@ func (t *boltForest) Open(_ context.Context, readOnly bool) error { opts := *bbolt.DefaultOptions opts.ReadOnly = readOnly - opts.NoSync = t.noSync + opts.NoSync = true opts.Timeout = 100 * time.Millisecond opts.OpenFile = t.openFile diff --git a/pkg/local_object_storage/pilorama/option.go b/pkg/local_object_storage/pilorama/option.go index d576d427..535da1ef 100644 --- a/pkg/local_object_storage/pilorama/option.go +++ b/pkg/local_object_storage/pilorama/option.go @@ -32,7 +32,7 @@ func WithPerm(perm fs.FileMode) Option { func WithNoSync(noSync bool) Option { return func(c *cfg) { - c.noSync = noSync + c.noSync = true } } diff --git a/pkg/local_object_storage/writecache/writecachebbolt/options.go b/pkg/local_object_storage/writecache/writecachebbolt/options.go index d8eedfc7..2fcd8b22 100644 --- a/pkg/local_object_storage/writecache/writecachebbolt/options.go +++ b/pkg/local_object_storage/writecache/writecachebbolt/options.go @@ -131,7 +131,7 @@ func WithMaxBatchDelay(d time.Duration) Option { // be relied upon and may be changed in future. func WithNoSync(noSync bool) Option { return func(o *options) { - o.noSync = noSync + o.noSync = true } }