Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change catalog when needed #27

Closed
wants to merge 0 commits into from
Closed

Change catalog when needed #27

wants to merge 0 commits into from

Conversation

gfreezy
Copy link
Contributor

@gfreezy gfreezy commented Mar 7, 2016

This makes sharing a DataSource between databases in the same instance
possible.

@terrymanu
Copy link
Member

有几个疑问想弄清楚:

  1. setCatalog在真实场景中哪里会用到
  2. 即使这里setCatalog,而sharding-jdbc将getCatalog方法抛异常,sharding-jdbc的实现是否也要一起改
  3. setSchema如何考虑

@gfreezy
Copy link
Contributor Author

gfreezy commented Mar 7, 2016

  1. setCatalog 场景是:
    在设计分库的时候,为了以后方便扩展,会使用比较大的切片,比如拆分为 4096 个shard。但是初期的数据量并不会很大,比如用 16 台机器,每个机器跑1个数据库进程,每个进程放 256 个 db。按照现有的一个db一个连接的情况下,一个worker就要用掉数据库256个连接,随便起几十个worker,数据库的连接数就满了。
  2. 这个不是很了解
  3. setSchema 是 PG 的吗?对 PG 不了解,只测试了 MySQL

@terrymanu
Copy link
Member

明白了。不过需要综合考虑下,只是set了Catalog,sharding-jdbc是不能运行的。sharding-jdbc未实现这个api,而相关参考的tddl也未实现。这里我们也还没考虑清楚怎么维护多catalog,毕竟sharding-jdbc中维护的不是单conn,而是一个conn集合。
如果考虑完善这里的功能,建议将sharding-jdbc实现的jdbc规范一起考虑

@gfreezy gfreezy closed this Mar 13, 2016
beckhampu added a commit that referenced this pull request Sep 12, 2018
@sunOnly sunOnly mentioned this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants