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

dataroaring 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 8602a4a8325 [fix](group commit) group commit show error url (#38292)
8602a4a8325 is described below

commit 8602a4a83255bff0dd7d2cc9a65be2da0bf38ee4
Author: meiyi <myime...@gmail.com>
AuthorDate: Wed Jul 24 19:51:01 2024 +0800

    [fix](group commit) group commit show error url (#38292)
    
    ## Proposed changes
    
    `insert into` in group commit should show error url if some rows are
    invalid.
---
 be/src/service/internal_service.cpp                              | 4 ++++
 fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java   | 6 ++++++
 gensrc/proto/internal_service.proto                              | 1 +
 regression-test/suites/insert_p0/insert_group_commit_into.groovy | 7 +++++++
 4 files changed, 18 insertions(+)

diff --git a/be/src/service/internal_service.cpp 
b/be/src/service/internal_service.cpp
index 025a4c743da..c6a5fb15937 100644
--- a/be/src/service/internal_service.cpp
+++ b/be/src/service/internal_service.cpp
@@ -2051,6 +2051,10 @@ void 
PInternalService::group_commit_insert(google::protobuf::RpcController* cont
                             
response->set_loaded_rows(state->num_rows_load_success());
                             
response->set_filtered_rows(state->num_rows_load_filtered());
                             status->to_protobuf(response->mutable_status());
+                            if (!state->get_error_log_file_path().empty()) {
+                                response->set_error_url(
+                                        
to_load_error_http_path(state->get_error_log_file_path()));
+                            }
                             _exec_env->new_load_stream_mgr()->remove(load_id);
                         });
             } catch (const Exception& e) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 181a7d3c7bc..825b38cc757 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -2369,11 +2369,17 @@ public class StmtExecutor {
                         errMsg = "group commit insert failed. db_id: " + dbId 
+ ", table_id: " + tableId
                                 + ", query_id: " + 
DebugUtil.printId(context.queryId()) + ", backend_id: "
                                 + groupCommitPlanner.getBackend().getId() + ", 
status: " + response.getStatus();
+                        if (response.hasErrorUrl()) {
+                            errMsg += ", error url: " + response.getErrorUrl();
+                        }
                     }
                 } else if (code != TStatusCode.OK) {
                     errMsg = "group commit insert failed. db_id: " + dbId + ", 
table_id: " + tableId + ", query_id: "
                             + DebugUtil.printId(context.queryId()) + ", 
backend_id: " + groupCommitPlanner.getBackend()
                             .getId() + ", status: " + response.getStatus();
+                    if (response.hasErrorUrl()) {
+                        errMsg += ", error url: " + response.getErrorUrl();
+                    }
                     ErrorReport.reportDdlException(errMsg, 
ErrorCode.ERR_FAILED_WHEN_INSERT);
                 }
                 label = response.getLabel();
diff --git a/gensrc/proto/internal_service.proto 
b/gensrc/proto/internal_service.proto
index 5c120557611..5849d186bce 100644
--- a/gensrc/proto/internal_service.proto
+++ b/gensrc/proto/internal_service.proto
@@ -860,6 +860,7 @@ message PGroupCommitInsertResponse {
     optional int64 txn_id = 3;
     optional int64 loaded_rows = 4;
     optional int64 filtered_rows = 5;
+    optional string error_url = 6;
 }
 
 message POpenLoadStreamRequest {
diff --git a/regression-test/suites/insert_p0/insert_group_commit_into.groovy 
b/regression-test/suites/insert_p0/insert_group_commit_into.groovy
index 3b4bf78846f..3dcc047837f 100644
--- a/regression-test/suites/insert_p0/insert_group_commit_into.groovy
+++ b/regression-test/suites/insert_p0/insert_group_commit_into.groovy
@@ -211,6 +211,13 @@ suite("insert_group_commit_into") {
                 sql "set enable_insert_strict=false"
                 group_commit_insert """ insert into ${table} values (1, 'a', 
10),(5, 'q', 50),(101, 'a', 100);  """, 2
                 sql "set enable_insert_strict=true"
+                try {
+                    sql """ insert into ${table} values (102, 'a', 100);  """
+                    assertTrue(false, "insert should fail")
+                } catch (Exception e) {
+                    logger.info("error: " + e.getMessage())
+                    assertTrue(e.getMessage().contains("url:"))
+                }
                 sql """ alter table ${table} ADD ROLLUP r1(name, score); """
                 group_commit_insert_with_retry """ insert into ${table}(id, 
name) values(2, 'b');  """, 1
                 group_commit_insert_with_retry """ insert into ${table}(id) 
values(6); """, 1


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

Reply via email to