1 Star 0 Fork 0

熙哥 / Transactional-Mongodb-Driver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

这是我们的Sidistran异构分布式事务框架中,mongodb的分布式事务参与端。它同时也是可以独立使用的mongodb事务性驱动。

如果需要完整的Sidistran异构分布式事务(跨关系型数据库、非关系型数据库、存储)解决方案,请联系我们

SidistranMongoDriver

A MongoDB java driver, with MVCC. So, you can use it to perform Transaction Transactional with your code

PS: in the newest version, we can perform a "distributed transaction"

  1. not only cross over mongodb but could cross over mongodb and mysql
  2. not only one mongodb-server or mysql-server but any differents
  3. support spring annoation

contact me (mail:11509923@qq.com) if you have interesting.

1. if your working db already has datas, you must do this:

db.XX.update({}, {$set:{__s_.__s_stat: 2, __s_.__s_g_time:Long.MAX_VALUE,__s_.__s_c_txid:-1l,__s_.__s_u_txid:-1l})

very important

  1)your connection user must can see the DB named “transaction”
  2)the user with credential must can [readWrite] DB-“transaction”
  4)if your collection already has an uniqueindex.you must:
     fisrt drop it,
     then recreate it but add a field named "unique_" to the index.
     i.e.: consider Collection A has  uniqueindex that name="test", field="aaaa".
           this index should be update to name="test", field="aaaa, unique_".
     !!!!OR!!!!YOU CAN CREATE INDEX VIA THIS DRIVER!!!IT WILL AUTOMATIC CREATE THE "unique_" FIELD" 
     
     
  CAUSTIONS:
  1)do not support DBRef with _id,because on update will create new temp-obj with new _id;

#Or you can do these operations in your own codes ^_^#

2.config SidistranMongoClient int Spring

can not use “mongo” label,you should config a <bean id="mongo" class="SidistranMongoClient"> instead

3.demo:

   SidistranMongoClient mongo = new SidistranMongoClient(serverAddress, credentials);

   MongoTanscationManager tanscationManager = new MongoTanscationManager(mongo);//this is singleton

   tanscationManager.begin();//begin a transaction

   do_with(mongo);

   tanscationManager.commit();//commit it

   tanscationManager.close();//you must close the MongoTanscationManager if won't use anymore
   mongo.close();

空文件

简介

让你的MongoDB拥有事务。如果需要跨数据库的分布式事务请联系作者 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/xige/Transactional-Mongodb-Driver.git
git@gitee.com:xige/Transactional-Mongodb-Driver.git
xige
Transactional-Mongodb-Driver
Transactional-Mongodb-Driver
master

搜索帮助