[fix](fe) Fix NPE in FrontendServiceImpl.loadTxnCommit if table is dropped (#31715)

This commit is contained in:
meiyi
2024-03-04 17:57:23 +08:00
committed by yiguolei
parent a26b1eeee7
commit d7d8b4ee4a

View File

@ -1310,6 +1310,9 @@ public class FrontendServiceImpl implements FrontendService.Iface {
private List<Table> queryLoadCommitTables(TLoadTxnCommitRequest request, Database db) throws UserException {
if (request.isSetTableId() && request.getTableId() > 0) {
Table table = Env.getCurrentEnv().getInternalCatalog().getTableByTableId(request.getTableId());
if (table == null) {
throw new MetaNotFoundException("unknown table, table_id=" + request.getTableId());
}
return Collections.singletonList(table);
}
@ -1501,7 +1504,7 @@ public class FrontendServiceImpl implements FrontendService.Iface {
status.addToErrorMsgs("transaction commit successfully, BUT data will be visible later");
}
} catch (UserException e) {
LOG.warn("failed to commit txn: {}: {}", request.getTxnId(), e.getMessage());
LOG.warn("failed to commit txn: {}", request.getTxnId(), e);
status.setStatusCode(TStatusCode.ANALYSIS_ERROR);
status.addToErrorMsgs(e.getMessage());
} catch (Throwable e) {