Uploaded image for project: 'Apache ServiceComb'
  1. Apache ServiceComb
  2. SCB-805

If the node time of alpha and omega are not same, the transaction could be aborted

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: saga-0.2.0
    • Fix Version/s: pack-0.3.0, saga-0.2.1
    • Component/s: Saga
    • Labels:
      None

      Description

      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侧传过来的时间戳。

      @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()
        ));

       

      这里感觉可以直接用收到TxEvent的时间,即*new Date()*即可。

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                njiang Willem Jiang
                Reporter:
                jeremyxu Jeremy Xu
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: