forked from baihui212/tsharding
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request baihui212#8 from threezhang/jiuru
@jiuru thanks for refine readme
- Loading branch information
Showing
6 changed files
with
166 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
交易分库分表组件TSharding | ||
## 交易分库分表组件TSharding | ||
|
||
|
||
### 关键类 | ||
* 1.测试用例入口 com.mogujie.service.tsharding.test#TShardingTest | ||
|
||
#### | ||
1.测试用例入口 com.mogujie.service.tsharding.test#TShardingTest | ||
2.默认走Master库的前缀命名 com.mogujie.trade.tsharding.route.orm.base.ReadWriteSplittingContextInitializer.DEFAULT_WRITE_METHOD_NAMES | ||
3.SQL增强 com.mogujie.trade.tsharding.route.orm.MapperResourceEnhancer.enhancedShardingSQL | ||
* 2.默认走Master库的前缀命名 com.mogujie.trade.tsharding.route.orm.base.ReadWriteSplittingContextInitializer.DEFAULT_WRITE_METHOD_NAMES | ||
|
||
* 3.SQL增强 com.mogujie.trade.tsharding.route.orm.MapperResourceEnhancer.enhancedShardingSQL | ||
|
||
|
||
### 测试用例 | ||
|
||
跑测试用例之前先建库建表结构; | ||
理论上是8个库,512张表,每个库64张表. | ||
|
||
如果仅仅是跑测试用例,执行下面的sql就可以跑通: | ||
|
||
create database trade0000; | ||
create database trade0001; | ||
create database trade0002; | ||
create database trade0003; | ||
create database trade0004; | ||
create database trade0005; | ||
create database trade0006; | ||
create database trade0007; | ||
create database trade; | ||
use trade0001; | ||
|
||
CREATE TABLE `TradeOrder0064` ( | ||
`orderId` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID', | ||
`buyerUserId` bigint(20) unsigned NOT NULL COMMENT '买家的userId', | ||
`sellerUserId` bigint(20) unsigned NOT NULL COMMENT '卖家的userId', | ||
`shipTime` int(11) unsigned DEFAULT '0' COMMENT '发货时间', | ||
PRIMARY KEY (`orderId`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8mb4 COMMENT='订单信息表'; | ||
|
||
INSERT INTO `TradeOrder0064` (`orderId`, `buyerUserId`, `sellerUserId`, `shipTime`) | ||
VALUES | ||
(50000280834672, 1234567, 2345678, 12345678); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
tsharding-client/src/test/resources/META-INF/support/datasource.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.