Skip to content

Commit

Permalink
executor: verify the existence of the resource group before switching (
Browse files Browse the repository at this point in the history
  • Loading branch information
JmPotato authored Sep 22, 2024
1 parent 2761fe0 commit 1acbbec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,12 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) {
return nil, err
}
if len(switchGroupName) > 0 {
stmtCtx.ResourceGroupName = switchGroupName
group, err := rm.ResourceGroupCtl.GetResourceGroup(switchGroupName)
if err != nil || group == nil {
logutil.BgLogger().Debug("invalid switch resource group", zap.String("switch-group-name", switchGroupName), zap.Error(err))
} else {
stmtCtx.ResourceGroupName = switchGroupName
}
}
}
ctx = a.observeStmtBeginForTopSQL(ctx)
Expand Down

0 comments on commit 1acbbec

Please sign in to comment.