Skip to content

Commit

Permalink
[log](s3) return detailed error message to the user
Browse files Browse the repository at this point in the history
  • Loading branch information
kaijchen committed Aug 19, 2024
1 parent 21b3228 commit c9a52ba
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,14 @@ private void checkObjectStorageInfo() throws UserException {
} catch (Exception e) {
LOG.warn("Failed to access object storage, proto={}, err={}",
stageProperties.getObjectStoreInfoPB(), e.toString());
String msg;
if (e instanceof UserException ue) {
msg = ue.getDetailMessage();
} else {
msg = e.getMessage();
}
throw new UserException(InternalErrorCode.GET_REMOTE_DATA_ERROR,
"Failed to access object storage", e);
"Failed to access object storage, message=" + msg, e);
} finally {
if (remote != null) {
remote.close();
Expand Down
17 changes: 15 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/analysis/LoadStmt.java
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,14 @@ private void checkEndpoint(String endpoint) throws UserException {
connection.connect();
} catch (Exception e) {
LOG.warn("Failed to connect endpoint={}, err={}", endpoint, e);
throw new UserException("Failed to access object storage", e);
String msg;
if (e instanceof UserException ue) {
msg = ue.getDetailMessage();
} else {
msg = e.getMessage();
}
throw new UserException(InternalErrorCode.GET_REMOTE_DATA_ERROR,
"Failed to access object storage, message=" + msg, e);
} finally {
if (connection != null) {
try {
Expand Down Expand Up @@ -674,8 +681,14 @@ private void checkAkSk() throws UserException {
}
} catch (Exception e) {
LOG.warn("Failed to access object storage, file={}, proto={}, err={}", curFile, objectInfo, e.toString());
String msg;
if (e instanceof UserException ue) {
msg = ue.getDetailMessage();
} else {
msg = e.getMessage();
}
throw new UserException(InternalErrorCode.GET_REMOTE_DATA_ERROR,
"Failed to access object storage", e);
"Failed to access object storage, message=" + msg, e);
} finally {
if (remote != null) {
remote.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ suite("test_domain_connection_and_ak_sk_correction", "load_p0") {
assertTrue(false. "The endpoint is wrong, so the connection test should fale")
} catch (Exception e) {
logger.info("the second sql exception result is {}", e.getMessage())
assertTrue(e.getMessage().contains("Failed to access object storage"), e.getMessage())
assertTrue(e.getMessage().contains("Failed to access object storage, message="), e.getMessage())
}

label = UUID.randomUUID().toString().replace("-", "")
Expand All @@ -125,7 +125,7 @@ suite("test_domain_connection_and_ak_sk_correction", "load_p0") {
assertTrue(false. "AK is wrong, so the correction of AKSK test should fale")
} catch (Exception e) {
logger.info("the third sql exception result is {}", e.getMessage())
assertTrue(e.getMessage().contains("Failed to access object storage"), e.getMessage())
assertTrue(e.getMessage().contains("Failed to access object storage, message="), e.getMessage())
}

label = UUID.randomUUID().toString().replace("-", "")
Expand Down Expand Up @@ -154,7 +154,7 @@ suite("test_domain_connection_and_ak_sk_correction", "load_p0") {
assertTrue(false. "in the second DATA INFILE, the first bucket is wrong, so the sql should fail")
} catch (Exception e) {
logger.info("the fourth sql exception result is {}", e.getMessage())
assertTrue(e.getMessage().contains("Failed to access object storage"), e.getMessage())
assertTrue(e.getMessage().contains("Failed to access object storage, message="), e.getMessage())
}
sql """ DROP TABLE IF EXISTS ${tableName} FORCE"""
sql """ DROP TABLE IF EXISTS ${tableNameOrders} FORCE"""
Expand Down

0 comments on commit c9a52ba

Please sign in to comment.