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 2022/08/31 02:12:45 UTC

[GitHub] [doris] Yukang-LIAN opened a new pull request, #12205: [enhancement][tracing]Support forward to master tracing

Yukang-LIAN opened a new pull request, #12205:
URL: https://github.com/apache/doris/pull/12205

   # Proposed changes
   ## Problem summary
   
   When the query statement is executed, some metadata processing requests will be sent to the follower fe, but the follower fe does not have execution permission, and it will be forwarded to the master fe for execution. This PR implements the tracing of forwarding information.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [x] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [x] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [x] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] No
   
   ## Further comments
   The effect is as shown in the figure.
   
   ![FEMNAS_5%$(ZV`Z$M4PM`7M](https://user-images.githubusercontent.com/88536822/187577285-b17a12b1-0878-4773-9dd3-03dca25ea9c3.png)
   
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r959243648


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -399,7 +413,17 @@ public void execute(TUniqueId queryId) throws Exception {
                                 + Env.getCurrentEnv().getSelfNode().first + ") and failed to execute"
                                 + " because Master FE is not ready. You may need to check FE's status");
                     }
-                    forwardToMaster();
+                    Span forwardToMasterSpan =

Review Comment:
   Yeah, I got 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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN closed pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN closed pull request #12205: [enhancement](tracing)Support forward to master tracing
URL: https://github.com/apache/doris/pull/12205


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r960225353


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -548,7 +561,21 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
                 UUID uuid = UUID.randomUUID();
                 queryId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
             }
-            executor.execute(queryId);
+            Context extractedContext = Telemetry.getOpenTelemetry().getPropagators().getTextMapPropagator()

Review Comment:
   Done.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -548,7 +561,21 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
                 UUID uuid = UUID.randomUUID();
                 queryId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
             }
-            executor.execute(queryId);
+            Context extractedContext = Telemetry.getOpenTelemetry().getPropagators().getTextMapPropagator()
+                    .extract(Context.current(), traceCarrier, getter);
+            try (Scope extract = extractedContext.makeCurrent()) {

Review Comment:
   Done.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] luozenglin commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
luozenglin commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r959197263


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -534,6 +539,12 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
             }
         }
 
+        Map<String, String> traceCarrier = new HashMap<>();
+        if (request.isSetTraceCarrier()) {
+            traceCarrier = request.getTraceCarrier();
+        }
+        ctx.initTracer("master trace");

Review Comment:
   I think `initTracer` is only needed if the `traceCarrier` carries a valid span, otherwise a new trace may be generated here. 
   You can set `enable_tracing = false` in follower, and set `enable_tracing = true` in master to reproduce this situation.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] luozenglin commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
luozenglin commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r960165002


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -548,7 +561,21 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
                 UUID uuid = UUID.randomUUID();
                 queryId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
             }
-            executor.execute(queryId);
+            Context extractedContext = Telemetry.getOpenTelemetry().getPropagators().getTextMapPropagator()
+                    .extract(Context.current(), traceCarrier, getter);
+            try (Scope extract = extractedContext.makeCurrent()) {

Review Comment:
   Here it should not be `extractedContext.makeCurrent()`, but `masterQuerySpan.makeCurrent()`.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -548,7 +561,21 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
                 UUID uuid = UUID.randomUUID();
                 queryId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
             }
-            executor.execute(queryId);
+            Context extractedContext = Telemetry.getOpenTelemetry().getPropagators().getTextMapPropagator()

Review Comment:
   The extractedContext comes from the follower node and you should use `Span.fromContext(extractedContext).getSpanContext().isValid()` to check whether it is valid. If valid then initialize tracer.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN commented on pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN commented on PR #12205:
URL: https://github.com/apache/doris/pull/12205#issuecomment-1233892004

   I have tested that both `extractedContext.makeCurrent()` and `setParent(extractedContext)` work correctly when the `extractedContext` is invalid.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r959581148


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -399,7 +413,17 @@ public void execute(TUniqueId queryId) throws Exception {
                                 + Env.getCurrentEnv().getSelfNode().first + ") and failed to execute"
                                 + " because Master FE is not ready. You may need to check FE's status");
                     }
-                    forwardToMaster();
+                    Span forwardToMasterSpan =

Review Comment:
   Done.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -534,6 +539,12 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
             }
         }
 
+        Map<String, String> traceCarrier = new HashMap<>();
+        if (request.isSetTraceCarrier()) {
+            traceCarrier = request.getTraceCarrier();
+        }
+        ctx.initTracer("master trace");

Review Comment:
   Done.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN commented on pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN commented on PR #12205:
URL: https://github.com/apache/doris/pull/12205#issuecomment-1232937821

   This time The effect is as shown in the figure.
   
   ![2}6P4)ZYSEWF$S{U{`L(GXQ](https://user-images.githubusercontent.com/88536822/187689373-9ba3f760-27f8-43f7-b24b-b969a0716a57.png)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] luozenglin commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
luozenglin commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r959197263


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -534,6 +539,12 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
             }
         }
 
+        Map<String, String> traceCarrier = new HashMap<>();
+        if (request.isSetTraceCarrier()) {
+            traceCarrier = request.getTraceCarrier();
+        }
+        ctx.initTracer("master trace");

Review Comment:
   I think `initTracer` is only needed if the `traceCarrier` carries a valid span, otherwise a new trace may be generated here.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -399,7 +413,17 @@ public void execute(TUniqueId queryId) throws Exception {
                                 + Env.getCurrentEnv().getSelfNode().first + ") and failed to execute"
                                 + " because Master FE is not ready. You may need to check FE's status");
                     }
-                    forwardToMaster();
+                    Span forwardToMasterSpan =

Review Comment:
   I think after adding span in MasterOpExecutor.execute, there is no need to add `forwardToMasterSpan` 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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] Yukang-LIAN commented on a diff in pull request #12205: [enhancement](tracing)Support forward to master tracing

Posted by GitBox <gi...@apache.org>.
Yukang-LIAN commented on code in PR #12205:
URL: https://github.com/apache/doris/pull/12205#discussion_r959244657


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -534,6 +539,12 @@ public TMasterOpResult proxyExecute(TMasterOpRequest request) {
             }
         }
 
+        Map<String, String> traceCarrier = new HashMap<>();
+        if (request.isSetTraceCarrier()) {
+            traceCarrier = request.getTraceCarrier();
+        }
+        ctx.initTracer("master trace");

Review Comment:
   Try to solve 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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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