Skip to content

Commit e7eff94

Browse files
authored
Merge pull request #259 from codingapi/dev
Dev
2 parents 7bb11a4 + ad0d3ed commit e7eff94

161 files changed

Lines changed: 2449 additions & 835 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug Report
3+
about: Report a issue to TX-LCN, please use this template.
4+
5+
6+
---
7+
8+
- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.
9+
10+
### 1. Bug Description
11+
12+
13+
### 2. Environment:
14+
- JDK version:
15+
- OS:
16+
- TX-LCN version:
17+
- Others:
18+
19+
### 3. Exception Stacktrace
20+
21+
```
22+
Paste your Exception Stacktrace here!
23+
```
24+
25+
### 4. Tour Idea
26+
27+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for TX-LCN
4+
5+
---
6+
7+
## Why you need it?
8+
Is your feature request related to a problem? Please describe in details
9+
10+
11+
## How it could be?
12+
A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.
13+
14+
15+
## Other related information
16+
Add any other context or screenshots about the feature request here.

README.md

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,19 @@
1-
# tx-lcn分布式事务框架 (5.0.1.RELEASE)
1+
# Distributed Transaction Framework - LCN (5.0.2.RELEASE)
22

3+
[![Maven](https://img.shields.io/badge/endpoint.svg?url=https://bbs.txlcn.org/maven-central)](https://bbs.txlcn.org/maven-list)
4+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/codingapi/tx-lcn/blob/master/LICENSE)
35
[![Gitter](https://badges.gitter.im/codingapi/tx-lcn.svg)](https://gitter.im/codingapi/tx-lcn?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
4-
[![BBS](https://bbs.txlcn.org/style/Archlinux/txlcn-bbs.svg)](https://bbs.txlcn.org)
5-
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?label=license)](https://github.com/codingapi/tx-lcn/blob/master/LICENSE)
6-
7-
8-
## 项目介绍
9-
10-
5.0完全拥抱springboot体系,基于JDK1.8,不仅仅支持LCN事务模式,同时引入了TCC,TXC模式,把分布式事务协调的模式抽象出来,让各种模式可以嵌套使用。
11-
12-
事务模式说明:TCC是用户自己实现提交回滚业务,LCN是框架代理JDBC Connection实现提交回滚业务, TXC是框架分析业务SQL提前提交,在需要回滚时生成逆向回滚。
13-
14-
TCC忽略不说。LCN与TXC两种框架实现的事务模式到底那个更优越呢?
15-
16-
理论上,在并发量大,资源相对紧张时,TXC要优于LCN,但从目前测试上来说,结果却非如此,LCN还是稍优于TXC。同时TXC还限制了业务SQL形式,未做到完全逆向
17-
后续版本将会着重优化TXC,包括性能上和SQL的完全逆向上。
18-
19-
20-
版本较4.x主要特点:
21-
1. 基于springboot 研发
22-
2. 抽离LCN封装业务,提出业务接口层与通讯层,可支持自定义分布式事务模式与通讯模式。
23-
3. 支持LCN TXC TCC 三种事务模式,且可混合支持。
24-
4. 性能较优秀,去掉了线程等待机制,提高吞吐量。
25-
26-
27-
28-
## 模块划分
29-
30-
1. txlcn-tc:*TXLCN分布式事务客户端*
31-
2. txlcn-common:*公共模块*
32-
3. txlcn-logger:*日志模块。(默认提供日志持久化到MySQL的支持)*
33-
4. txlcn-tm:*TXLCN事务管理器*
34-
5. txlcn-txmsg:*事务消息扩展接口*
35-
6. txlcn-txmsg-netty:*事务消息接口的Netty实现*
36-
7. txlcn-tracing:*分布式事务追踪工具*
37-
38-
## 官网文档
39-
40-
官网文档 见docs分支
41-
42-
https://txlcn.org
43-
44-
45-
技术交流群:554855843(已满) 970071379(未满)
466

7+
## Modules
8+
1. txlcn-tc: *Distributed Transaction Client*
9+
2. txlcn-common: *Commons*
10+
3. txlcn-logger: *Provide persistent logs to MySQL*
11+
4. txlcn-tm: *Distributed Transaction Manager*
12+
5. txlcn-txmsg: *Distributed Transaction Message Extensions API*
13+
6. txlcn-txmsg-netty: *Distributed Transaction Message Extensions Implementation*
14+
7. txlcn-tracing: *Distributed Transaction Tracing*
15+
16+
## The Authority
17+
Website: [https://txlcn.org](https://txlcn.org/en-us/)
18+
Statistics: [Leave your company messages](https://github.com/codingapi/tx-lcn/issues/7)
19+
QQ:554855843 (Hot) 970071379(Normal)

README_zh_CN.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# TX-LCN分布式事务框架 (5.0.2.RELEASE)
2+
3+
[![Maven](https://img.shields.io/badge/endpoint.svg?url=https://bbs.txlcn.org/maven-central)](https://bbs.txlcn.org/maven-list)
4+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/codingapi/tx-lcn/blob/master/LICENSE)
5+
[![Gitter](https://badges.gitter.im/codingapi/tx-lcn.svg)](https://gitter.im/codingapi/tx-lcn?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6+
7+
8+
## 项目介绍
9+
10+
5.0完全拥抱springboot体系,基于JDK1.8,不仅仅支持LCN事务模式,同时引入了TCC,TXC模式,把分布式事务协调的模式抽象出来,让各种模式可以嵌套使用。
11+
12+
事务模式说明:TCC是用户自己实现提交回滚业务,LCN是框架代理JDBC Connection实现提交回滚业务, TXC是框架分析业务SQL提前提交,在需要回滚时生成逆向回滚。
13+
14+
TCC忽略不说。LCN与TXC两种框架实现的事务模式到底那个更优越呢?
15+
16+
理论上,在并发量大,资源相对紧张时,TXC要优于LCN,但从目前测试上来说,结果却非如此,LCN还是稍优于TXC。同时TXC还限制了业务SQL形式,未做到完全逆向
17+
后续版本将会着重优化TXC,包括性能上和SQL的完全逆向上。
18+
19+
20+
版本较4.x主要特点:
21+
1. 基于SpringBoot研发
22+
2. 抽离LCN封装业务,提出业务接口层与通讯层,可支持自定义分布式事务模式与通讯模式。
23+
3. 支持LCN TXC TCC 三种事务模式,且可混合支持。
24+
4. 性能较优秀,去掉了线程等待机制,提高吞吐量。
25+
26+
27+
28+
## 模块划分
29+
30+
1. txlcn-tc:*TXLCN分布式事务客户端*
31+
2. txlcn-common:*公共模块*
32+
3. txlcn-logger:*日志模块。(默认提供日志持久化到MySQL的支持)*
33+
4. txlcn-tm:*TXLCN事务管理器*
34+
5. txlcn-txmsg:*事务消息扩展接口*
35+
6. txlcn-txmsg-netty:*事务消息接口的Netty实现*
36+
7. txlcn-tracing:*分布式事务追踪工具*
37+
38+
## 官网文档
39+
40+
官网文档 见docs分支
41+
42+
https://txlcn.org
43+
44+
45+
技术交流群:554855843(已满) 970071379(未满)
46+

pom.xml

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.codingapi.txlcn</groupId>
88
<artifactId>tx-lcn</artifactId>
9-
<version>5.0.1.RELEASE</version>
9+
<version>5.0.2.RELEASE</version>
1010
<packaging>pom</packaging>
1111

1212

@@ -43,24 +43,24 @@
4343
<maven.javadoc.plugin>2.10.3</maven.javadoc.plugin>
4444
<maven.gpg.plugin>1.6</maven.gpg.plugin>
4545

46-
<codingapi.txlcn.version>5.0.1.RELEASE</codingapi.txlcn.version>
46+
<codingapi.txlcn.version>5.0.2.RELEASE</codingapi.txlcn.version>
4747

4848
<txlcn-org.projectlombok.version>1.18.0</txlcn-org.projectlombok.version>
4949
<txlcn-spring-cloud.version>Finchley.SR2</txlcn-spring-cloud.version>
5050
<txlcn-io.netty.version>4.1.31.Final</txlcn-io.netty.version>
5151
<txlcn-com.alibaba.fastjson.version>1.2.34</txlcn-com.alibaba.fastjson.version>
5252
<txlcn-guava.version>19.0</txlcn-guava.version>
5353
<txlcn-hessian.version>4.0.38</txlcn-hessian.version>
54-
<txlcn-protostuff.version>1.1.3</txlcn-protostuff.version>
54+
<txlcn-protostuff.version>1.6.0</txlcn-protostuff.version>
5555
<txlcn-kryo.version>4.0.0</txlcn-kryo.version>
5656

5757
<txlcn-com.lmax.disruptor.version>3.4.2</txlcn-com.lmax.disruptor.version>
5858
<txlcn-commons-dbutils.version>1.7</txlcn-commons-dbutils.version>
5959
<txlcn-com.github.jsqlparser.version>1.3</txlcn-com.github.jsqlparser.version>
6060
<txlcn-com.h2database.version>1.4.197</txlcn-com.h2database.version>
6161
<txlcn-hikari-cp.version>3.1.0</txlcn-hikari-cp.version>
62-
<txlcn-com.github.pagehelper.version>1.2.10</txlcn-com.github.pagehelper.version>
63-
<txlcn-org.mybatis.spring.boot.version>1.3.2</txlcn-org.mybatis.spring.boot.version>
62+
63+
6464
<txlcn-com.alibaba.dubbo.verion>2.6.5</txlcn-com.alibaba.dubbo.verion>
6565
<txlcn-com.netflix.feign.core.verison>8.18.0</txlcn-com.netflix.feign.core.verison>
6666
<txlcn-com.netflix.ribbon.loadbalancer.version>2.3.0</txlcn-com.netflix.ribbon.loadbalancer.version>
@@ -112,15 +112,16 @@
112112
</dependency>
113113

114114
<dependency>
115-
<groupId>com.dyuproject.protostuff</groupId>
115+
<groupId>io.protostuff</groupId>
116116
<artifactId>protostuff-core</artifactId>
117117
</dependency>
118118

119119
<dependency>
120-
<groupId>com.dyuproject.protostuff</groupId>
120+
<groupId>io.protostuff</groupId>
121121
<artifactId>protostuff-runtime</artifactId>
122122
</dependency>
123123

124+
124125
<dependency>
125126
<groupId>com.esotericsoftware</groupId>
126127
<artifactId>kryo-shaded</artifactId>
@@ -138,12 +139,6 @@
138139
<dependencyManagement>
139140
<dependencies>
140141

141-
<dependency>
142-
<groupId>com.codingapi.txlcn</groupId>
143-
<artifactId>txlcn-tc</artifactId>
144-
<version>${codingapi.txlcn.version}</version>
145-
</dependency>
146-
147142
<dependency>
148143
<groupId>com.codingapi.txlcn</groupId>
149144
<artifactId>txlcn-txmsg-netty</artifactId>
@@ -174,18 +169,6 @@
174169
<version>${codingapi.txlcn.version}</version>
175170
</dependency>
176171

177-
<dependency>
178-
<groupId>com.github.pagehelper</groupId>
179-
<artifactId>pagehelper-spring-boot-starter</artifactId>
180-
<version>${txlcn-com.github.pagehelper.version}</version>
181-
</dependency>
182-
183-
<dependency>
184-
<groupId>org.mybatis.spring.boot</groupId>
185-
<artifactId>mybatis-spring-boot-starter</artifactId>
186-
<version>${txlcn-org.mybatis.spring.boot.version}</version>
187-
</dependency>
188-
189172
<dependency>
190173
<groupId>com.h2database</groupId>
191174
<artifactId>h2</artifactId>
@@ -235,13 +218,13 @@
235218
</dependency>
236219

237220
<dependency>
238-
<groupId>com.dyuproject.protostuff</groupId>
221+
<groupId>io.protostuff</groupId>
239222
<artifactId>protostuff-core</artifactId>
240223
<version>${txlcn-protostuff.version}</version>
241224
</dependency>
242225

243226
<dependency>
244-
<groupId>com.dyuproject.protostuff</groupId>
227+
<groupId>io.protostuff</groupId>
245228
<artifactId>protostuff-runtime</artifactId>
246229
<version>${txlcn-protostuff.version}</version>
247230
</dependency>
@@ -282,6 +265,13 @@
282265
<version>${txlcn-org.springframework.cloud.commons.version}</version>
283266
</dependency>
284267

268+
<dependency>
269+
<groupId>com.netflix.hystrix</groupId>
270+
<artifactId>hystrix-core</artifactId>
271+
<version>1.5.18</version>
272+
</dependency>
273+
274+
285275
</dependencies>
286276
</dependencyManagement>
287277

run.txmanager.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@echo off
22

3-
start java -jar -Xms256m -Xmx512m txlcn-tm/target/txlcn-tm-5.0.1.RELEASE.jar
3+
start java -jar -Xms256m -Xmx512m txlcn-tm/target/txlcn-tm-5.0.2.RELEASE.jar
44

tm.docker.build.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
### 构建镜像到本地
2+
```
3+
# 当前路径 tx-lcn/txlcn-tm
4+
mvn clean package -DskipTests docker:build
5+
```
6+
7+
#### 运行说明
8+
- 可以不用构建,在有docker环境的机器上直接运行下面命令
9+
10+
1 、 命令行传参数运行
11+
12+
```
13+
docker run -p 7970:7970 -p 8070:8070 --restart always --name tm -e spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tx_manager -e spring.datasource.username=root -e spring.datasource.password=root -e spring.redis.host=127.0.0.1 -e spring.redis.port=6379 -e spring.redis.password= -e tx-lcn.manager.admin-key=123456 -d codingapi/txlcn-tm
14+
```
15+
- 说明
16+
- -p 端口映射 宿主机器端口:容器内端口
17+
- --name : 容器别名
18+
- --restart always : 容器伴随docker服务启动(如果docker是开机启动,那么这个容器就是开机启动的)
19+
- -d : 放入后台运行
20+
- -e 相当于 java -jar tm.jar 后面的参数,
21+
- spring.datasource.url 这个配置里面如果有特殊符号 命令行不支持,建议使用第二种方式
22+
23+
2 、 增加外部配置文件运行. 需要在宿主机器上有文件 /opt/data/lcntm/application-dev.properties
24+
```
25+
spring.application.name=tx-manager
26+
server.port=7970
27+
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
28+
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tx-manager?characterEncoding=UTF-8
29+
spring.datasource.username=root
30+
spring.datasource.password=root
31+
#mybatis.configuration.map-underscore-to-camel-case=true
32+
#mybatis.configuration.use-generated-keys=true
33+
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
34+
spring.jpa.hibernate.ddl-auto=none
35+
#tx-lcn.logger.enabled=true
36+
# TxManager Host Ip
37+
tx-lcn.manager.host=127.0.0.1
38+
# TxClient连接请求端口
39+
tx-lcn.manager.port=8070
40+
tx-lcn.manager.admin-key=123456
41+
42+
# 心跳检测时间(ms)
43+
#tx-lcn.manager.heart-time=15000
44+
# 分布式事务执行总时间
45+
#tx-lcn.manager.dtx-time=30000
46+
#参数延迟删除时间单位ms
47+
#tx-lcn.message.netty.attr-delay-time=10000
48+
#tx-lcn.manager.concurrent-level=128
49+
# 开启日志
50+
#tx-lcn.logger.enabled=true
51+
#logging.level.com.codingapi=debug
52+
#redisIp
53+
spring.redis.host=127.0.0.1
54+
#redis\u7AEF\u53E3
55+
spring.redis.port=6379
56+
#redis\u5BC6\u7801
57+
#spring.redis.password=
58+
```
59+
执行命令
60+
```
61+
docker run -p 7970:7970 -p 8070:8070 --restart always --name tm -v /opt/data/lcntm:/opt/data/lcntm -e spring.profiles.active=dev -e spring.config.additional-location=/opt/data/lcntm/application-dev.properties -d codingapi/txlcn.tm
62+
```
63+
- 说明
64+
- -v : 文件挂载

txlcn-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>tx-lcn</artifactId>
77
<groupId>com.codingapi.txlcn</groupId>
8-
<version>5.0.1.RELEASE</version>
8+
<version>5.0.2.RELEASE</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

txlcn-common/src/main/java/com/codingapi/txlcn/common/exception/SerializerException.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
*/
1616
package com.codingapi.txlcn.common.exception;
1717

18+
import java.io.IOException;
19+
1820
/**
1921
* @author lorne 2018/12/2
2022
*
2123
*/
22-
public class SerializerException extends Exception {
24+
public class SerializerException extends IOException {
2325

2426

2527
public SerializerException() {
@@ -38,9 +40,7 @@ public SerializerException(Throwable cause) {
3840
super(cause);
3941
}
4042

41-
protected SerializerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
42-
super(message, cause, enableSuppression, writableStackTrace);
43-
}
43+
4444

4545

4646
}

0 commit comments

Comments
 (0)