Pick https://github.com/apache/doris/pull/34220
This commit is contained in:
@ -137,7 +137,7 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync,
|
||||
targetTableIf.getDatabase().getFullName() + "." + targetTableIf.getName());
|
||||
}
|
||||
|
||||
AbstractInsertExecutor insertExecutor;
|
||||
AbstractInsertExecutor insertExecutor = null;
|
||||
// should lock target table until we begin transaction.
|
||||
targetTableIf.readLock();
|
||||
try {
|
||||
@ -199,8 +199,14 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync,
|
||||
|
||||
insertExecutor.beginTransaction();
|
||||
insertExecutor.finalizeSink(planner.getFragments().get(0), sink, physicalSink);
|
||||
} finally {
|
||||
targetTableIf.readUnlock();
|
||||
} catch (Throwable e) {
|
||||
targetTableIf.readUnlock();
|
||||
// the abortTxn in onFail need to acquire table write lock
|
||||
if (insertExecutor != null) {
|
||||
insertExecutor.onFail(e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
executor.setProfileType(ProfileType.LOAD);
|
||||
|
||||
Reference in New Issue
Block a user