This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Open
Conversation
phamvanhungmixi
approved these changes
Aug 20, 2019
Author
|
日本語で問題を説明し直しますと、ActiveRecordのconnection_handlerではconnection_poolのspec(specification)でそれを一意管理している。管理する構造体としては ところで、turntableではっていうと、connection_proxyをActiveRecordからみる一個のconnection_poolとして仕立てて、その中でいい感じに複数のconnection(masterとseqとshards)を使い分けしてますが、じゃぁそいつのspecはなんだという問題があります。今までは、masterのspecをproxy全体のspecとしましたが、masterは実装上default dbのconnection_poolになりがちで、つまりどのclusterのconnection_proxyでも同じである、となればhandlerではそれらspecも同じだから同じものと一個しかリファレンス持ちませんが、それは間違いで、実はseqもshardsも違うけどmasterだけ同じのclusterを混同することに。それが複数のclusterが同じ枠を取り合いで、handlerが一個のproxyしか管理してないことに。 ではActiveRecordのインターフェイスに満たしつつも全てのconnection_proxyをいい感じに管理できるようにするためには、違うclusterなら違うspecである必要がある。からのこのPR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
master_shard is usually identical across clusters. Therefore, it doesn't make sense to use master_shard's spec as the cluster's one. On the other hand, shards usually are not.
see https://github.com/monsterstrike/activerecord-turntable/blob/tiepadrino/lib/active_record/turntable/base.rb#L66