statistics: auto analyze window kill log has misleading timezone context
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
1. Configure auto analyze time window in a non-UTC timezone, for example:
```sql
set time_zone = '+08:00';
set global tidb_auto_analyze_start_time = '03:00';
set global tidb_auto_analyze_end_time = '18:00';
```
2. Run TiDB with logs emitted in UTC.
3. Let an auto analyze job run until TiDB checks whether it is still inside the configured auto analyze window.
TiDB prints a warning like:
```text
[2026/06/26 10:04:34.393 +00:00] [WARN] [domain.go:441] ["Kill auto analyze process because it exceeded the window"] [now=2026/06/26 10:04:34.393 +00:00] [start=03:00] [end=18:00]
```
### 2. What did you expect to see? (Required)
The warning should make the timezone used for the auto analyze window unambiguous.
`now`, `start`, and `end` should be logged in the same timezone context, or the log should explicitly state which timezone is used for the configured window.
### 3. What did you see instead (Required)
The log mixes timezone contexts. `now` is printed as UTC (`+00:00`), while `start` and `end` are shown as plain wall-clock times for the auto analyze window.
In the example above, the log appears to say `10:04 +00:00` is outside `03:00-18:00`, which is confusing when debugging why auto analyze was killed. The actual decision depends on timezone conversion, but the diagnostic log does not expose that timezone context.
The current code path formats the window using:
```go
startStr = start.Format("15:04")
endStr = end.Format("15:04")
```
so the log loses the timezone used by the window check.
Related change: https://github.com/pingcap/tidb/pull/61434
### 4. What is your TiDB version? (Required)
Not available from the report. The issue applies to builds containing the log added by https://github.com/pingcap/tidb/pull/61434.
Contributor guide
Research direction
Start at domain.go:441 and trace the warning emitted when an auto analyze job exceeds its configured window. Compare the timezone used by the window check with the values formatted for now, start, and end, and review related change PR 61434. Done means the warning makes the configured window's timezone explicit or presents all three values in the same timezone context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100