You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@servicecomb.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2018/11/15 06:43:00 UTC

[jira] [Reopened] (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:all-tabpanel ]

Willem Jiang reopened SCB-805:
------------------------------
      Assignee: Willem Jiang  (was: Jeremy Xu)

> 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: Willem Jiang
>            Priority: Minor
>             Fix For: saga-0.3.0, saga-0.2.1
>
>
> 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)