Add storage.low_mem config parameter #461

Merged
fyrchik merged 2 commits from dstepanov-yadro/frostfs-node:fix/lowmem_config into master 2023-06-26 13:29:41 +00:00

Closes #428

Now this parameter prohibits parallel metabase resync only. In case of many shards and low memory available on machine it can lead to OOM.

I haven't specify this parameter in config example as it will be rarely used i think.

Closes #428 Now this parameter prohibits parallel metabase resync only. In case of many shards and low memory available on machine it can lead to OOM. I haven't specify this parameter in config example as it will be rarely used i think.
acid-ant approved these changes 2023-06-22 14:12:29 +00:00
fyrchik approved these changes 2023-06-23 08:10:06 +00:00
@ -79,0 +80,4 @@
if e.cfg.lowMem && e.anyShardRequiresRefill() {
concurrentLimit = 1
}
sem := make(chan struct{}, concurrentLimit)

Why don't we just use errgroup?

Why don't we just use `errgroup`?
Poster
Collaborator

fixed

fixed
fyrchik marked this conversation as resolved
dstepanov-yadro force-pushed fix/lowmem_config from e83612b6bc to ae04be3fa9 2023-06-23 11:05:43 +00:00 Compare
dstepanov-yadro force-pushed fix/lowmem_config from ae04be3fa9 to 5bcf708766 2023-06-23 11:16:17 +00:00 Compare
acid-ant approved these changes 2023-06-23 12:09:49 +00:00
ale64bit reviewed 2023-06-23 12:14:18 +00:00
@ -76,3 +77,3 @@
var wg sync.WaitGroup
var errCh = make(chan shardInitError, len(e.shards))
eg, _ := errgroup.WithContext(ctx)
Collaborator

why ignore the derived context? shouldn't it be used by sh.Init(ctx) below?

why ignore the derived context? shouldn't it be used by `sh.Init(ctx)` below?
Poster
Collaborator

eg.Go doesn't return error, so there is no need to use derived ctx. Derived ctx needed in case of some goroutine returns error, then derived ctx will be cancelled.

`eg.Go` doesn't return error, so there is no need to use derived ctx. Derived ctx needed in case of some goroutine returns error, then derived ctx will be cancelled.
Collaborator

well, but that was my point, to stop further initialization if one of them failed already.

well, but that was my point, to stop further initialization if one of them failed already.
Poster
Collaborator

ok, fixed

ok, fixed

Well, actually, no, this is a feature -- if ONE shard cannot be initialized, we just remove it and continue initialization for others. Adding context doesn't change it actually, because we sent an error to the channel.

However I am a bit concerned now:
From https://pkg.go.dev/golang.org/x/sync/errgroup#WithContext (cursive is mine):

The derived Context is canceled the first time a function passed to Go returns a non-nil error or the first time Wait returns

And this context is passed to GC, have you checked it doesn't lead to problems?

Well, actually, no, this is a feature -- if ONE shard cannot be initialized, we just remove it and continue initialization for others. Adding context doesn't change it actually, because we sent an error to the channel. However I am a bit concerned now: From https://pkg.go.dev/golang.org/x/sync/errgroup#WithContext (cursive is mine): > The derived Context is canceled the first time a function passed to Go returns a non-nil error or *the first time Wait returns* And this context is passed to GC, have you checked it doesn't lead to problems?

May be indeed #461 (comment) was a mistake.

May be indeed https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/461#issuecomment-13618 was a mistake.
Collaborator

if that's the case then don't use WithContext in the first place? i.e. simply var eg errgroup.Group. Otherwise it's kinda misleading.

if that's the case then don't use `WithContext` in the first place? i.e. simply `var eg errgroup.Group`. Otherwise it's kinda misleading.
Poster
Collaborator

Thank you! Replace with var

Thank you! Replace with var
dstepanov-yadro force-pushed fix/lowmem_config from 5bcf708766 to 209dcee921 2023-06-26 06:51:36 +00:00 Compare
dstepanov-yadro force-pushed fix/lowmem_config from 209dcee921 to ec828e0097 2023-06-26 06:53:22 +00:00 Compare
ale64bit approved these changes 2023-06-26 07:05:14 +00:00
dstepanov-yadro force-pushed fix/lowmem_config from ec828e0097 to efa79a22cb 2023-06-26 09:27:01 +00:00 Compare
fyrchik approved these changes 2023-06-26 13:29:28 +00:00
fyrchik merged commit 43d263c3d5 into master 2023-06-26 13:29:41 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#461
There is no content yet.