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

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


The following commit(s) were added to refs/heads/master by this push:
     new 27ef5b4  [Bug] Use the right queryId to audit master only query in non 
master (#4978)
27ef5b4 is described below

commit 27ef5b4d2cb4a03b837c48aa8c10d230d78c7db0
Author: Lijia Liu <[email protected]>
AuthorDate: Sun Nov 29 11:14:17 2020 +0800

    [Bug] Use the right queryId to audit master only query in non master (#4978)
    
    Add queryId in TMasterOpResult.
    Audit it in non master FE.
---
 .../src/main/java/org/apache/doris/qe/ConnectProcessor.java    |  3 +++
 .../src/main/java/org/apache/doris/qe/MasterOpExecutor.java    | 10 ++++++++++
 fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java |  4 ++++
 gensrc/thrift/FrontendService.thrift                           |  1 +
 4 files changed, 18 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
index e2908c9..e987faa 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
@@ -475,6 +475,9 @@ public class ConnectProcessor {
         // no matter the master execute success or fail, the master must 
transfer the result to follower
         // and tell the follower the current journalID.
         TMasterOpResult result = new TMasterOpResult();
+        if (ctx.queryId() != null) {
+            result.setQueryId(ctx.queryId);
+        }
         
result.setMaxJournalId(Catalog.getCurrentCatalog().getMaxJournalId().longValue());
         result.setPacket(getResultPacket());
         if (executor != null && executor.getProxyResultSet() != null) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java
index 1c5efa6..8f0854e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java
@@ -24,6 +24,7 @@ import org.apache.doris.thrift.TMasterOpRequest;
 import org.apache.doris.thrift.TMasterOpResult;
 import org.apache.doris.thrift.TNetworkAddress;
 import org.apache.doris.thrift.TQueryOptions;
+import org.apache.doris.thrift.TUniqueId;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -127,6 +128,15 @@ public class MasterOpExecutor {
         }
         return result.packet;
     }
+
+    public TUniqueId getQueryId() {
+        if (result != null && result.isSetQueryId()) {
+            return result.getQueryId();
+        } else {
+            return null;
+        }
+    }
+
     
     public ShowResultSet getProxyResultSet() {
         if (result == null) {
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 daaea7d..349b9a7 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
@@ -264,6 +264,9 @@ public class StmtExecutor {
 
             if (isForwardToMaster()) {
                 forwardToMaster();
+                if (masterOpExecutor != null && masterOpExecutor.getQueryId() 
!= null) {
+                    context.setQueryId(masterOpExecutor.getQueryId());
+                }
                 return;
             } else {
                 LOG.debug("no need to transfer to Master. stmt: {}", 
context.getStmtId());
@@ -824,6 +827,7 @@ public class StmtExecutor {
         Throwable throwable = null;
 
         String label = insertStmt.getLabel();
+        LOG.info("Do insert [{}] with query id: {}", label, 
DebugUtil.printId(context.queryId()));
 
         long loadedRows = 0;
         int filteredRows = 0;
diff --git a/gensrc/thrift/FrontendService.thrift 
b/gensrc/thrift/FrontendService.thrift
index ed1aa3e..4964e3f 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -463,6 +463,7 @@ struct TMasterOpResult {
     1: required i64 maxJournalId;
     2: required binary packet;
     3: optional TShowResultSet resultSet;
+    4: optional Types.TUniqueId queryId;
 }
 
 struct TLoadCheckRequest {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to