Code Monkey home page Code Monkey logo

Comments (3)

dk-lockdown avatar dk-lockdown commented on July 28, 2024

分布式事物由两个事物组成
1负责创建订单时扣减库存
2负责创建订单时写入订单主表和订单明细表

当1事物 commit 之后(库存减少了) , 2事物出错了需要回滚 , 全局回滚完成 之前, 这时读取的库存数是1事物commit之后的, 这种问题要怎么处理?

使用 select for update 查询库存,查询时,集成 seata 的 driver 会重试去 tc 上询问对应的数据是否被锁住,tc 释放了锁,select for update 从数据库获取到当前的库存数据。

from incubator-seata-go.

pwjbj avatar pwjbj commented on July 28, 2024

本地锁和全局锁是如何申请和释放的

from incubator-seata-go.

dk-lockdown avatar dk-lockdown commented on July 28, 2024

本地锁和全局锁是如何申请和释放的

本地锁本地提交时释放,全局锁,全局提交、回滚成功后释放

from incubator-seata-go.

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.