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

Log message is not right for TTL job cancel #55098

Closed
lcwangchao opened this issue Jul 31, 2024 · 1 comment · Fixed by #55099
Closed

Log message is not right for TTL job cancel #55098

lcwangchao opened this issue Jul 31, 2024 · 1 comment · Fixed by #55099

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

When a TTL job is running, set tidb_ttl_job_schedule_window_start_time and tidb_ttl_job_schedule_window_end_time to trigger the job cancel for the current time is out of the time window.

Check the log.

2. What did you expect to see? (Required)

The cancel reason in message should be the current time is out of time window.

3. What did you see instead (Required)

[2024/07/31 16:39:16.585 +08:00] [INFO] [job_manager.go:589] ["cancel job because tidb_ttl_job_enable turned off"] [ttl-worker=job-manager] [jobID=904b49393e3d4b0ea4d24fbe502b2b83]

4. What is your TiDB version? (Required)

@lcwangchao
Copy link
Collaborator Author

The below code gives the same message even if the job cancelled for out of window

if !variable.EnableTTLJob.Load() || !timeutil.WithinDayTimePeriod(variable.TTLJobScheduleWindowStartTime.Load(), variable.TTLJobScheduleWindowEndTime.Load(), now) {
if len(m.runningJobs) > 0 {
for _, job := range m.runningJobs {
logutil.Logger(m.ctx).Info("cancel job because tidb_ttl_job_enable turned off", zap.String("jobID", job.id))
summary, err := summarizeErr(errors.New("ttl job is disabled"))
if err != nil {
logutil.Logger(m.ctx).Info("fail to summarize job", zap.Error(err))
}
m.removeJob(job)
job.finish(se, now, summary)
}
}

@ti-chi-bot ti-chi-bot bot closed this as completed in 3a93c73 Jul 31, 2024
hawkingrei pushed a commit to hawkingrei/tidb that referenced this issue Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant