forked from TrueCloudLab/frostfs-node
[#1437] shard: Fix contextcheck linter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
c139892117
commit
16598553d9
38 changed files with 165 additions and 160 deletions
|
@ -56,7 +56,7 @@ func (e *StorageEngine) open(ctx context.Context) error {
|
|||
sh := e.shards[res.id]
|
||||
delete(e.shards, res.id)
|
||||
|
||||
err := sh.Close()
|
||||
err := sh.Close(ctx)
|
||||
if err != nil {
|
||||
e.log.Error(ctx, logs.EngineCouldNotClosePartiallyInitializedShard,
|
||||
zap.String("id", res.id),
|
||||
|
@ -108,7 +108,7 @@ func (e *StorageEngine) Init(ctx context.Context) error {
|
|||
sh := e.shards[res.id]
|
||||
delete(e.shards, res.id)
|
||||
|
||||
err := sh.Close()
|
||||
err := sh.Close(ctx)
|
||||
if err != nil {
|
||||
e.log.Error(ctx, logs.EngineCouldNotClosePartiallyInitializedShard,
|
||||
zap.String("id", res.id),
|
||||
|
@ -126,7 +126,7 @@ func (e *StorageEngine) Init(ctx context.Context) error {
|
|||
}
|
||||
|
||||
e.wg.Add(1)
|
||||
go e.setModeLoop()
|
||||
go e.setModeLoop(ctx)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ func (e *StorageEngine) Close(ctx context.Context) error {
|
|||
}
|
||||
|
||||
// closes all shards. Never returns an error, shard errors are logged.
|
||||
func (e *StorageEngine) close(releasePools bool) error {
|
||||
func (e *StorageEngine) close(ctx context.Context, releasePools bool) error {
|
||||
e.mtx.RLock()
|
||||
defer e.mtx.RUnlock()
|
||||
|
||||
|
@ -164,8 +164,8 @@ func (e *StorageEngine) close(releasePools bool) error {
|
|||
}
|
||||
|
||||
for id, sh := range e.shards {
|
||||
if err := sh.Close(); err != nil {
|
||||
e.log.Debug(context.Background(), logs.EngineCouldNotCloseShard,
|
||||
if err := sh.Close(ctx); err != nil {
|
||||
e.log.Debug(ctx, logs.EngineCouldNotCloseShard,
|
||||
zap.String("id", id),
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
@ -213,7 +213,7 @@ func (e *StorageEngine) setBlockExecErr(ctx context.Context, err error) error {
|
|||
return e.open(ctx)
|
||||
}
|
||||
} else if prevErr == nil { // ok -> block
|
||||
return e.close(errors.Is(err, errClosed))
|
||||
return e.close(ctx, errors.Is(err, errClosed))
|
||||
}
|
||||
|
||||
// otherwise do nothing
|
||||
|
@ -306,7 +306,7 @@ loop:
|
|||
|
||||
e.mtx.RUnlock()
|
||||
|
||||
e.removeShards(shardsToRemove...)
|
||||
e.removeShards(ctx, shardsToRemove...)
|
||||
|
||||
for _, p := range shardsToReload {
|
||||
err := p.sh.Reload(ctx, p.opts...)
|
||||
|
@ -330,13 +330,13 @@ loop:
|
|||
err = sh.Init(ctx)
|
||||
}
|
||||
if err != nil {
|
||||
_ = sh.Close()
|
||||
_ = sh.Close(ctx)
|
||||
return fmt.Errorf("could not init %s shard: %w", idStr, err)
|
||||
}
|
||||
|
||||
err = e.addShard(sh)
|
||||
if err != nil {
|
||||
_ = sh.Close()
|
||||
_ = sh.Close(ctx)
|
||||
return fmt.Errorf("could not add %s shard: %w", idStr, err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue