[import] SHOW IMPORT JOB returns a nil pointer error when a finished job has NULL summary
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
### 1. Minimal reproduce step (Required)
1. Complete any successful `IMPORT INTO` job and note its job ID. The job must be in the `finished` state.
2. As a privileged user, make the persisted job metadata inconsistent by clearing its optional summary:
```sql
UPDATE mysql.tidb_import_jobs
SET summary = NULL
WHERE id = AND status = 'finished';
```
3. Query the job:
```sql
SHOW IMPORT JOB ;
```
### 2. What did you expect to see? (Required)
`SHOW IMPORT JOB` should return the job record without failing. If the persisted summary is missing, the imported-row/conflicted-row fields should be represented as `NULL`, zero, or another documented unavailable value.
### 3. What did you see instead (Required)
The statement fails with:
```text
ERROR 1105 (HY000):
runtime error: invalid memory address or nil pointer dereference
```
The failure is in the successful-job display path, which dereferences `Summary` without checking whether it is `NULL`.
This is a robustness issue for inconsistent Import job metadata. Normal Import completion currently persists a non-`NULL` summary, so the reproduction intentionally creates the inconsistent `finished` + `summary IS NULL` state. The behavior was directly reproduced on v8.5.8.
This display path is related to the conflict-summary support introduced by [PR #64710](https://github.com/pingcap/tidb/pull/64710), which references [issue #60621](https://github.com/pingcap/tidb/issues/60621). This report is a separate defensive-handling issue.
### 4. What is your TiDB version? (Required)
This was directly reproduced on TiDB `8.0.11-TiDB-v8.5.8` (v8.5.8). The exact output of `SELECT tidb_version()` was not preserved.
Contributor guide
Research direction
Start by locating the SHOW IMPORT JOB implementation and its successful-job display path, then trace how the persisted Summary is read for a finished job. Reproduce the NULL-summary state with the SQL shown and verify that SHOW IMPORT JOB returns the record without a nil-pointer error, with unavailable summary fields represented consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100