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

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


The following commit(s) were added to refs/heads/master by this push:
     new 42ba20e  Merge pull request #1453, restore the bug that attachment has 
not been updated in the RpcContext when the Dubbo built-in retry mechanism is 
triggered.
42ba20e is described below

commit 42ba20ed43331f0e3e1c4a4ea75fcb34f564b796
Author: yizhenqiang <manzhiz...@163.com>
AuthorDate: Tue Jun 5 15:59:29 2018 +0800

    Merge pull request #1453, restore the bug that attachment has not been 
updated in the RpcContext when the Dubbo built-in retry mechanism is triggered.
---
 .../java/com/alibaba/dubbo/rpc/protocol/AbstractInvoker.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/protocol/AbstractInvoker.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/protocol/AbstractInvoker.java
index eee7db4..2d8c8d9 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/protocol/AbstractInvoker.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/protocol/AbstractInvoker.java
@@ -136,7 +136,14 @@ public abstract class AbstractInvoker<T> implements 
Invoker<T> {
         }
         Map<String, String> context = RpcContext.getContext().getAttachments();
         if (context != null) {
-            invocation.addAttachmentsIfAbsent(context);
+            /**
+             * invocation.addAttachmentsIfAbsent(context){@link 
RpcInvocation#addAttachmentsIfAbsent(Map)}should not be used here,
+             * because the {@link RpcContext#setAttachment(String, String)} is 
passed in the Filter when the call is triggered
+             * by the built-in retry mechanism of the Dubbo. The attachment to 
update RpcContext will no longer work, which is
+             * a mistake in most cases (for example, through Filter to 
RpcContext output traceId and spanId and other information).
+             * yizhenqiang 20180310
+             */
+            invocation.addAttachments(context);
         }
         if (getUrl().getMethodParameter(invocation.getMethodName(), 
Constants.ASYNC_KEY, false)) {
             invocation.setAttachment(Constants.ASYNC_KEY, 
Boolean.TRUE.toString());

-- 
To stop receiving notification emails like this one, please contact
liu...@apache.org.

Reply via email to