Skip to content

Commit

Permalink
[chore](restore) Save restore stmt to the resp if RestoreSnapshot fai…
Browse files Browse the repository at this point in the history
…led (#42933)
  • Loading branch information
w41ter committed Oct 31, 2024
1 parent 0118bfd commit ccf0882
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2928,7 +2928,7 @@ private TRestoreSnapshotResult restoreSnapshotImpl(TRestoreSnapshotRequest reque
RestoreStmt restoreStmt = new RestoreStmt(label, repoName, restoreTableRefClause, properties, request.getMeta(),
request.getJobInfo());
restoreStmt.setIsBeingSynced();
LOG.trace("restore snapshot info, restoreStmt: {}", restoreStmt);
LOG.debug("restore snapshot info, restoreStmt: {}", restoreStmt);
try {
ConnectContext ctx = ConnectContext.get();
if (ctx == null) {
Expand All @@ -2946,13 +2946,13 @@ private TRestoreSnapshotResult restoreSnapshotImpl(TRestoreSnapshotRequest reque
restoreStmt.analyze(analyzer);
DdlExecutor.execute(Env.getCurrentEnv(), restoreStmt);
} catch (UserException e) {
LOG.warn("failed to restore: {}", e.getMessage(), e);
LOG.warn("failed to restore: {}, stmt: {}", e.getMessage(), restoreStmt, e);
status.setStatusCode(TStatusCode.ANALYSIS_ERROR);
status.addToErrorMsgs(e.getMessage());
status.addToErrorMsgs(e.getMessage() + ", stmt: " + restoreStmt.toString());
} catch (Throwable e) {
LOG.warn("catch unknown result.", e);
LOG.warn("catch unknown result. stmt: {}", restoreStmt, e);
status.setStatusCode(TStatusCode.INTERNAL_ERROR);
status.addToErrorMsgs(Strings.nullToEmpty(e.getMessage()));
status.addToErrorMsgs(Strings.nullToEmpty(e.getMessage()) + ", stmt: " + restoreStmt.toString());
}

return result;
Expand Down

0 comments on commit ccf0882

Please sign in to comment.