You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/06 02:01:00 UTC

[jira] [Commented] (SCB-805) If the node time of alpha and omega are not same, the transaction could be aborted

    [ https://issues.apache.org/jira/browse/SCB-805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569645#comment-16569645 ] 

ASF GitHub Bot commented on SCB-805:
------------------------------------

WillemJiang closed pull request #238: [SCB-805] If the node time of alpha and omega are not same, the transaction could be aborted
URL: https://github.com/apache/incubator-servicecomb-saga/pull/238
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/GrpcTxEventEndpointImpl.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/GrpcTxEventEndpointImpl.java
index a3137b45..11468197 100644
--- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/GrpcTxEventEndpointImpl.java
+++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/GrpcTxEventEndpointImpl.java
@@ -78,7 +78,7 @@ public void onTxEvent(GrpcTxEvent message, StreamObserver<GrpcAck> responseObser
     boolean ok = txConsistentService.handle(new TxEvent(
         message.getServiceName(),
         message.getInstanceId(),
-        new Date(message.getTimestamp()),
+        new Date(),
         message.getGlobalTxId(),
         message.getLocalTxId(),
         message.getParentTxId().isEmpty() ? null : message.getParentTxId(),


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> If the node time of alpha and omega are not same, the transaction could be aborted
> ----------------------------------------------------------------------------------
>
>                 Key: SCB-805
>                 URL: https://issues.apache.org/jira/browse/SCB-805
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Saga
>    Affects Versions: saga-0.2.0
>            Reporter: Jeremy Xu
>            Assignee: Jeremy Xu
>            Priority: Minor
>             Fix For: saga-0.3.0
>
>
> If the node time of alpha and omega are not same, the transaction could be aborted.
> As the alpha just create the TxEvent which is based on the omega's message timestamp, it could trigger the EventScanner timeout check to abort the transaction. We should use the Alpha timestamp to create the date.
> RT, 当alpha与omega所在节点的时间不同步时,分布式事务会被异常aborted。检查代码发现alpha侧创建TxEvent时用到了omega侧传过来的时间戳。
> {code:java}
> @Override
> public void onTxEvent(GrpcTxEvent message, StreamObserver<GrpcAck> responseObserver) {
>   boolean ok = txConsistentService.handle(new TxEvent(
>       message.getServiceName(),
>       message.getInstanceId(),
>       new Date(message.getTimestamp()),  // 这里用到了omega侧传过来的时间戳
>       message.getGlobalTxId(),
>       message.getLocalTxId(),
>       message.getParentTxId().isEmpty() ? null : message.getParentTxId(),
>       message.getType(),
>       message.getCompensationMethod(),
>       message.getTimeout(),
>       message.getRetryMethod(),
>       message.getRetries(),
>       message.getPayloads().toByteArray()
>   ));{code}
>  
> 这里感觉可以直接用收到TxEvent的时间,即*new Date()*即可。



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)