[release-11.6.2] Storage: Take `migration_locking` setting into account (#105950)

Storage: Take `migration_locking` setting into account (#105938)

(cherry picked from commit 392c1a71c9)

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
pull/105999/head
grafana-delivery-bot[bot] 1 month ago committed by GitHub
parent 57f5ce1d70
commit 28e6d9767d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      pkg/storage/unified/sql/db/migrations/migrator.go

@ -9,14 +9,16 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
func MigrateResourceStore(_ context.Context, engine *xorm.Engine, cfg *setting.Cfg) error {
// TODO: use the context.Context
func MigrateResourceStore(ctx context.Context, engine *xorm.Engine, cfg *setting.Cfg) error {
mg := migrator.NewScopedMigrator(engine, cfg, "resource")
mg.AddCreateMigration()
initResourceTables(mg)
// since it's a new feature enable migration locking by default
return mg.Start(true, 0)
sec := cfg.Raw.Section("database")
return mg.RunMigrations(
ctx,
sec.Key("migration_locking").MustBool(true),
sec.Key("locking_attempt_timeout_sec").MustInt(),
)
}

Loading…
Cancel
Save