[#1412] metabase: Run bucket drop steps on upgrade concurrently
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
8093e145b3
commit
87f4b934d1
1 changed files with 13 additions and 9 deletions
|
@ -119,13 +119,17 @@ func upgradeFromV2ToV3(ctx context.Context, db *bbolt.DB, cs container.InfoProvi
|
||||||
if err := createExpirationEpochBuckets(ctx, db, log); err != nil {
|
if err := createExpirationEpochBuckets(ctx, db, log); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := dropUserAttributes(ctx, db, cs, log); err != nil {
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
return err
|
eg.Go(func() error {
|
||||||
}
|
return dropUserAttributes(ctx, db, cs, log)
|
||||||
if err := dropOwnerIDIndex(ctx, db, log); err != nil {
|
})
|
||||||
return err
|
eg.Go(func() error {
|
||||||
}
|
return dropOwnerIDIndex(ctx, db, log)
|
||||||
if err := dropPayloadChecksumIndex(ctx, db, log); err != nil {
|
})
|
||||||
|
eg.Go(func() error {
|
||||||
|
return dropPayloadChecksumIndex(ctx, db, log)
|
||||||
|
})
|
||||||
|
if err := eg.Wait(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return db.Update(func(tx *bbolt.Tx) error {
|
return db.Update(func(tx *bbolt.Tx) error {
|
||||||
|
@ -360,7 +364,7 @@ func dropUserAttributes(ctx context.Context, db *bbolt.DB, cs container.InfoProv
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
if err := db.Batch(func(tx *bbolt.Tx) error {
|
||||||
for _, k := range keysToDrop {
|
for _, k := range keysToDrop {
|
||||||
if err := tx.DeleteBucket(k); err != nil {
|
if err := tx.DeleteBucket(k); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -439,7 +443,7 @@ func dropBucketsByPrefix(ctx context.Context, db *bbolt.DB, prefix []byte, log f
|
||||||
log("deleting buckets completed successfully, deleted", count, "buckets")
|
log("deleting buckets completed successfully, deleted", count, "buckets")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err := db.Update(func(tx *bbolt.Tx) error {
|
if err := db.Batch(func(tx *bbolt.Tx) error {
|
||||||
for _, k := range keys {
|
for _, k := range keys {
|
||||||
if err := tx.DeleteBucket(k); err != nil {
|
if err := tx.DeleteBucket(k); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue