forked from TrueCloudLab/frostfs-node
[#1437] node: Fix contextcheck linter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
6921a89061
commit
7429553266
209 changed files with 1068 additions and 1036 deletions
|
@ -186,7 +186,7 @@ func (b *Blobovniczas) rebuildBySize(ctx context.Context, path string, targetFil
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer shDB.Close()
|
||||
defer shDB.Close(ctx)
|
||||
fp := blz.FillPercent()
|
||||
// accepted fill percent defines as
|
||||
// |----|+++++++++++++++++|+++++++++++++++++|---------------
|
||||
|
@ -206,9 +206,9 @@ func (b *Blobovniczas) rebuildDB(ctx context.Context, path string, meta common.M
|
|||
if shDBClosed {
|
||||
return
|
||||
}
|
||||
shDB.Close()
|
||||
shDB.Close(ctx)
|
||||
}()
|
||||
dropTempFile, err := b.addRebuildTempFile(path)
|
||||
dropTempFile, err := b.addRebuildTempFile(ctx, path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ func (b *Blobovniczas) rebuildDB(ctx context.Context, path string, meta common.M
|
|||
return migratedObjects, err
|
||||
}
|
||||
|
||||
func (b *Blobovniczas) addRebuildTempFile(path string) (func(), error) {
|
||||
func (b *Blobovniczas) addRebuildTempFile(ctx context.Context, path string) (func(), error) {
|
||||
sysPath := filepath.Join(b.rootPath, path)
|
||||
sysPath = sysPath + rebuildSuffix
|
||||
_, err := os.OpenFile(sysPath, os.O_RDWR|os.O_CREATE|os.O_EXCL|os.O_SYNC, b.perm)
|
||||
|
@ -233,7 +233,7 @@ func (b *Blobovniczas) addRebuildTempFile(path string) (func(), error) {
|
|||
}
|
||||
return func() {
|
||||
if err := os.Remove(sysPath); err != nil {
|
||||
b.log.Warn(context.Background(), logs.BlobovniczatreeFailedToRemoveRebuildTempFile, zap.Error(err))
|
||||
b.log.Warn(ctx, logs.BlobovniczatreeFailedToRemoveRebuildTempFile, zap.Error(err))
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ func (b *Blobovniczas) dropDB(ctx context.Context, path string, shDb *sharedDB)
|
|||
b.dbFilesGuard.Lock()
|
||||
defer b.dbFilesGuard.Unlock()
|
||||
|
||||
if err := shDb.CloseAndRemoveFile(); err != nil {
|
||||
if err := shDb.CloseAndRemoveFile(ctx); err != nil {
|
||||
return false, err
|
||||
}
|
||||
b.commondbManager.CleanResources(path)
|
||||
|
@ -370,7 +370,7 @@ func (b *Blobovniczas) completeIncompletedMove(ctx context.Context, metaStore co
|
|||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
defer shDB.Close()
|
||||
defer shDB.Close(ctx)
|
||||
|
||||
incompletedMoves, err := blz.ListMoveInfo(ctx)
|
||||
if err != nil {
|
||||
|
@ -403,7 +403,7 @@ func (b *Blobovniczas) performMove(ctx context.Context, source *blobovnicza.Blob
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer targetDB.Close()
|
||||
defer targetDB.Close(ctx)
|
||||
|
||||
existsInSource := true
|
||||
var gPrm blobovnicza.GetPrm
|
||||
|
@ -480,7 +480,7 @@ func (i *moveIterator) tryMoveToLvl(ctx context.Context, lvlPath string) (bool,
|
|||
target, err := i.B.activeDBManager.GetOpenedActiveDBForLevel(ctx, lvlPath)
|
||||
if err != nil {
|
||||
if !isLogical(err) {
|
||||
i.B.reportError(logs.BlobovniczatreeCouldNotGetActiveBlobovnicza, err)
|
||||
i.B.reportError(ctx, logs.BlobovniczatreeCouldNotGetActiveBlobovnicza, err)
|
||||
} else {
|
||||
i.B.log.Warn(ctx, logs.BlobovniczatreeCouldNotGetActiveBlobovnicza, zap.Error(err))
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ func (i *moveIterator) tryMoveToLvl(ctx context.Context, lvlPath string) (bool,
|
|||
i.B.log.Warn(ctx, logs.BlobovniczatreeBlobovniczaOverflowed, zap.String("level", lvlPath))
|
||||
return false, nil
|
||||
}
|
||||
defer target.Close()
|
||||
defer target.Close(ctx)
|
||||
|
||||
i.AllFull = false
|
||||
|
||||
|
@ -503,7 +503,7 @@ func (i *moveIterator) tryMoveToLvl(ctx context.Context, lvlPath string) (bool,
|
|||
TargetStorageID: targetStorageID.Bytes(),
|
||||
}); err != nil {
|
||||
if !isLogical(err) {
|
||||
i.B.reportError(logs.BlobovniczatreeCouldNotPutMoveInfoToSourceBlobovnicza, err)
|
||||
i.B.reportError(ctx, logs.BlobovniczatreeCouldNotPutMoveInfoToSourceBlobovnicza, err)
|
||||
} else {
|
||||
i.B.log.Warn(ctx, logs.BlobovniczatreeCouldNotPutMoveInfoToSourceBlobovnicza, zap.String("path", i.SourceSysPath), zap.Error(err))
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ func (i *moveIterator) tryMoveToLvl(ctx context.Context, lvlPath string) (bool,
|
|||
_, err = target.Blobovnicza().Put(ctx, putPrm)
|
||||
if err != nil {
|
||||
if !isLogical(err) {
|
||||
i.B.reportError(logs.BlobovniczatreeCouldNotPutObjectToActiveBlobovnicza, err)
|
||||
i.B.reportError(ctx, logs.BlobovniczatreeCouldNotPutObjectToActiveBlobovnicza, err)
|
||||
} else {
|
||||
i.B.log.Warn(ctx, logs.BlobovniczatreeCouldNotPutObjectToActiveBlobovnicza, zap.String("path", target.SystemPath()), zap.Error(err))
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ func (i *moveIterator) tryMoveToLvl(ctx context.Context, lvlPath string) (bool,
|
|||
deletePrm.SetAddress(i.Address)
|
||||
if _, err = i.Source.Delete(ctx, deletePrm); err != nil {
|
||||
if !isLogical(err) {
|
||||
i.B.reportError(logs.BlobovniczatreeCouldNotDeleteFromSource, err)
|
||||
i.B.reportError(ctx, logs.BlobovniczatreeCouldNotDeleteFromSource, err)
|
||||
} else {
|
||||
i.B.log.Warn(ctx, logs.BlobovniczatreeCouldNotDeleteFromSource, zap.String("path", i.SourceSysPath), zap.Error(err))
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ func (i *moveIterator) tryMoveToLvl(ctx context.Context, lvlPath string) (bool,
|
|||
|
||||
if err = i.Source.DropMoveInfo(ctx, i.Address); err != nil {
|
||||
if !isLogical(err) {
|
||||
i.B.reportError(logs.BlobovniczatreeCouldNotDropMoveInfo, err)
|
||||
i.B.reportError(ctx, logs.BlobovniczatreeCouldNotDropMoveInfo, err)
|
||||
} else {
|
||||
i.B.log.Warn(ctx, logs.BlobovniczatreeCouldNotDropMoveInfo, zap.String("path", i.SourceSysPath), zap.Error(err))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue