This is an automated email from the ASF dual-hosted git repository.

liaoxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ee8d40617b [fix](txn insert) txn insert show error url (#45254)
1ee8d40617b is described below

commit 1ee8d40617ba6fff14c7cf71ed2c8851126a1c40
Author: meiyi <me...@selectdb.com>
AuthorDate: Wed Dec 11 22:23:15 2024 +0800

    [fix](txn insert) txn insert show error url (#45254)
    
    ```
    mysql> begin;
    
    mysql> insert into test values('a', 'a', 1);
    
    mysql> commit;
    ERROR 1105 (HY000): errCode = 2, detailMessage = [DATA_QUALITY_ERROR]too 
many filtered rows, url: 
http://172.21.16.12:9082/api/_load_error_log?file=__shard_110/error_log_insert_stmt_txn_insert_ef05df534f6b4ad7-8782cce460d85b4b_733cffdc9392473f_bd6b2ec40c621119
    ```
---
 be/src/runtime/stream_load/stream_load_executor.cpp       |  9 +++++++--
 .../suites/insert_p0/transaction/txn_insert.groovy        | 15 ++++++++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/be/src/runtime/stream_load/stream_load_executor.cpp 
b/be/src/runtime/stream_load/stream_load_executor.cpp
index 482fadac44e..ad4d22946f1 100644
--- a/be/src/runtime/stream_load/stream_load_executor.cpp
+++ b/be/src/runtime/stream_load/stream_load_executor.cpp
@@ -85,13 +85,18 @@ Status 
StreamLoadExecutor::execute_plan_fragment(std::shared_ptr<StreamLoadConte
         ctx->number_unselected_rows = state->num_rows_load_unselected();
         ctx->loaded_bytes = state->num_bytes_load_total();
         int64_t num_selected_rows = ctx->number_total_rows - 
ctx->number_unselected_rows;
+        ctx->error_url = 
to_load_error_http_path(state->get_error_log_file_path());
         if (!ctx->group_commit && num_selected_rows > 0 &&
             (double)ctx->number_filtered_rows / num_selected_rows > 
ctx->max_filter_ratio) {
             // NOTE: Do not modify the error message here, for historical 
reasons,
             // some users may rely on this error message.
-            *status = Status::DataQualityError("too many filtered rows");
+            if (ctx->need_commit_self) {
+                *status =
+                        Status::DataQualityError("too many filtered rows, url: 
" + ctx->error_url);
+            } else {
+                *status = Status::DataQualityError("too many filtered rows");
+            }
         }
-        ctx->error_url = 
to_load_error_http_path(state->get_error_log_file_path());
 
         if (status->ok()) {
             
DorisMetrics::instance()->stream_receive_bytes_total->increment(ctx->receive_bytes);
diff --git a/regression-test/suites/insert_p0/transaction/txn_insert.groovy 
b/regression-test/suites/insert_p0/transaction/txn_insert.groovy
index 424a03ee173..f4c8caa35ba 100644
--- a/regression-test/suites/insert_p0/transaction/txn_insert.groovy
+++ b/regression-test/suites/insert_p0/transaction/txn_insert.groovy
@@ -107,7 +107,7 @@ suite("txn_insert") {
             sql """ DROP TABLE IF EXISTS $tableMV """
             sql """
                 create table $tableMV (
-                    id int default '10', 
+                    id int not null, 
                     c1 int default '10'
                 ) distributed by hash(id, c1) 
                 properties('replication_num'="1");
@@ -122,6 +122,19 @@ suite("txn_insert") {
             order_qt_select5 """select * from $tableMV"""
             order_qt_select6 """select c1 from $tableMV"""
         } while (0);
+        do {
+            try {
+                sql "begin"
+                sql """insert into $tableMV values(9, 2), (10, 4)"""
+                sql """insert into $tableMV values('aa', 6)"""
+                sql "commit"
+            } catch (Exception e) {
+                sql "rollback"
+                logger.info("insert into $tableMV failed: " + e.getMessage())
+                assertTrue(e.getMessage().contains("too many filtered rows"))
+                assertTrue(e.getMessage().contains("url"))
+            }
+        } while (0);
 
         // ------------------- insert into select -------------------
         for (int j = 0; j < 3; j++) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to