sollhui opened a new pull request, #62331:
URL: https://github.com/apache/doris/pull/62331
## Problem
After a FE restart, `SHOW LOAD` for finished INSERT jobs shows all-zero
`JobDetails` (`ScannedRows`, `LoadBytes`, etc.), even though the values
were correct before the restart.
Root cause: `LoadStatistic` (which holds the in-memory counters) has no
`@SerializedName` annotation in `LoadJob`, so it is never written to the
edit log. On replay the field is re-initialized as an empty `LoadStatistic`.
A second issue exists when `enable_nereids_load=true`: `afterExec()` skips
`recordFinishedLoadJob` entirely, so the `InsertLoadJob` is never persisted
to the edit log at all and disappears completely after restart.
## Fix
**`InsertLoadJob`**
- Add `@SerializedName("jdj") private String jobDetailsJson` to capture a
JSON snapshot of `loadStatistic` at the moment the job finishes.
- In `setJobProperties()` (called when the job transitions to
FINISHED/CANCELLED), snapshot `loadStatistic.toJson()` into
`jobDetailsJson`.
- Override `getJobDetailsJson()` to return the persisted snapshot when
available, falling back to the live `loadStatistic` during execution.
**`LoadJob`**
- Extract `protected String getJobDetailsJson()` (defaults to
`loadStatistic.toJson()`) so subclasses can override the stats source
used by `getShowInfoUnderLock()`.
**`OlapInsertExecutor`**
- Remove the `!Config.enable_nereids_load` guard in `afterExec()` so that
`recordFinishedLoadJob` is always called when `jobId != -1`. This ensures
the job is persisted to the edit log and its statistics are captured
regardless of the config value.
## Test
Added `test_insert_statistic_after_fe_restart` docker regression test that:
1. Inserts rows via `INSERT INTO ... SELECT`
2. Reads and records `JobDetails` from `SHOW LOAD`
3. Restarts FE
4. Asserts `ScannedRows`, `LoadBytes`, `FileNumber`, `FileSize` are
unchanged after restart
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]