Skip to content

Commit

Permalink
[chore](log) Add log to trace query cancel apache#28020
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiang-hhhh authored and 胥剑旭 committed Dec 14, 2023
1 parent b85e60e commit e148d46
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 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 @@ -622,10 +622,9 @@ public void exec() throws Exception {
context.setResultInternalServiceAddr(toBrpcHost(execBeAddr));
context.setResultOutputExprs(fragments.get(0).getOutputExprs());
}
if (LOG.isDebugEnabled()) {
LOG.debug("dispatch result sink of query {} to {}", DebugUtil.printId(queryId),
topParams.instanceExecParams.get(0).host);
}

LOG.info("dispatch result sink of query {} to {}", DebugUtil.printId(queryId),
topParams.instanceExecParams.get(0).host);

if (topDataSink instanceof ResultFileSink
&& ((ResultFileSink) topDataSink).getStorageType() == StorageBackend.StorageType.BROKER) {
Expand Down Expand Up @@ -2540,12 +2539,19 @@ public void updateFragmentExecStatus(TReportExecStatusParams params) {
// for now, abort the query if we see any error except if the error is cancelled
// and returned_all_results_ is true.
// (UpdateStatus() initiates cancellation, if it hasn't already been initiated)
if (!(returnedAllResults && status.isCancelled()) && !status.ok()) {
LOG.warn("one instance report fail, query_id={} instance_id={}, error message: {}",
DebugUtil.printId(queryId), DebugUtil.printId(params.getFragmentInstanceId()),
status.getErrorMsg());
updateStatus(status, params.getFragmentInstanceId());
if (!status.ok()) {
if (status.isCancelled() && returnedAllResults) {
LOG.warn("Query {} has returned all results, its instance {} is reporting failed status {}",
DebugUtil.printId(queryId), DebugUtil.printId(params.getFragmentInstanceId()),
status.getErrorMsg());
} else {
LOG.warn("Instance {} of query {} report failed status, error msg: {}",
DebugUtil.printId(queryId), DebugUtil.printId(params.getFragmentInstanceId()),
status.getErrorMsg());
updateStatus(status, params.getFragmentInstanceId());
}
}

if (execState.done) {
if (params.isSetDeltaUrls()) {
updateDeltas(params.getDeltaUrls());
Expand Down Expand Up @@ -2968,12 +2974,10 @@ public synchronized void printProfile(StringBuilder builder) {
// cancel the fragment instance.
// return true if cancel success. Otherwise, return false
public synchronized boolean cancelFragmentInstance(Types.PPlanFragmentCancelReason cancelReason) {
if (LOG.isDebugEnabled()) {
LOG.debug("cancelRemoteFragments initiated={} done={} hasCanceled={} backend: {},"
+ " fragment instance id={}, reason: {}",
this.initiated, this.done, this.hasCanceled, backend.getId(),
DebugUtil.printId(fragmentInstanceId()), cancelReason.name());
}
LOG.warn("cancelRemoteFragments initiated={} done={} hasCanceled={} backend: {},"
+ " fragment instance id={}, reason: {}",
this.initiated, this.done, this.hasCanceled, backend.getId(),
DebugUtil.printId(fragmentInstanceId()), cancelReason.name());
try {
if (!this.initiated) {
return false;
Expand Down Expand Up @@ -3160,13 +3164,11 @@ public synchronized boolean cancelFragmentInstance(Types.PPlanFragmentCancelReas
return false;
}
for (TPipelineInstanceParams localParam : rpcParams.local_params) {
if (LOG.isDebugEnabled()) {
LOG.debug("cancelRemoteFragments initiated={} done={} hasCanceled={} backend: {},"
+ " fragment instance id={} query={}, reason: {}",
this.initiated, this.done, this.hasCanceled, backend.getId(),
DebugUtil.printId(localParam.fragment_instance_id),
DebugUtil.printId(queryId), cancelReason.name());
}
LOG.warn("cancelRemoteFragments initiated={} done={} hasCanceled={} backend:{},"
+ " fragment instance id={} query={}, reason: {}",
this.initiated, this.done, this.hasCanceled, backend.getId(),
DebugUtil.printId(localParam.fragment_instance_id),
DebugUtil.printId(queryId), cancelReason.name());

RuntimeProfile profile = fragmentInstancesMap.get(localParam.fragment_instance_id);
if (profile.getIsDone() || profile.getIsCancel()) {
Expand Down

0 comments on commit e148d46

Please sign in to comment.