Skip to content

Commit

Permalink
Merge pull request #259 from codingapi/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
xlorne authored Feb 22, 2019
2 parents 7bb11a4 + ad0d3ed commit e7eff94
Show file tree
Hide file tree
Showing 161 changed files with 2,449 additions and 835 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug Report
about: Report a issue to TX-LCN, please use this template.


---

- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.

### 1. Bug Description


### 2. Environment:
- JDK version:
- OS:
- TX-LCN version:
- Others:

### 3. Exception Stacktrace

```
Paste your Exception Stacktrace here!
```

### 4. Tour Idea


16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature Request
about: Suggest an idea for TX-LCN

---

## Why you need it?
Is your feature request related to a problem? Please describe in details


## How it could be?
A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.


## Other related information
Add any other context or screenshots about the feature request here.
59 changes: 16 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,19 @@
# tx-lcn分布式事务框架 (5.0.1.RELEASE)
# Distributed Transaction Framework - LCN (5.0.2.RELEASE)

[![Maven](https://img.shields.io/badge/endpoint.svg?url=https://bbs.txlcn.org/maven-central)](https://bbs.txlcn.org/maven-list)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/codingapi/tx-lcn/blob/master/LICENSE)
[![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)
[![BBS](https://bbs.txlcn.org/style/Archlinux/txlcn-bbs.svg)](https://bbs.txlcn.org)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?label=license)](https://github.com/codingapi/tx-lcn/blob/master/LICENSE)


## 项目介绍

5.0完全拥抱springboot体系,基于JDK1.8,不仅仅支持LCN事务模式,同时引入了TCC,TXC模式,把分布式事务协调的模式抽象出来,让各种模式可以嵌套使用。

事务模式说明:TCC是用户自己实现提交回滚业务,LCN是框架代理JDBC Connection实现提交回滚业务, TXC是框架分析业务SQL提前提交,在需要回滚时生成逆向回滚。

TCC忽略不说。LCN与TXC两种框架实现的事务模式到底那个更优越呢?

理论上,在并发量大,资源相对紧张时,TXC要优于LCN,但从目前测试上来说,结果却非如此,LCN还是稍优于TXC。同时TXC还限制了业务SQL形式,未做到完全逆向
后续版本将会着重优化TXC,包括性能上和SQL的完全逆向上。


版本较4.x主要特点:
1. 基于springboot 研发
2. 抽离LCN封装业务,提出业务接口层与通讯层,可支持自定义分布式事务模式与通讯模式。
3. 支持LCN TXC TCC 三种事务模式,且可混合支持。
4. 性能较优秀,去掉了线程等待机制,提高吞吐量。



## 模块划分

1. txlcn-tc:*TXLCN分布式事务客户端*
2. txlcn-common:*公共模块*
3. txlcn-logger:*日志模块。(默认提供日志持久化到MySQL的支持)*
4. txlcn-tm:*TXLCN事务管理器*
5. txlcn-txmsg:*事务消息扩展接口*
6. txlcn-txmsg-netty:*事务消息接口的Netty实现*
7. txlcn-tracing:*分布式事务追踪工具*

## 官网文档

官网文档 见docs分支

https://txlcn.org


技术交流群:554855843(已满) 970071379(未满)

## Modules
1. txlcn-tc: *Distributed Transaction Client*
2. txlcn-common: *Commons*
3. txlcn-logger: *Provide persistent logs to MySQL*
4. txlcn-tm: *Distributed Transaction Manager*
5. txlcn-txmsg: *Distributed Transaction Message Extensions API*
6. txlcn-txmsg-netty: *Distributed Transaction Message Extensions Implementation*
7. txlcn-tracing: *Distributed Transaction Tracing*

## The Authority
Website: [https://txlcn.org](https://txlcn.org/en-us/)
Statistics: [Leave your company messages](https://github.com/codingapi/tx-lcn/issues/7)
QQ:554855843 (Hot) 970071379(Normal)
46 changes: 46 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# TX-LCN分布式事务框架 (5.0.2.RELEASE)

[![Maven](https://img.shields.io/badge/endpoint.svg?url=https://bbs.txlcn.org/maven-central)](https://bbs.txlcn.org/maven-list)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/codingapi/tx-lcn/blob/master/LICENSE)
[![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)


## 项目介绍

5.0完全拥抱springboot体系,基于JDK1.8,不仅仅支持LCN事务模式,同时引入了TCC,TXC模式,把分布式事务协调的模式抽象出来,让各种模式可以嵌套使用。

事务模式说明:TCC是用户自己实现提交回滚业务,LCN是框架代理JDBC Connection实现提交回滚业务, TXC是框架分析业务SQL提前提交,在需要回滚时生成逆向回滚。

TCC忽略不说。LCN与TXC两种框架实现的事务模式到底那个更优越呢?

理论上,在并发量大,资源相对紧张时,TXC要优于LCN,但从目前测试上来说,结果却非如此,LCN还是稍优于TXC。同时TXC还限制了业务SQL形式,未做到完全逆向
后续版本将会着重优化TXC,包括性能上和SQL的完全逆向上。


版本较4.x主要特点:
1. 基于SpringBoot研发
2. 抽离LCN封装业务,提出业务接口层与通讯层,可支持自定义分布式事务模式与通讯模式。
3. 支持LCN TXC TCC 三种事务模式,且可混合支持。
4. 性能较优秀,去掉了线程等待机制,提高吞吐量。



## 模块划分

1. txlcn-tc:*TXLCN分布式事务客户端*
2. txlcn-common:*公共模块*
3. txlcn-logger:*日志模块。(默认提供日志持久化到MySQL的支持)*
4. txlcn-tm:*TXLCN事务管理器*
5. txlcn-txmsg:*事务消息扩展接口*
6. txlcn-txmsg-netty:*事务消息接口的Netty实现*
7. txlcn-tracing:*分布式事务追踪工具*

## 官网文档

官网文档 见docs分支

https://txlcn.org


技术交流群:554855843(已满) 970071379(未满)

44 changes: 17 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.codingapi.txlcn</groupId>
<artifactId>tx-lcn</artifactId>
<version>5.0.1.RELEASE</version>
<version>5.0.2.RELEASE</version>
<packaging>pom</packaging>


Expand Down Expand Up @@ -43,24 +43,24 @@
<maven.javadoc.plugin>2.10.3</maven.javadoc.plugin>
<maven.gpg.plugin>1.6</maven.gpg.plugin>

<codingapi.txlcn.version>5.0.1.RELEASE</codingapi.txlcn.version>
<codingapi.txlcn.version>5.0.2.RELEASE</codingapi.txlcn.version>

<txlcn-org.projectlombok.version>1.18.0</txlcn-org.projectlombok.version>
<txlcn-spring-cloud.version>Finchley.SR2</txlcn-spring-cloud.version>
<txlcn-io.netty.version>4.1.31.Final</txlcn-io.netty.version>
<txlcn-com.alibaba.fastjson.version>1.2.34</txlcn-com.alibaba.fastjson.version>
<txlcn-guava.version>19.0</txlcn-guava.version>
<txlcn-hessian.version>4.0.38</txlcn-hessian.version>
<txlcn-protostuff.version>1.1.3</txlcn-protostuff.version>
<txlcn-protostuff.version>1.6.0</txlcn-protostuff.version>
<txlcn-kryo.version>4.0.0</txlcn-kryo.version>

<txlcn-com.lmax.disruptor.version>3.4.2</txlcn-com.lmax.disruptor.version>
<txlcn-commons-dbutils.version>1.7</txlcn-commons-dbutils.version>
<txlcn-com.github.jsqlparser.version>1.3</txlcn-com.github.jsqlparser.version>
<txlcn-com.h2database.version>1.4.197</txlcn-com.h2database.version>
<txlcn-hikari-cp.version>3.1.0</txlcn-hikari-cp.version>
<txlcn-com.github.pagehelper.version>1.2.10</txlcn-com.github.pagehelper.version>
<txlcn-org.mybatis.spring.boot.version>1.3.2</txlcn-org.mybatis.spring.boot.version>


<txlcn-com.alibaba.dubbo.verion>2.6.5</txlcn-com.alibaba.dubbo.verion>
<txlcn-com.netflix.feign.core.verison>8.18.0</txlcn-com.netflix.feign.core.verison>
<txlcn-com.netflix.ribbon.loadbalancer.version>2.3.0</txlcn-com.netflix.ribbon.loadbalancer.version>
Expand Down Expand Up @@ -112,15 +112,16 @@
</dependency>

<dependency>
<groupId>com.dyuproject.protostuff</groupId>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-core</artifactId>
</dependency>

<dependency>
<groupId>com.dyuproject.protostuff</groupId>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-runtime</artifactId>
</dependency>


<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo-shaded</artifactId>
Expand All @@ -138,12 +139,6 @@
<dependencyManagement>
<dependencies>

<dependency>
<groupId>com.codingapi.txlcn</groupId>
<artifactId>txlcn-tc</artifactId>
<version>${codingapi.txlcn.version}</version>
</dependency>

<dependency>
<groupId>com.codingapi.txlcn</groupId>
<artifactId>txlcn-txmsg-netty</artifactId>
Expand Down Expand Up @@ -174,18 +169,6 @@
<version>${codingapi.txlcn.version}</version>
</dependency>

<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${txlcn-com.github.pagehelper.version}</version>
</dependency>

<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${txlcn-org.mybatis.spring.boot.version}</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down Expand Up @@ -235,13 +218,13 @@
</dependency>

<dependency>
<groupId>com.dyuproject.protostuff</groupId>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-core</artifactId>
<version>${txlcn-protostuff.version}</version>
</dependency>

<dependency>
<groupId>com.dyuproject.protostuff</groupId>
<groupId>io.protostuff</groupId>
<artifactId>protostuff-runtime</artifactId>
<version>${txlcn-protostuff.version}</version>
</dependency>
Expand Down Expand Up @@ -282,6 +265,13 @@
<version>${txlcn-org.springframework.cloud.commons.version}</version>
</dependency>

<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
<version>1.5.18</version>
</dependency>


</dependencies>
</dependencyManagement>

Expand Down
2 changes: 1 addition & 1 deletion run.txmanager.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off

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

64 changes: 64 additions & 0 deletions tm.docker.build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
### 构建镜像到本地
```
# 当前路径 tx-lcn/txlcn-tm
mvn clean package -DskipTests docker:build
```

#### 运行说明
- 可以不用构建,在有docker环境的机器上直接运行下面命令

1 、 命令行传参数运行

```
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
```
- 说明
- -p 端口映射 宿主机器端口:容器内端口
- --name : 容器别名
- --restart always : 容器伴随docker服务启动(如果docker是开机启动,那么这个容器就是开机启动的)
- -d : 放入后台运行
- -e 相当于 java -jar tm.jar 后面的参数,
- spring.datasource.url 这个配置里面如果有特殊符号 命令行不支持,建议使用第二种方式

2 、 增加外部配置文件运行. 需要在宿主机器上有文件 /opt/data/lcntm/application-dev.properties
```
spring.application.name=tx-manager
server.port=7970
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tx-manager?characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root
#mybatis.configuration.map-underscore-to-camel-case=true
#mybatis.configuration.use-generated-keys=true
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=none
#tx-lcn.logger.enabled=true
# TxManager Host Ip
tx-lcn.manager.host=127.0.0.1
# TxClient连接请求端口
tx-lcn.manager.port=8070
tx-lcn.manager.admin-key=123456
# 心跳检测时间(ms)
#tx-lcn.manager.heart-time=15000
# 分布式事务执行总时间
#tx-lcn.manager.dtx-time=30000
#参数延迟删除时间单位ms
#tx-lcn.message.netty.attr-delay-time=10000
#tx-lcn.manager.concurrent-level=128
# 开启日志
#tx-lcn.logger.enabled=true
#logging.level.com.codingapi=debug
#redisIp
spring.redis.host=127.0.0.1
#redis\u7AEF\u53E3
spring.redis.port=6379
#redis\u5BC6\u7801
#spring.redis.password=
```
执行命令
```
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
```
- 说明
- -v : 文件挂载
2 changes: 1 addition & 1 deletion txlcn-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>tx-lcn</artifactId>
<groupId>com.codingapi.txlcn</groupId>
<version>5.0.1.RELEASE</version>
<version>5.0.2.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
*/
package com.codingapi.txlcn.common.exception;

import java.io.IOException;

/**
* @author lorne 2018/12/2
*
*/
public class SerializerException extends Exception {
public class SerializerException extends IOException {


public SerializerException() {
Expand All @@ -38,9 +40,7 @@ public SerializerException(Throwable cause) {
super(cause);
}

protected SerializerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}



}
Loading

0 comments on commit e7eff94

Please sign in to comment.