From c05517448365a65c338d4b39456d40fcf88a5081 Mon Sep 17 00:00:00 2001 From: Xin Liao Date: Fri, 10 May 2024 11:29:11 +0800 Subject: [PATCH] [fix](insert) fix forget to abort txn when insert checkStrictMode failed (#34612) (#34632) --- .../commands/insert/AbstractInsertExecutor.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java index f0df240762..541836dc1a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/AbstractInsertExecutor.java @@ -159,16 +159,14 @@ public abstract class AbstractInsertExecutor { } } - private boolean checkStrictMode() { + private void checkStrictMode() throws Exception { // if in strict mode, insert will fail if there are filtered rows if (ctx.getSessionVariable().getEnableInsertStrict()) { if (filteredRows > 0) { - ctx.getState().setError(ErrorCode.ERR_FAILED_WHEN_INSERT, - "Insert has filtered data in strict mode, tracking_url=" + coordinator.getTrackingUrl()); - return false; + ErrorReport.reportDdlException("Insert has filtered data in strict mode", + ErrorCode.ERR_FAILED_WHEN_INSERT); } } - return true; } /** @@ -178,9 +176,7 @@ public abstract class AbstractInsertExecutor { beforeExec(); try { execImpl(executor, jobId); - if (!checkStrictMode()) { - return; - } + checkStrictMode(); onComplete(); } catch (Throwable t) { onFail(t);