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 1 commit
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));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public TFeResult loadCheck(TLoadCheckRequest request) throws TException {
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
status.setError_msgs(Lists.newArrayList(Strings.nullToEmpty(e.getMessage())));
return result;
}

Expand All @@ -580,7 +580,13 @@ public TLoadTxnBeginResult loadTxnBegin(TLoadTxnBeginRequest request) throws TEx
} catch (UserException e) {
status.setStatus_code(TStatusCode.ANALYSIS_ERROR);
status.setError_msgs(Lists.newArrayList(e.getMessage()));
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
status.setStatus_code(TStatusCode.INTERNAL_ERROR);
status.setError_msgs(Lists.newArrayList(Strings.nullToEmpty(e.getMessage())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call status.addToError_msgs instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

return result;
}

return result;
}

Expand Down Expand Up @@ -630,6 +636,11 @@ public TLoadTxnCommitResult loadTxnCommit(TLoadTxnCommitRequest 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.setError_msgs(Lists.newArrayList(Strings.nullToEmpty(e.getMessage())));
return result;
}
return result;
}
Expand Down Expand Up @@ -674,6 +685,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.setError_msgs(Lists.newArrayList(Strings.nullToEmpty(e.getMessage())));
return result;
}

return result;
Expand Down Expand Up @@ -704,6 +720,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.setError_msgs(Lists.newArrayList(Strings.nullToEmpty(e.getMessage())));
return result;
}
return result;
}
Expand Down