From e57597a6837975de9ec6e1ffeeba39ac8af71150 Mon Sep 17 00:00:00 2001 From: JmPotato Date: Fri, 9 Aug 2024 21:25:46 +0800 Subject: [PATCH] Address the comment Signed-off-by: JmPotato --- pkg/domain/resourcegroup/runaway.go | 7 ++++++- pkg/executor/infoschema_reader.go | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/domain/resourcegroup/runaway.go b/pkg/domain/resourcegroup/runaway.go index dfe3774d11f52..bd1a8d9f3b073 100644 --- a/pkg/domain/resourcegroup/runaway.go +++ b/pkg/domain/resourcegroup/runaway.go @@ -499,11 +499,16 @@ func (r *RunawayChecker) BeforeExecutor() error { // Take action if needed. switch action { case rmpb.RunawayAction_Kill: + // Return an error to interrupt the query. return exeerrors.ErrResourceGroupQueryRunawayQuarantine case rmpb.RunawayAction_CoolDown: - // This action should be done in BeforeCopRequest. + // This action will be handled in `BeforeCopRequest`. + return nil + case rmpb.RunawayAction_DryRun: + // Noop. return nil default: + // Continue to examine other convicts. } } return nil diff --git a/pkg/executor/infoschema_reader.go b/pkg/executor/infoschema_reader.go index 341d30fddc386..aa3473fdad67d 100644 --- a/pkg/executor/infoschema_reader.go +++ b/pkg/executor/infoschema_reader.go @@ -3640,10 +3640,10 @@ func (e *memtableRetriever) setDataFromRunawayWatches(sctx sessionctx.Context) e watch.ResourceGroupName, watch.StartTime.UTC().Format(time.DateTime), watch.EndTime.UTC().Format(time.DateTime), - rmpb.RunawayWatchType_name[int32(watch.Watch)], + watch.Watch.String(), watch.WatchText, watch.Source, - rmpb.RunawayAction_name[int32(action)], + action.String(), ) if watch.EndTime.Equal(resourcegroup.NullTime) { row[3].SetString("UNLIMITED", mysql.DefaultCollationName)