You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/01/09 08:07:49 UTC

[GitHub] [incubator-doris] morningman opened a new pull request #2718: [Insert] Return more info of insert operation

morningman opened a new pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718
 
 
   Standardize the return results of INSERT operations,
   which is convenient for users to use and locate problems.
   
   More details can be found in insert-into-manual.md
   
   Also add a new stmt: SHOW TRANSACTION that user can see
   the transaction status of the specified transaction id.
   
   ISSUE: #2717 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366211905
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/ShowTransactionStmt.java
 ##########
 @@ -0,0 +1,151 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.analysis;
+
+import org.apache.doris.analysis.BinaryPredicate.Operator;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.cluster.ClusterNamespace;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.proc.TransProcDir;
+import org.apache.doris.qe.ShowResultSetMetaData;
+
+import com.google.common.base.Strings;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+// syntax:
+//      SHOW TRANSACTION  WHERE id=123
+public class ShowTransactionStmt extends ShowStmt {
+    private static final Logger LOG = LogManager.getLogger(ShowTransactionStmt.class);
+
+    private String dbName;
+    private Expr whereClause;
+    private long txnId;
+
+    public ShowTransactionStmt(String dbName, Expr whereClause) {
+        this.dbName = dbName;
+        this.whereClause = whereClause;
+    }
+
+    public String getDbName() {
+        return dbName;
+    }
+
+    public long getTxnId() {
+        return txnId;
+    }
+
+    @Override
+    public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
+        super.analyze(analyzer);
+
+        if (Strings.isNullOrEmpty(dbName)) {
+            dbName = analyzer.getDefaultDb();
+            if (Strings.isNullOrEmpty(dbName)) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+            }
+        } else {
+            dbName = ClusterNamespace.getFullName(getClusterName(), dbName);
+        }
+
+        if (whereClause == null) {
+            throw new AnalysisException("Missing transaction id");
+        }
+
+        analyzeSubPredicate(whereClause);
+    }
+
+    private void analyzeSubPredicate(Expr subExpr) throws AnalysisException {
+        if (subExpr == null) {
+            return;
+        }
+
+        boolean valid = true;
+        CHECK: {
+            if (subExpr instanceof BinaryPredicate) {
 
 Review comment:
   if the stmt is where 1=id?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366344824
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/ShowTransactionStmt.java
 ##########
 @@ -0,0 +1,151 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.analysis;
+
+import org.apache.doris.analysis.BinaryPredicate.Operator;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.cluster.ClusterNamespace;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.proc.TransProcDir;
+import org.apache.doris.qe.ShowResultSetMetaData;
+
+import com.google.common.base.Strings;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+// syntax:
+//      SHOW TRANSACTION  WHERE id=123
+public class ShowTransactionStmt extends ShowStmt {
+    private static final Logger LOG = LogManager.getLogger(ShowTransactionStmt.class);
+
+    private String dbName;
+    private Expr whereClause;
+    private long txnId;
+
+    public ShowTransactionStmt(String dbName, Expr whereClause) {
+        this.dbName = dbName;
+        this.whereClause = whereClause;
+    }
+
+    public String getDbName() {
+        return dbName;
+    }
+
+    public long getTxnId() {
+        return txnId;
+    }
+
+    @Override
+    public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
+        super.analyze(analyzer);
+
+        if (Strings.isNullOrEmpty(dbName)) {
+            dbName = analyzer.getDefaultDb();
+            if (Strings.isNullOrEmpty(dbName)) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+            }
+        } else {
+            dbName = ClusterNamespace.getFullName(getClusterName(), dbName);
+        }
+
+        if (whereClause == null) {
+            throw new AnalysisException("Missing transaction id");
+        }
+
+        analyzeSubPredicate(whereClause);
+    }
+
+    private void analyzeSubPredicate(Expr subExpr) throws AnalysisException {
+        if (subExpr == null) {
+            return;
+        }
+
+        boolean valid = true;
+        CHECK: {
+            if (subExpr instanceof BinaryPredicate) {
 
 Review comment:
   Not support it~

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366213292
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
 ##########
 @@ -1220,6 +1214,63 @@ private void updateDBRunningTxnNum(TransactionStatus preStatus, TransactionState
         return infos;
     }
     
+    // get show info of a specified txnId
+    public List<List<String>> getSingleTranInfo(long dbId, long txnId) throws AnalysisException {
+        List<List<String>> infos = new ArrayList<List<String>>();
+        readLock();
+        try {
+            Database db = Catalog.getInstance().getDb(dbId);
+            if (db == null) {
+                throw new AnalysisException("Database[" + dbId + "] does not exist");
+            }
+            
+            TransactionState txnState = idToTransactionState.get(txnId);
+            if (txnState == null) {
+                throw new AnalysisException("transaction with id " + txnId + " does not exist");
+            }
+            
+            if (ConnectContext.get() != null) {
 
 Review comment:
   precondition?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366346293
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/transaction/GlobalTransactionMgr.java
 ##########
 @@ -1220,6 +1214,63 @@ private void updateDBRunningTxnNum(TransactionStatus preStatus, TransactionState
         return infos;
     }
     
+    // get show info of a specified txnId
+    public List<List<String>> getSingleTranInfo(long dbId, long txnId) throws AnalysisException {
+        List<List<String>> infos = new ArrayList<List<String>>();
+        readLock();
+        try {
+            Database db = Catalog.getInstance().getDb(dbId);
+            if (db == null) {
+                throw new AnalysisException("Database[" + dbId + "] does not exist");
+            }
+            
+            TransactionState txnState = idToTransactionState.get(txnId);
+            if (txnState == null) {
+                throw new AnalysisException("transaction with id " + txnId + " does not exist");
+            }
+            
+            if (ConnectContext.get() != null) {
 
 Review comment:
   This method may be called internal, not in user connection thread. So I just add a judgement here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366345755
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/qe/StmtExecutor.java
 ##########
 @@ -692,37 +697,36 @@ private void handleInsertStmt() throws Exception {
             throwable = t;
         }
 
-        // record insert info for show load stmt if
-        // 1. NOT a streaming insert(deprecated)
-        // 2. using_old_load_usage_pattern is set to true, means a label will be returned for user to show load.
-        // 3. has filtered rows. so a label should be returned for user to show
-        // 4. user specify a label for insert stmt
-        if (!insertStmt.isStreaming() || Config.using_old_load_usage_pattern || filteredRows > 0 || insertStmt.isUserSpecifiedLabel()) {
-            try {
-                context.getCatalog().getLoadManager().recordFinishedLoadJob(
-                        label,
-                        insertStmt.getDb(),
-                        insertStmt.getTargetTable().getId(),
-                        EtlJobType.INSERT,
-                        createTime,
-                        throwable == null ? "" : throwable.getMessage(),
-                        coord.getTrackingUrl()
-                );
-            } catch (MetaNotFoundException e) {
-                LOG.warn("Record info of insert load with error {}", e.getMessage(), e);
-                context.getState().setError("Failed to record info of insert load job, but insert job is "
-                        + (throwable == null ? "success" : "failed"));
-                return;
-            }
+        // Go here, which means:
+        // 1. transaction is finished successfully (COMMITTED or VISIBLE), or
+        // 2. transaction failed but Config.using_old_load_usage_pattern is true.
+        // we will record the load job info for these 2 cases
 
-            // set to OK, which means the insert load job is successfully submitted.
-            // and user can check the job's status by label.
-            context.getState().setOk(loadedRows, filteredRows, "{'label':'" + label + "'}");
-        } else {
-            // just return OK without label, which means this job is successfully done without any error.
-            Preconditions.checkState(loadedRows > 0 && filteredRows == 0);
-            context.getState().setOk(loadedRows, filteredRows, null);
-        }
+        String errMsg = "";
+        try {
+            context.getCatalog().getLoadManager().recordFinishedLoadJob(
+                    label,
+                    insertStmt.getDb(),
+                    insertStmt.getTargetTable().getId(),
+                    EtlJobType.INSERT,
+                    createTime,
+                    throwable == null ? "" : throwable.getMessage(),
+                    coord.getTrackingUrl());
+        } catch (MetaNotFoundException e) {
+            LOG.warn("Record info of insert load with error {}", e.getMessage(), e);
+            errMsg = "Record info of insert load with error " + e.getMessage();
+        }
+
+        // {'label':'my_label1', 'status':'visible', 'txnId':'123'}
+        // {'label':'my_label1', 'status':'visible', 'txnId':'123' 'err':'error messages'}
+        String info = "{'label':'" + label + "', 'status':'" + txnStatus.name() + "', 'txnId':'"
 
 Review comment:
   ok

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366208864
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/ShowTransactionStmt.java
 ##########
 @@ -0,0 +1,151 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.analysis;
+
+import org.apache.doris.analysis.BinaryPredicate.Operator;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.cluster.ClusterNamespace;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.proc.TransProcDir;
+import org.apache.doris.qe.ShowResultSetMetaData;
+
+import com.google.common.base.Strings;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+// syntax:
+//      SHOW TRANSACTION  WHERE id=123
+public class ShowTransactionStmt extends ShowStmt {
+    private static final Logger LOG = LogManager.getLogger(ShowTransactionStmt.class);
+
+    private String dbName;
+    private Expr whereClause;
+    private long txnId;
+
+    public ShowTransactionStmt(String dbName, Expr whereClause) {
+        this.dbName = dbName;
+        this.whereClause = whereClause;
+    }
+
+    public String getDbName() {
+        return dbName;
+    }
+
+    public long getTxnId() {
+        return txnId;
+    }
+
+    @Override
+    public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
+        super.analyze(analyzer);
+
+        if (Strings.isNullOrEmpty(dbName)) {
+            dbName = analyzer.getDefaultDb();
+            if (Strings.isNullOrEmpty(dbName)) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+            }
+        } else {
+            dbName = ClusterNamespace.getFullName(getClusterName(), dbName);
+        }
+
+        if (whereClause == null) {
+            throw new AnalysisException("Missing transaction id");
+        }
+
+        analyzeSubPredicate(whereClause);
+    }
+
+    private void analyzeSubPredicate(Expr subExpr) throws AnalysisException {
 
 Review comment:
   analyzeWhereClause

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366345023
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/analysis/ShowTransactionStmt.java
 ##########
 @@ -0,0 +1,151 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.analysis;
+
+import org.apache.doris.analysis.BinaryPredicate.Operator;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.cluster.ClusterNamespace;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.UserException;
+import org.apache.doris.common.proc.TransProcDir;
+import org.apache.doris.qe.ShowResultSetMetaData;
+
+import com.google.common.base.Strings;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+// syntax:
+//      SHOW TRANSACTION  WHERE id=123
+public class ShowTransactionStmt extends ShowStmt {
+    private static final Logger LOG = LogManager.getLogger(ShowTransactionStmt.class);
+
+    private String dbName;
+    private Expr whereClause;
+    private long txnId;
+
+    public ShowTransactionStmt(String dbName, Expr whereClause) {
+        this.dbName = dbName;
+        this.whereClause = whereClause;
+    }
+
+    public String getDbName() {
+        return dbName;
+    }
+
+    public long getTxnId() {
+        return txnId;
+    }
+
+    @Override
+    public void analyze(Analyzer analyzer) throws AnalysisException, UserException {
+        super.analyze(analyzer);
+
+        if (Strings.isNullOrEmpty(dbName)) {
+            dbName = analyzer.getDefaultDb();
+            if (Strings.isNullOrEmpty(dbName)) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+            }
+        } else {
+            dbName = ClusterNamespace.getFullName(getClusterName(), dbName);
+        }
+
+        if (whereClause == null) {
+            throw new AnalysisException("Missing transaction id");
+        }
+
+        analyzeSubPredicate(whereClause);
+    }
+
+    private void analyzeSubPredicate(Expr subExpr) throws AnalysisException {
 
 Review comment:
   ok

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718#discussion_r366212205
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/qe/StmtExecutor.java
 ##########
 @@ -692,37 +697,36 @@ private void handleInsertStmt() throws Exception {
             throwable = t;
         }
 
-        // record insert info for show load stmt if
-        // 1. NOT a streaming insert(deprecated)
-        // 2. using_old_load_usage_pattern is set to true, means a label will be returned for user to show load.
-        // 3. has filtered rows. so a label should be returned for user to show
-        // 4. user specify a label for insert stmt
-        if (!insertStmt.isStreaming() || Config.using_old_load_usage_pattern || filteredRows > 0 || insertStmt.isUserSpecifiedLabel()) {
-            try {
-                context.getCatalog().getLoadManager().recordFinishedLoadJob(
-                        label,
-                        insertStmt.getDb(),
-                        insertStmt.getTargetTable().getId(),
-                        EtlJobType.INSERT,
-                        createTime,
-                        throwable == null ? "" : throwable.getMessage(),
-                        coord.getTrackingUrl()
-                );
-            } catch (MetaNotFoundException e) {
-                LOG.warn("Record info of insert load with error {}", e.getMessage(), e);
-                context.getState().setError("Failed to record info of insert load job, but insert job is "
-                        + (throwable == null ? "success" : "failed"));
-                return;
-            }
+        // Go here, which means:
+        // 1. transaction is finished successfully (COMMITTED or VISIBLE), or
+        // 2. transaction failed but Config.using_old_load_usage_pattern is true.
+        // we will record the load job info for these 2 cases
 
-            // set to OK, which means the insert load job is successfully submitted.
-            // and user can check the job's status by label.
-            context.getState().setOk(loadedRows, filteredRows, "{'label':'" + label + "'}");
-        } else {
-            // just return OK without label, which means this job is successfully done without any error.
-            Preconditions.checkState(loadedRows > 0 && filteredRows == 0);
-            context.getState().setOk(loadedRows, filteredRows, null);
-        }
+        String errMsg = "";
+        try {
+            context.getCatalog().getLoadManager().recordFinishedLoadJob(
+                    label,
+                    insertStmt.getDb(),
+                    insertStmt.getTargetTable().getId(),
+                    EtlJobType.INSERT,
+                    createTime,
+                    throwable == null ? "" : throwable.getMessage(),
+                    coord.getTrackingUrl());
+        } catch (MetaNotFoundException e) {
+            LOG.warn("Record info of insert load with error {}", e.getMessage(), e);
+            errMsg = "Record info of insert load with error " + e.getMessage();
+        }
+
+        // {'label':'my_label1', 'status':'visible', 'txnId':'123'}
+        // {'label':'my_label1', 'status':'visible', 'txnId':'123' 'err':'error messages'}
+        String info = "{'label':'" + label + "', 'status':'" + txnStatus.name() + "', 'txnId':'"
 
 Review comment:
   StringBuilder.append()

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-doris] morningman merged pull request #2718: [Insert] Return more info of insert operation

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #2718: [Insert] Return more info of insert operation
URL: https://github.com/apache/incubator-doris/pull/2718
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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