Skip to content

Commit

Permalink
fix(interactive): Refine Log Printing Messages in Compiler (#3381)
Browse files Browse the repository at this point in the history
  • Loading branch information
shirly121 authored Dec 1, 2023
1 parent 300d921 commit f5ebd08
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import org.apache.tinkerpop.gremlin.server.handler.Frame;
import org.apache.tinkerpop.gremlin.server.handler.StateKey;
import org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -44,8 +42,6 @@

public abstract class AbstractResultProcessor extends StandardOpProcessor
implements ResultProcessor {
private static Logger logger = LoggerFactory.getLogger(AbstractResultProcessor.class);

protected final Context writeResult;
protected final ResultParser resultParser;
protected final QueryStatusCallback statusCallback;
Expand Down Expand Up @@ -89,7 +85,7 @@ public synchronized void process(PegasusClient.JobResponse response) {
resultCollectors.addAll(resultParser.parseFrom(response));
}
} catch (Exception e) {
statusCallback.getQueryLogger().error("process response from grpc fail", e);
statusCallback.getQueryLogger().error("process response from grpc fail, msg: {}", e);
// cannot write to this context any more
isContextWritable = false;
statusCallback.onEnd(false, null);
Expand All @@ -112,7 +108,7 @@ public synchronized void finish() {

@Override
public synchronized void error(Status status) {
logger.error("error return from grpc, status {}", status);
statusCallback.getQueryLogger().error("error return from grpc, msg: {}", status);
if (isContextWritable) {
isContextWritable = false;
statusCallback.onEnd(false, status.getDescription());
Expand Down Expand Up @@ -169,28 +165,33 @@ protected void writeResultList(
if (frame != null) {
frame.tryRelease();
}
logger.error(
"write "
+ resultList.size()
+ " result to context "
+ context
+ " status code=>"
+ statusCode
+ " fail",
e);
statusCallback
.getQueryLogger()
.error(
"write "
+ resultList.size()
+ " result to context "
+ context
+ " status code=>"
+ statusCode
+ " fail, msg: {}",
e);
throw new RuntimeException(e);
}
} else {
if (retryOnce) {
String message =
"write result to context fail for context " + msg + " is too busy";
logger.error(message);
statusCallback.getQueryLogger().error(message);
throw new RuntimeException(message);
} else {
logger.warn(
"Pausing response writing as writeBufferHighWaterMark exceeded on "
+ msg
+ " - writing will continue once client has caught up");
statusCallback
.getQueryLogger()
.warn(
"Pausing response writing as writeBufferHighWaterMark exceeded"
+ " on "
+ msg
+ " - writing will continue once client has caught up");
retryOnce = true;
try {
TimeUnit.MILLISECONDS.sleep(10L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void onError(Throwable throwable) {
return;
}
Status status = Status.fromThrowable(throwable);
logger.error("get job response error: {}", status);
logger.debug("get job response error: {}", status);
processor.error(status);
}

Expand Down

0 comments on commit f5ebd08

Please sign in to comment.