Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid 'No more data to read' error when handling stream load RPC #354

Merged
merged 2 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions fe/src/main/java/org/apache/doris/common/UserException.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@

package org.apache.doris.common;

import com.google.common.base.Strings;

/**
* Thrown for internal server errors.
*/
public class UserException extends Exception {
public UserException(String msg, Throwable cause) {
super(msg, cause);
super(Strings.nullToEmpty(msg), cause);
}

public UserException(Throwable cause) {
super(cause);
}

public UserException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
public UserException(String msg, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(Strings.nullToEmpty(msg), cause, enableSuppression, writableStackTrace);
}

public UserException(String msg) {
super(msg);
super(Strings.nullToEmpty(msg));
}

}
40 changes: 30 additions & 10 deletions fe/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ public TFeResult miniLoad(TMiniLoadRequest request) throws TException {
} catch (UserException e) {
LOG.warn("add mini load error", e);
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.addToError_msgs(e.getMessage());
} catch (Throwable e) {
LOG.warn("unexpected exception when adding mini load", e);
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.addToError_msgs(Strings.nullToEmpty(e.getMessage()));
} finally {
ConnectContext.remove();
}
Expand Down Expand Up @@ -465,7 +465,7 @@ public TFeResult updateMiniEtlTaskStatus(TUpdateMiniEtlTaskStatusRequest request
String failMsg = "job does not exist. id: " + jobId;
LOG.warn(failMsg);
status.setStatus_code(TStatusCode.CANCELLED);
status.setError_msgs(Lists.newArrayList(failMsg));
status.addToError_msgs(failMsg);
return result;
}

Expand All @@ -474,7 +474,7 @@ public TFeResult updateMiniEtlTaskStatus(TUpdateMiniEtlTaskStatusRequest request
String failMsg = "task info does not exist. task id: " + taskId + ", job id: " + jobId;
LOG.warn(failMsg);
status.setStatus_code(TStatusCode.CANCELLED);
status.setError_msgs(Lists.newArrayList(failMsg));
status.addToError_msgs(failMsg);
return result;
}

Expand Down Expand Up @@ -554,12 +554,12 @@ public TFeResult loadCheck(TLoadCheckRequest request) throws TException {
request.getTbl(), request.getUser_ip(), PrivPredicate.LOAD);
} catch (UserException e) {
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.addToError_msgs(e.getMessage());
return result;
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.addToError_msgs(Strings.nullToEmpty(e.getMessage()));
return result;
}

Expand All @@ -576,11 +576,17 @@ public TLoadTxnBeginResult loadTxnBegin(TLoadTxnBeginRequest request) throws TEx
result.setTxnId(loadTxnBeginImpl(request));
} catch (LabelAlreadyExistsException e) {
status.setStatus_code(TStatusCode.LABEL_ALREADY_EXISTS);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.addToError_msgs(e.getMessage());
} catch (UserException e) {
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.addToError_msgs(e.getMessage());
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.addToError_msgs(Strings.nullToEmpty(e.getMessage()));
return result;
}

return result;
}

Expand Down Expand Up @@ -624,12 +630,16 @@ public TLoadTxnCommitResult loadTxnCommit(TLoadTxnCommitRequest request) throws
if (!loadTxnCommitImpl(request)) {
// committed success but not visible
status.setStatus_code(TStatusCode.PUBLISH_TIMEOUT);
status.setError_msgs(
Lists.newArrayList("transaction commit successfully, BUT data will be visible later"));
status.addToError_msgs("transaction commit successfully, BUT data will be visible later");
}
} catch (UserException e) {
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.addToError_msgs(e.getMessage());
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.addToError_msgs(Strings.nullToEmpty(e.getMessage()));
return result;
}
return result;
}
Expand Down Expand Up @@ -674,6 +684,11 @@ public TLoadTxnRollbackResult loadTxnRollback(TLoadTxnRollbackRequest request) t
} catch (UserException e) {
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.addToError_msgs(e.getMessage());
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.addToError_msgs(Strings.nullToEmpty(e.getMessage()));
return result;
}

return result;
Expand Down Expand Up @@ -704,6 +719,11 @@ public TStreamLoadPutResult streamLoadPut(TStreamLoadPutRequest request) throws
} catch (UserException e) {
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.addToError_msgs(e.getMessage());
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.addToError_msgs(Strings.nullToEmpty(e.getMessage()));
return result;
}
return result;
}
Expand Down