Closed ermakov-oleg closed 11 months ago
Hi @elprans! I fixed the errors I had on CI, can you run Regression Tests again?
Hello @elprans,
I wanted to discuss the proposed change and gain some insights into your perspective on it. Specifically, I'm interested in understanding how you feel about this modification and what might be preventing us from merging it.
Your feedback would be greatly appreciated, as it will help us align our efforts and make any necessary adjustments to move forward with the change. Please let me know your thoughts and any concerns you might have.
Thank you in advance for your time and assistance.
@ermakov-oleg, thanks for the PR! I think a better approach would be to just rip the whole _working_
stuff out and do a normal connection path every time, so I did just that.
Now when using target_session_attrs, for example "primary" and if the leader in the cluster changes - the connections continue to open to the replica. Since the server role check is performed only at the first connection and all information for further connections is cached in
Pool._working_*
.This PR proposes to add server role checking on every connection when using target_session_attrs and if the server role does not match the one specified in target_session_attrs, clear the
Pool._working_*
cache.The impact on performance is minimal and will only be if target_session_attrs is used. Without these changes target_session_attrs becomes useless, as it really works only at application startup.