[Improvement](group commit) FE should throw NotFoundException if database or table not exist when loading data (#31113)

* [Improvement](group commit) FE should throw NotFoundException if database or table not exist when loading data

* edit
This commit is contained in:
huanghaibin
2024-02-20 09:21:31 +08:00
committed by yiguolei
parent 24fb24db3e
commit b69acbf98b

View File

@ -1108,6 +1108,10 @@ public class FrontendServiceImpl implements FrontendService.Iface {
status.setStatusCode(TStatusCode.LABEL_ALREADY_EXISTS);
status.addToErrorMsgs(e.getMessage());
result.setJobStatus(e.getJobStatus());
} catch (MetaNotFoundException e) {
LOG.warn("failed to begin", e);
status.setStatusCode(TStatusCode.NOT_FOUND);
status.addToErrorMsgs(e.getMessage());
} catch (UserException e) {
LOG.warn("failed to begin: {}", e.getMessage());
status.setStatusCode(TStatusCode.ANALYSIS_ERROR);
@ -1145,7 +1149,7 @@ public class FrontendServiceImpl implements FrontendService.Iface {
if (Strings.isNullOrEmpty(request.getCluster())) {
dbName = request.getDb();
}
throw new UserException("unknown database, database=" + dbName);
throw new MetaNotFoundException("unknown database, database=" + dbName);
}
OlapTable table = (OlapTable) db.getTableOrMetaException(request.tbl, TableType.OLAP);
@ -1249,7 +1253,7 @@ public class FrontendServiceImpl implements FrontendService.Iface {
if (Strings.isNullOrEmpty(request.getCluster())) {
dbName = request.getDb();
}
throw new UserException("unknown database, database=" + dbName);
throw new MetaNotFoundException("unknown database, database=" + dbName);
}
// step 4: fetch all tableIds
@ -1679,6 +1683,11 @@ public class FrontendServiceImpl implements FrontendService.Iface {
}
try {
loadTxnRollbackImpl(request);
} catch (MetaNotFoundException e) {
String msg = "failed to rollback txn" + request.getTxnId();
LOG.warn(msg, e);
status.setStatusCode(TStatusCode.NOT_FOUND);
status.addToErrorMsgs(e.getMessage());
} catch (UserException e) {
LOG.warn("failed to rollback txn {}: {}", request.getTxnId(), e.getMessage());
status.setStatusCode(TStatusCode.ANALYSIS_ERROR);