[#9999] metabase: Use Batch
for delete-related operations
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m15s
DCO action / DCO (pull_request) Successful in 1m27s
Vulncheck / Vulncheck (pull_request) Successful in 1m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m15s
Build / Build Components (pull_request) Successful in 2m23s
Tests and linters / gopls check (pull_request) Successful in 2m42s
Tests and linters / Staticcheck (pull_request) Successful in 2m46s
Tests and linters / Lint (pull_request) Successful in 3m34s
Tests and linters / Tests (pull_request) Successful in 4m15s
Tests and linters / Tests with -race (pull_request) Successful in 5m34s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m15s
DCO action / DCO (pull_request) Successful in 1m27s
Vulncheck / Vulncheck (pull_request) Successful in 1m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m15s
Build / Build Components (pull_request) Successful in 2m23s
Tests and linters / gopls check (pull_request) Successful in 2m42s
Tests and linters / Staticcheck (pull_request) Successful in 2m46s
Tests and linters / Lint (pull_request) Successful in 3m34s
Tests and linters / Tests (pull_request) Successful in 4m15s
Tests and linters / Tests with -race (pull_request) Successful in 5m34s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
61d5e140e0
commit
c1b4c5c0a0
5 changed files with 7 additions and 7 deletions
|
@ -654,7 +654,7 @@ func (db *DB) DeleteContainerSize(ctx context.Context, id cid.ID) error {
|
||||||
return ErrReadOnlyMode
|
return ErrReadOnlyMode
|
||||||
}
|
}
|
||||||
|
|
||||||
err := db.boltDB.Update(func(tx *bbolt.Tx) error {
|
err := db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
b := tx.Bucket(containerVolumeBucketName)
|
b := tx.Bucket(containerVolumeBucketName)
|
||||||
|
|
||||||
key := make([]byte, cidSize)
|
key := make([]byte, cidSize)
|
||||||
|
@ -737,7 +737,7 @@ func (db *DB) DeleteContainerCount(ctx context.Context, id cid.ID) error {
|
||||||
return ErrReadOnlyMode
|
return ErrReadOnlyMode
|
||||||
}
|
}
|
||||||
|
|
||||||
err := db.boltDB.Update(func(tx *bbolt.Tx) error {
|
err := db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
b := tx.Bucket(containerCounterBucketName)
|
b := tx.Bucket(containerCounterBucketName)
|
||||||
|
|
||||||
key := make([]byte, cidSize)
|
key := make([]byte, cidSize)
|
||||||
|
|
|
@ -112,7 +112,7 @@ func (db *DB) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, error) {
|
||||||
var err error
|
var err error
|
||||||
var res DeleteRes
|
var res DeleteRes
|
||||||
|
|
||||||
err = db.boltDB.Update(func(tx *bbolt.Tx) error {
|
err = db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
res, err = db.deleteGroup(tx, prm.addrs)
|
res, err = db.deleteGroup(tx, prm.addrs)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -282,7 +282,7 @@ func (db *DB) DropGraves(ctx context.Context, tss []TombstonedObject) error {
|
||||||
|
|
||||||
buf := make([]byte, addressKeySize)
|
buf := make([]byte, addressKeySize)
|
||||||
|
|
||||||
return db.boltDB.Update(func(tx *bbolt.Tx) error {
|
return db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
bkt := tx.Bucket(graveyardBucketName)
|
bkt := tx.Bucket(graveyardBucketName)
|
||||||
if bkt == nil {
|
if bkt == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -181,7 +181,7 @@ func (db *DB) Inhume(ctx context.Context, prm InhumePrm) (InhumeRes, error) {
|
||||||
inhumedByCnrID: make(map[cid.ID]ObjectCounters),
|
inhumedByCnrID: make(map[cid.ID]ObjectCounters),
|
||||||
}
|
}
|
||||||
currEpoch := db.epochState.CurrentEpoch()
|
currEpoch := db.epochState.CurrentEpoch()
|
||||||
err := db.boltDB.Update(func(tx *bbolt.Tx) error {
|
err := db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
return db.inhumeTx(tx, currEpoch, prm, &res)
|
return db.inhumeTx(tx, currEpoch, prm, &res)
|
||||||
})
|
})
|
||||||
success = err == nil
|
success = err == nil
|
||||||
|
|
|
@ -78,7 +78,7 @@ func (db *DB) lockInternal(locked []oid.ID, cnr cid.ID, locker oid.ID) error {
|
||||||
}
|
}
|
||||||
key := make([]byte, cidSize)
|
key := make([]byte, cidSize)
|
||||||
|
|
||||||
return metaerr.Wrap(db.boltDB.Update(func(tx *bbolt.Tx) error {
|
return metaerr.Wrap(db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != objectSDK.TypeRegular {
|
if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != objectSDK.TypeRegular {
|
||||||
return logicerr.Wrap(new(apistatus.LockNonRegularObject))
|
return logicerr.Wrap(new(apistatus.LockNonRegularObject))
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ func (db *DB) FreeLockedBy(lockers []oid.Address) ([]oid.Address, error) {
|
||||||
|
|
||||||
var unlockedObjects []oid.Address
|
var unlockedObjects []oid.Address
|
||||||
|
|
||||||
if err := db.boltDB.Update(func(tx *bbolt.Tx) error {
|
if err := db.boltDB.Batch(func(tx *bbolt.Tx) error {
|
||||||
for i := range lockers {
|
for i := range lockers {
|
||||||
unlocked, err := freePotentialLocks(tx, lockers[i].Container(), lockers[i].Object())
|
unlocked, err := freePotentialLocks(tx, lockers[i].Container(), lockers[i].Object())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue