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

modify mo_task primary key type to bigint in 1.1 #14809

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var (
catalog.MOTaskDB),

fmt.Sprintf(`create table %s.sys_async_task (
task_id int primary key auto_increment,
task_id bigint primary key auto_increment,
task_metadata_id varchar(50) unique not null,
task_metadata_executor int,
task_metadata_context blob,
Expand All @@ -103,7 +103,7 @@ var (
catalog.MOTaskDB),

fmt.Sprintf(`create table %s.sys_cron_task (
cron_task_id int primary key auto_increment,
cron_task_id bigint primary key auto_increment,
task_metadata_id varchar(50) unique not null,
task_metadata_executor int,
task_metadata_context blob,
Expand All @@ -116,7 +116,7 @@ var (
catalog.MOTaskDB),

fmt.Sprintf(`create table %s.sys_daemon_task (
task_id int primary key auto_increment,
task_id bigint primary key auto_increment,
task_metadata_id varchar(50),
task_metadata_executor int,
task_metadata_context blob,
Expand Down
12 changes: 11 additions & 1 deletion pkg/sql/plan/function/ctl/cmd_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
var (
disableTask = "disable"
enableTask = "enable"
getUser = "getuser"

taskMap = map[string]int32{
"storageusage": int32(taskpb.TaskCode_MetricStorageUsage),
Expand All @@ -47,6 +48,7 @@ func handleTask(proc *process.Process,
service serviceType,
parameter string,
sender requestSender) (Result, error) {
parameter = strings.ToLower(parameter)
switch parameter {
case disableTask:
taskservice.DebugCtlTaskFramwork(true)
Expand All @@ -60,6 +62,15 @@ func handleTask(proc *process.Process,
Method: TaskMethod,
Data: "OK",
}, nil
case getUser:
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
state, err := proc.Hakeeper.GetClusterState(ctx)
cancel()
if err != nil {
return Result{Method: TaskMethod, Data: "failed to get cluster state"}, err
}
user := state.GetTaskTableUser()
return Result{Method: TaskMethod, Data: user}, nil
default:
}

Expand All @@ -78,7 +89,6 @@ func handleTask(proc *process.Process,
}

func checkRunTaskParameter(param string) (string, int32, error) {
param = strings.ToLower(param)
// uuid:taskId
args := strings.Split(param, ":")
if len(args) != 2 {
Expand Down
Loading