Fix mid-transaction connection switch issue#86
Fix mid-transaction connection switch issue#86viralpraxis wants to merge 1 commit intopalkan:masterfrom
Conversation
5198bc3 to
34bb06b
Compare
Resolves palkan#83 Apparently, there's [another issue on the Rails side](rails/rails#55306) so Isolator's failure is just a symptom. Still, I think it makes sense to check `connection_id` explicitly and skip threshold change in case of connection switching, since it's an implicit invariant.
34bb06b to
85599c4
Compare
|
@viralpraxis do you have plans to finish this? I think we experience the same issue. |
Yeah, I’m coming back from my vacation in a week and I’m planning to revisit this one. As far as I remember current patch does not solve the issue so there is some extra investigation to do |
|
So I looked into this again and here’s what I think. The most common scenario where this issue occurs is probably related to connection reaping. In practice, though, this is not isolator-specific (i.e., it can happen even without an active isolator), and according to byroot’s answer [0], it should be fixed by pinning connections (or by disabling the reaper; e.g. GitLab does this [1]). Because of that, this scenario seems out of scope for our responsibility; it should be fixed on There is another (synthetic) scenario where the RDBMS goes down for some time and, iff the isolator is enabled, instead of a couple of failing tests the entire suite (starting from the point of time when RDBMS becomes unavailable) fails due to a corrupted isolator's state (see What can be done is:
[0] rails/rails#55306 (comment) @fatkodima any thoughts? You have much deeper expertise in Rails internals than I do. Is your use case also related to the connection reaper? |
Resolves #83
Apparently, there's another issue on the Rails side so Isolator's failure is just a symptom. Still, I think it makes sense to check
connection_idexplicitly and skip threshold change in case of connection switching, since it's an implicit invariant.Checklist