Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

domain: adjust initialization sequence of domain-reload and ddl-start to avoid infoCache nil #28945

Merged
merged 10 commits into from
Oct 21, 2021
Prev Previous commit
Next Next commit
fmt
Signed-off-by: ailinkid <314806019@qq.com>
  • Loading branch information
AilinKid committed Oct 19, 2021
commit 2a0684b2b8902c639a2051d526aca1065f773156
16 changes: 8 additions & 8 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,14 @@ func (do *Domain) Init(ddlLease time.Duration, sysFactory func(*Domain) (pools.R
ddl.WithHook(callback),
ddl.WithLease(ddlLease),
)
err = do.Reload()
if err != nil {
return err
}
err = do.ddl.Start(sysCtxPool)
if err != nil {
return err
}
failpoint.Inject("MockReplaceDDL", func(val failpoint.Value) {
if val.(bool) {
if err := do.ddl.Stop(); err != nil {
Expand Down Expand Up @@ -774,14 +782,6 @@ func (do *Domain) Init(ddlLease time.Duration, sysFactory func(*Domain) (pools.R
if err != nil {
return err
}
err = do.Reload()
if err != nil {
return err
}
err = do.ddl.Start(sysCtxPool)
if err != nil {
return err
}
// Only when the store is local that the lease value is 0.
// If the store is local, it doesn't need loadSchemaInLoop.
if ddlLease > 0 {
Expand Down