[#653] Pass context.Context to StorageEngine Open #672
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#672
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "elebedeva/frostfs-node:open-context"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Close #653
Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com
It seems you have a really old branch, please rebase on the actual master.
@ -44,3 +45,3 @@
meta.WithEpochState(epochState{}),
)
common.ExitOnErr(cmd, common.Errf("could not open metabase: %w", db.Open(true)))
common.ExitOnErr(cmd, common.Errf("could not open metabase: %w", db.Open(context.Background(), true)))
cmd.Context()
is what we usually use for this.Fixed.
Don't forget to add reviewers! Our team has
core-
in it's name -- pick both options.a454b19589
tob60014d415
@ -932,3 +932,3 @@
c.log.Info(logs.FrostFSNodeClosingComponentsOfTheStorageEngine)
err := ls.Close()
err := ls.Close(ctx)
Need to check: if
onShutdown
calls afetr ctx is cancelled, thenClose()
may fail. Socontext.Background()
or detached https://pkg.go.dev/context#WithoutCancel should be used.WithoutCancel()
was added in 1.21, but we need to support 1.20 too.changed
ls.Close(ctx)
tols.Close(context.Background())
@ -22,3 +23,3 @@
err := b.Close()
if err == nil {
if err = b.Open(m.ReadOnly()); err == nil {
if err = b.Open(context.Background(), m.ReadOnly()); err == nil {
context.TODO is more preferred in such cases (or we should pass ctx to SetMode too :) )
fixed
@ -28,3 +29,3 @@
db.boltDB = nil
case m.ReadOnly():
err = db.Open(true)
err = db.Open(context.Background(), true)
context.TODO too
fixed
b60014d415
toce614e8a94
@ -177,3 +179,3 @@
isMeta := errors.As(err, new(metaerr.Error))
if block {
e.moveToDegraded(sh, errCount, isMeta)
e.moveToDegraded(ctx, sh, errCount, isMeta)
Same here the
ctx
here is taken from operation, I believeSetMode
should not be affected by it.@ -57,2 +59,3 @@
for i, component := range components {
if err := component.Open(false); err != nil {
if err := component.Open(ctx, false); err != nil {
select {
What is this select for? We have an error, no need to check the context. For the
component == s.metaBase
check it is already checked in the loop.Removed unnecessary select
@ -38,3 +38,3 @@
for _, shardID := range s.getShardIDList(req.Body.GetShard_ID()) {
err = s.s.SetShardMode(shardID, m, req.Body.GetResetErrorCounter())
err = s.s.SetShardMode(ctx, shardID, m, req.Body.GetResetErrorCounter())
This may be a problem -- ctx is a context for stream operation, while ctx for
Open
/Init
/SetMode
is for the storage lifetime. Have you checked how this context is used?ce614e8a94
to3327355ebc
3327355ebc
to8a81af5a3b
Very nice!