Add LOG.isDebugEnabled for some debug logical of Coordinator (#3352)

This may very slightly affect the performance or not.
This commit is contained in:
Yunfeng,Wu
2020-04-20 08:30:57 +08:00
committed by GitHub
parent 929e93699a
commit 753d6cc19f

View File

@ -377,12 +377,12 @@ public class Coordinator {
// be for a query like 'SELECT 1').
// A call to Exec() must precede all other member function calls.
public void exec() throws Exception {
if (!scanNodes.isEmpty()) {
if (LOG.isDebugEnabled() && !scanNodes.isEmpty()) {
LOG.debug("debug: in Coordinator::exec. query id: {}, planNode: {}",
DebugUtil.printId(queryId), scanNodes.get(0).treeToThrift());
}
if (!fragments.isEmpty()) {
if (LOG.isDebugEnabled() && !fragments.isEmpty()) {
LOG.debug("debug: in Coordinator::exec. query id: {}, fragment: {}",
DebugUtil.printId(queryId), fragments.get(0).toThrift());
}
@ -461,8 +461,10 @@ public class Coordinator {
backendExecStates.add(execState);
if (needCheckBackendState) {
needCheckBackendExecStates.add(execState);
LOG.debug("add need check backend {} for fragment, {} job: {}", execState.backend.getId(),
fragment.getFragmentId().asInt(), jobId);
if (LOG.isDebugEnabled()) {
LOG.debug("add need check backend {} for fragment, {} job: {}", execState.backend.getId(),
fragment.getFragmentId().asInt(), jobId);
}
}
futures.add(Pair.create(execState, execState.execRemoteFragmentAsync()));
@ -722,7 +724,9 @@ public class Coordinator {
// assign instance ids
instanceIds.clear();
for (FragmentExecParams params : fragmentExecParamsMap.values()) {
LOG.debug("fragment {} has instances {}", params.fragment.getFragmentId(), params.instanceExecParams.size());
if (LOG.isDebugEnabled()) {
LOG.debug("fragment {} has instances {}", params.fragment.getFragmentId(), params.instanceExecParams.size());
}
for (int j = 0; j < params.instanceExecParams.size(); ++j) {
// we add instance_num to query_id.lo to create a
// globally-unique instance id
@ -1373,9 +1377,11 @@ public class Coordinator {
// cancel the fragment instance.
// return true if cancel success. Otherwise, return false
public synchronized boolean cancelFragmentInstance(PPlanFragmentCancelReason cancelReason) {
LOG.debug("cancelRemoteFragments initiated={} done={} hasCanceled={} backend: {}, fragment instance id={}, reason: {}",
this.initiated, this.done, this.hasCanceled, backend.getId(),
DebugUtil.printId(fragmentInstanceId()), cancelReason.name());
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());
}
try {
if (!this.initiated) {
return false;