Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
setCatalog 场景是:
在设计分库的时候,为了以后方便扩展,会使用比较大的切片,比如拆分为 4096 个shard。但是初期的数据量并不会很大,比如用 16 台机器,每个机器跑1个数据库进程,每个进程放 256 个 db。按照现有的一个db一个连接的情况下,一个worker就要用掉数据库256个连接,随便起几十个worker,数据库的连接数就满了。
实现了 ShardConnection 的
setCatalog
getCatalog
方法。@terrymanu 根据 #27 做了调整。
H2 不支持
setCatalog
所以没有增加相关的测试