[fix](stream_load) can abort 2pc stream load when table dropped #17088

when stream load with 2pc, the table was droped before commit, it will get error commit or abort, trasaction can not finish.
if commit or abort ,will get error:
{
"status": "ANALYSIS_ERROR",
"msg": "errCode = 7, detailMessage = unknown table, tableId=52579"
}
after this pr, i can abort success.
This commit is contained in:
xueweizhang
2023-02-26 11:20:41 +08:00
committed by GitHub
parent d8eb3ec6f7
commit d3a7cb8bde

View File

@ -996,14 +996,20 @@ public class FrontendServiceImpl implements FrontendService.Iface {
throw new UserException("transaction [" + request.getTxnId() + "] not found");
}
List<Long> tableIdList = transactionState.getTableIdList();
List<Table> tableList = database.getTablesOnIdOrderOrThrowException(tableIdList);
String txnOperation = request.getOperation().trim();
List<Table> tableList = new ArrayList<>();
// if table was dropped, stream load must can abort.
if (txnOperation.equalsIgnoreCase("abort")) {
tableList = database.getTablesOnIdOrderIfExist(tableIdList);
} else {
tableList = database.getTablesOnIdOrderOrThrowException(tableIdList);
}
for (Table table : tableList) {
// check auth
checkPasswordAndPrivs(cluster, request.getUser(), request.getPasswd(), request.getDb(), table.getName(),
request.getUserIp(), PrivPredicate.LOAD);
}
String txnOperation = request.getOperation().trim();
if (txnOperation.equalsIgnoreCase("commit")) {
Env.getCurrentGlobalTransactionMgr()
.commitTransaction2PC(database, tableList, request.getTxnId(), 5000);