We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
1、测试发现,DataSourceProxy.java 中调用链如下: -- method: getAutoCommit -- method: getTargetConnection ----getTargetConnection---true | 4 -- method: prepareStatement
getAutoCommit 和 getTransactionIsolation 方法,因为没有默认值(没注入) 均会调用下面的getTargetConnection 方法,来先占用一个write(默认,还没到mapper拦截器)的connection
导致写库连接不能被回收。
2、RWManagedTransaction 中的commit,直接对writeCon和readCon 执行commit方法,当方法不配置事务时,connection是autoCommit的,执行会报异常,但是被catch住了。
3、insert.selectKey会被路由到从库 (select类型) RWPlugin.java if (mappedStatement.getSqlCommandType() == SqlCommandType.SELECT && !mappedStatement.getId().endsWith("!selectKey")) { key = ConnectionHold.READ; }
4、建议: 是否考虑抽取一个数据源(目前是用的tomcat jdbc), spring-boot的默认配置,支持type来制定数据源
The text was updated successfully, but these errors were encountered:
1、默认调用的一个write链接,关闭链接的时候,会释放链接 2、第二个问题我线下测试一下 3、第三个问题确实考虑不全,非常感谢你指出。 4、第四个建议非常棒,可以参考springboot对数据源type的实现。
你提出的几个问题都非常有参考价值,非常感谢你的意见。后期会考虑根据不同的规则写mybatis插件实现简单分表逻辑,如果感兴趣,可以一起参与。
Sorry, something went wrong.
可以加个QQ:276509842
No branches or pull requests
1、测试发现,DataSourceProxy.java 中调用链如下:
-- method: getAutoCommit
-- method: getTargetConnection
----getTargetConnection---true | 4
-- method: prepareStatement
getAutoCommit 和 getTransactionIsolation 方法,因为没有默认值(没注入)
均会调用下面的getTargetConnection 方法,来先占用一个write(默认,还没到mapper拦截器)的connection
导致写库连接不能被回收。
2、RWManagedTransaction 中的commit,直接对writeCon和readCon 执行commit方法,当方法不配置事务时,connection是autoCommit的,执行会报异常,但是被catch住了。
3、insert.selectKey会被路由到从库 (select类型)
RWPlugin.java
if (mappedStatement.getSqlCommandType() == SqlCommandType.SELECT
&& !mappedStatement.getId().endsWith("!selectKey")) {
key = ConnectionHold.READ;
}
4、建议:
是否考虑抽取一个数据源(目前是用的tomcat jdbc), spring-boot的默认配置,支持type来制定数据源
The text was updated successfully, but these errors were encountered: