seata源码解析:seata是如何支持TCC模式的?
2021/10/6 1:10:52
本文主要是介绍seata源码解析:seata是如何支持TCC模式的?,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
介绍
增加了横切逻辑实现类
一阶段开启分支事务
TccActionInterceptor
二阶段提交/回滚分支事务
DefaultCore#commit
TCCResourceManager#branchCommit
CREATE TABLE IF NOT EXISTS `global_table` ( `xid` VARCHAR(128) NOT NULL, `transaction_id` BIGINT, `status` TINYINT NOT NULL, `application_id` VARCHAR(32), `transaction_service_group` VARCHAR(32), `transaction_name` VARCHAR(128), `timeout` INT, `begin_time` BIGINT, `application_data` VARCHAR(2000), `gmt_create` DATETIME, `gmt_modified` DATETIME, PRIMARY KEY (`xid`), KEY `idx_gmt_modified_status` (`gmt_modified`, `status`), KEY `idx_transaction_id` (`transaction_id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; -- the table to store BranchSession data CREATE TABLE IF NOT EXISTS `branch_table` ( `branch_id` BIGINT NOT NULL, `xid` VARCHAR(128) NOT NULL, `transaction_id` BIGINT, `resource_group_id` VARCHAR(32), `resource_id` VARCHAR(256), `branch_type` VARCHAR(8), `status` TINYINT, `client_id` VARCHAR(64), `application_data` VARCHAR(2000), `gmt_create` DATETIME(6), `gmt_modified` DATETIME(6), PRIMARY KEY (`branch_id`), KEY `idx_xid` (`xid`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8; -- the table to store lock data CREATE TABLE IF NOT EXISTS `lock_table` ( `row_key` VARCHAR(128) NOT NULL, `xid` VARCHAR(128), `transaction_id` BIGINT, `branch_id` BIGINT NOT NULL, `resource_id` VARCHAR(256), `table_name` VARCHAR(32), `pk` VARCHAR(36), `gmt_create` DATETIME, `gmt_modified` DATETIME, PRIMARY KEY (`row_key`), KEY `idx_branch_id` (`branch_id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
global_table
172.21.0.14:18091:6449338273221152788,6449338273221152788,1,seata-tcc-tm,my_test_tx_group,“transfer(java.lang.String, java.lang.String, java.lang.Integer)”,60000,1633261303962,2021-10-03 19:41:43,2021-10-03 19:41:43
branch_table
6449338273221152790,172.21.0.14:18091:6449338273221152788,6449338273221152788,prepare,TCC,0,seata-tcc-tm:219.238.205.162:30726,"{"“actionContext”":{"“action-start-time”":1633261303972,"“money”":200,"“sys::prepare”":"“prepare”","“fromUserId”":"“1001"”,"“sys::rollback”":"“cancel”","“sys::commit”":"“commit”","“host-name”":"“192.168.97.57"”,"“toUserId”":"“1002"”,"“actionName”":"“prepare”"}}",2021-10-03 19:41:43,2021-10-03 19:41:43
6449338273221152792,172.21.0.14:18091:6449338273221152788,6449338273221152788,prepare,TCC,0,seata-tcc-rm:219.238.205.162:30537,"{"“actionContext”":{"“action-start-time”":1633261304008,"“money”":200,"“sys::prepare”":"“prepare”","“fromUserId”":"“1001"”,"“sys::rollback”":"“cancel”","“sys::commit”":"“commit”","“host-name”":"“192.168.97.57"”,"“toUserId”":"“1002"”,"“actionName”":"“prepare”"}}",2021-10-03 19:41:44,2021-10-03 19:41:44
参考博客
[1]https://blog.csdn.net/zjj2006/article/details/108959939
[2]https://zhuanlan.zhihu.com/p/271735569
这篇关于seata源码解析:seata是如何支持TCC模式的?的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享