Skip to content

Commit a53679b

Browse files
authored
[fix](load) fix empty statistics for forwarded INSERT (apache#64439)
### What problem does this PR solve? When `INSERT INTO ... SELECT` is forwarded from a follower FE to the master FE, `SHOW LOAD` could show an empty `JobDetails`, such as `ScannedRows=0`, `LoadBytes=0`, `TaskNumber=0`, and empty backend lists. The root cause is that the insert load job is registered with a real `jobId`, but when coordinator creation falls back to the regular `Coordinator` / `CloudCoordinator` path, that `jobId` was not passed into the coordinator. Therefore, the coordinator kept the default `jobId=-1` and did not initialize or update the corresponding `LoadManager` progress. The load job was still recorded as `FINISHED`, but its `LoadStatistic` remained empty when `SHOW LOAD` rendered `JobDetails`. This PR preserves the insert `jobId` in the regular `Coordinator` and `CloudCoordinator` fallback paths, so `initJobProgress()` and `updateJobProgress()` update the same `InsertLoadJob` that is later recorded and displayed by `SHOW LOAD`.
1 parent a20a0df commit a53679b

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/catalog/EnvFactory.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public Coordinator createCoordinator(ConnectContext context, Planner planner,
156156
if (planner instanceof NereidsPlanner && SessionVariable.canUseNereidsDistributePlanner(context)) {
157157
return new NereidsCoordinator(context, (NereidsPlanner) planner, statsErrorEstimator, jobId);
158158
}
159-
return new Coordinator(context, planner, statsErrorEstimator);
159+
return new Coordinator(context, planner, statsErrorEstimator, jobId);
160160
}
161161

162162
// Used for broker load task/export task/update coordinator

‎fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudEnvFactory.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public Coordinator createCoordinator(ConnectContext context, Planner planner,
170170
if (planner instanceof NereidsPlanner && SessionVariable.canUseNereidsDistributePlanner()) {
171171
return new NereidsCoordinator(context, (NereidsPlanner) planner, statsErrorEstimator, jobId);
172172
}
173-
return new CloudCoordinator(context, planner, statsErrorEstimator);
173+
return new CloudCoordinator(context, planner, statsErrorEstimator, jobId);
174174
}
175175

176176
@Override

‎fe/fe-core/src/main/java/org/apache/doris/cloud/qe/CloudCoordinator.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public CloudCoordinator(ConnectContext context,
4545
super(context, planner, statsErrorEstimator);
4646
}
4747

48+
public CloudCoordinator(ConnectContext context,
49+
Planner planner, StatsErrorEstimator statsErrorEstimator, long jobId) {
50+
super(context, planner, statsErrorEstimator, jobId);
51+
}
52+
4853
public CloudCoordinator(Long jobId, TUniqueId queryId, DescriptorTable descTable, List<PlanFragment> fragments,
4954
List<ScanNode> scanNodes, String timezone, boolean loadZeroTolerance,
5055
boolean enbaleProfile) {

‎fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ public Coordinator(ConnectContext context, Planner planner,
333333
this.statsErrorEstimator = statsErrorEstimator;
334334
}
335335

336+
public Coordinator(ConnectContext context, Planner planner,
337+
StatsErrorEstimator statsErrorEstimator, long jobId) {
338+
this(context, planner, statsErrorEstimator);
339+
this.jobId = jobId;
340+
}
341+
336342
// Used for query/insert/test
337343
public Coordinator(ConnectContext context, Planner planner) {
338344
this.context = context;

0 commit comments

Comments
 (0)