Skip to content

Commit

Permalink
[fix](profile) Fix content missing of brokerload profile (#33969)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh authored Apr 23, 2024
1 parent e78db71 commit a7221f2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ public Coordinator createCoordinator(ConnectContext context, Analyzer analyzer,
return new Coordinator(context, analyzer, planner, statsErrorEstimator);
}

// Used for broker load task/export task/update coordinator
public Coordinator createCoordinator(Long jobId, TUniqueId queryId, DescriptorTable descTable,
List<PlanFragment> fragments, List<ScanNode> scanNodes,
String timezone, boolean loadZeroTolerance) {
return new Coordinator(jobId, queryId, descTable, fragments, scanNodes, timezone, loadZeroTolerance);
String timezone, boolean loadZeroTolerance, boolean enableProfile) {
return new Coordinator(jobId, queryId, descTable, fragments, scanNodes, timezone, loadZeroTolerance,
enableProfile);
}

public GroupCommitPlanner createGroupCommitPlanner(Database db, OlapTable table, List<String> targetColumnNames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ public Coordinator createCoordinator(ConnectContext context, Analyzer analyzer,
@Override
public Coordinator createCoordinator(Long jobId, TUniqueId queryId, DescriptorTable descTable,
List<PlanFragment> fragments, List<ScanNode> scanNodes,
String timezone, boolean loadZeroTolerance) {
return new CloudCoordinator(jobId, queryId, descTable, fragments, scanNodes, timezone, loadZeroTolerance);
String timezone, boolean loadZeroTolerance, boolean enableProfile) {
return new CloudCoordinator(jobId, queryId, descTable, fragments, scanNodes, timezone, loadZeroTolerance,
enableProfile);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ public CloudCoordinator(ConnectContext context, Analyzer analyzer,
}

public CloudCoordinator(Long jobId, TUniqueId queryId, DescriptorTable descTable, List<PlanFragment> fragments,
List<ScanNode> scanNodes, String timezone, boolean loadZeroTolerance) {
super(jobId, queryId, descTable, fragments, scanNodes, timezone, loadZeroTolerance);
List<ScanNode> scanNodes, String timezone, boolean loadZeroTolerance,
boolean enbaleProfile) {
super(jobId, queryId, descTable, fragments, scanNodes, timezone, loadZeroTolerance, enbaleProfile);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ protected void executeTask() throws Exception {
}

protected void executeOnce() throws Exception {
final boolean enabelProfile = this.jobProfile != null;
// New one query id,
Coordinator curCoordinator = EnvFactory.getInstance().createCoordinator(callback.getCallbackId(),
loadId, planner.getDescTable(),
planner.getFragments(), planner.getScanNodes(), planner.getTimezone(), loadZeroTolerance);
if (this.jobProfile != null) {
planner.getFragments(), planner.getScanNodes(), planner.getTimezone(), loadZeroTolerance,
enabelProfile);
if (enabelProfile) {
this.jobProfile.addExecutionProfile(curCoordinator.getExecutionProfile());
}
curCoordinator.setQueryType(TQueryType.LOAD);
Expand Down
5 changes: 3 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,20 @@ public Coordinator(ConnectContext context, Analyzer analyzer, Planner planner) {
nextInstanceId.setLo(queryId.lo + 1);
this.assignedRuntimeFilters = planner.getRuntimeFilters();
this.executionProfile = new ExecutionProfile(queryId, fragments);

}

// Used for broker load task/export task/update coordinator
// Constructor of Coordinator is too complicated.
public Coordinator(Long jobId, TUniqueId queryId, DescriptorTable descTable, List<PlanFragment> fragments,
List<ScanNode> scanNodes, String timezone, boolean loadZeroTolerance) {
List<ScanNode> scanNodes, String timezone, boolean loadZeroTolerance, boolean enableProfile) {
this.isBlockQuery = true;
this.jobId = jobId;
this.queryId = queryId;
this.descTable = descTable.toThrift();
this.fragments = fragments;
this.scanNodes = scanNodes;
this.queryOptions = new TQueryOptions();
this.queryOptions.setEnableProfile(enableProfile);
this.queryGlobals.setNowString(TimeUtils.DATETIME_FORMAT.format(LocalDateTime.now()));
this.queryGlobals.setTimestampMs(System.currentTimeMillis());
this.queryGlobals.setTimeZone(timezone);
Expand Down

0 comments on commit a7221f2

Please sign in to comment.