Skip to content

Commit

Permalink
throw exception when commit transaction failed
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaorongsheng committed Jun 5, 2024
1 parent 61852e8 commit 8865427
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,11 @@ public void commit(long txnId) throws StreamLoadException {
String loadResult = EntityUtils.toString(response.getEntity());
Map<String, String> res = MAPPER.readValue(loadResult, new TypeReference<HashMap<String, String>>() {
});
if (res.get("status").equals("Fail") && !ResponseUtil.isCommitted(res.get("msg"))) {
throw new StreamLoadException("Commit failed " + loadResult);
if (res.get("status").equals("Success") || ResponseUtil.isCommitted(res.get("msg"))) {
LOG.info("commit transaction {} succeed, load result: {}.", txnId, loadResult);
} else {
LOG.info("load result {}", loadResult);
LOG.error("commit transaction {} failed. load result: {}", txnId, loadResult);
throw new StreamLoadException("Commit failed " + loadResult);
}
}

Expand Down

0 comments on commit 8865427

Please sign in to comment.