Skip to content

Commit

Permalink
branch-3.0: [chore](restore) Save restore stmt to the resp if Restore…
Browse files Browse the repository at this point in the history
…Snapshot failed (apache#42956)

Cherry-picked from apache#42933

Co-authored-by: walter <[email protected]>
  • Loading branch information
github-actions[bot] and w41ter authored Nov 6, 2024
1 parent 1497fee commit bd327c4
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,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 = new ConnectContext();
ctx.setQualifiedUser(request.getUser());
Expand All @@ -3037,13 +3037,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());
} finally {
ConnectContext.remove();
}
Expand Down

0 comments on commit bd327c4

Please sign in to comment.