Coder Social home page Coder Social logo

Comments (3)

changmingxie avatar changmingxie commented on July 20, 2024

@SandyJiang 服务被调用后,会更新日志记录;如果日志更新成功,则该服务不会被重复调用,如果更新日志不成功,则 会重试,重试时 会重复调用该服务并再次更新日志记录。比如:A->B,当调用B的Try方法异常了,则框架会调用A的Cancel方法和B的Cancel方法(Confirm方法异常与之类似,只是会尝试调用Confirm方法)。考虑调用B的Cancel方法情况,首先框架会写事务日志,表示B参与的事务进入CANCEL状态,接着调用B的Cancel方法,如果Cancel方法没有异常,则会更新事务日志(删除B对应的日志记录)表示B已成功Cancel了,即使后续其他事务参与者有异常造成整个事务依旧没有Cancel完成,框架重试机制会继续尝试Cancel整个事务,这时也不会再调用B的Cancel方法了。如果调用B的Cancel方法异常了,或是调用B的Cancel方法正常,但是更新B的事务日志(删除B对应的日志记录)异常了,则整个事务为未完成状态,框架重试机制会继续尝试Cancel整个事务,这时还会尝试调用B的Cancel方法,更新B的事务日志(删除B对应的日志记录),这种情况下B的Cancel方法会再次调用。

from tcc-transaction.

uguesswhoami avatar uguesswhoami commented on July 20, 2024

如果调用B的Cancel方法异常了,或是调用B的Cancel方法正常,但是更新B的事务日志(删除B对应的日志记录)异常了,则整个事务为未完成状态,框架重试机制会继续尝试Cancel整个事务,这时还会尝试调用B的Cancel方法,更新B的事务日志(删除B对应的日志记录),这种情况下B的Cancel方法会再次调用。
这边有个疑问:
那这样岂不是又没法保证Cancel的幂等了?Cancel还是会执行,应该将“更新B的事务日志”和“B的Cancel方法调用”放在一个事务里吧?

from tcc-transaction.

changmingxie avatar changmingxie commented on July 20, 2024

@uguesswhoami Cancel的幂等性由Cancel方法自己保证。

from tcc-transaction.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.