alibaba / alibaba/cobarclient

cobar-client-1.0.4

Open
#8 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
636
Forks
401
PR merge metrics
No merged PRs in 30d

Description

粗略的看了一下代码,以下是觉得有疑惑的地方,希望能得到作者的解答:
1、CobarSqlMapClientTemplate.sqlMapClient.dataSource没有被加入MultipleDataSourcesTransactionManager管控中,如果这个数据源不在ICobarDataSourceService内声明(就像参考文档那样配置数据源),当路由到这个默认的数据源,事务还能完整吗?

2、基于HotSwappableTargetSource代理的数据源切换会对事务产生影吗?如一个事务中有两个操作,第一个操作在主库完成后主库挂了,第二个操作被切换到次库上,这样事务会有影响吗?

3、如果在这个基础上扩展一个支持读写分离的DataSourceDescriptor,也用HotSwappableTargetSource代理实现数据源切换,发现实现起来很吃力,还可能会有2中的问题。我也看了一下2.0的代码,shard好像也没支持这一部分。因为我现在正要实现这一步分的功能,作者研究这一块应该挺长时间了,希望能得到一些指点。

4、我觉得路由配置可以做的更简单,路由规则配置应该与sqlmap或namespace分离,sqlmap或namespace只需要绑定那个路由规则就可以了,因为多个sqlmap或namespace可以绑定一个路由规则。就像servlet写义与url-mapping的关系,是不是可以变的简单点?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the mentioned CobarSqlMapClientTemplate.sqlMapClient.dataSource, MultipleDataSourcesTransactionManager, ICobarDataSourceService, and HotSwappableTargetSource interactions. Compare these with the 2.0 shard code and the proposed DataSourceDescriptor extension. Done would require resolving the transaction and routing questions and agreeing on a design for read/write separation and shared routing rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.