Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public AbstractInsertExecutor initPlan(ConnectContext ctx, StmtExecutor executor
targetTableIf.getDatabase().getFullName() + "." + targetTableIf.getName());
}

AbstractInsertExecutor insertExecutor;
AbstractInsertExecutor insertExecutor = null;
// should lock target table until we begin transaction.
targetTableIf.readLock();
try {
Expand Down Expand Up @@ -183,8 +183,14 @@ public AbstractInsertExecutor initPlan(ConnectContext ctx, StmtExecutor executor

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,7 @@ public void execute(TUniqueId queryId) throws Exception {
LOG.warn("Analyze failed. {}", context.getQueryIdentifier(), e);
throw ((NereidsException) e).getException();
}
// FIXME: Force fallback for:
// 1. group commit because nereids does not support it (see the following `isGroupCommit` variable)
// Skip force fallback for:
// 1. Transaction insert because nereids support `insert into select` while legacy does not
// 2. Nereids support insert into external table while legacy does not
// FIXME: Force fallback for group commit because nereids does not support it
boolean isInsertCommand = parsedStmt != null
&& parsedStmt instanceof LogicalPlanAdapter
&& ((LogicalPlanAdapter) parsedStmt).getLogicalPlan() instanceof InsertIntoTableCommand;
Expand Down