Skip to content

Don't release primary connections in the DB LB

Yorick Peterse requested to merge yorick/fix-primary-host-release into master

What does this MR do and why?

In !68042 (merged) we found that releasing primary connections can result in test suite errors. This can happen when tests reuse a connection also used by Puma, but release it instead of letting the Puma thread release it. Reproducing this is difficult, but it happens often enough to be a problem.

Since Rails already releases model connections for us, we don't actually need to release primary connections in the first place. See the following for more information:

This commit changes the load balancer code to not release primary connections, with the exception of one case where this is needed.

MR acceptance checklist

These checklists encourage us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Quality

  • Quality checklist confirmed

Performance, reliability, and availability

  • Performance, reliability, and availability checklist confirmed

Documentation

  • Documentation checklist confirmed

Security

  • Security checklist confirmed

Deployment

  • Deployment checklist confirmed

Merge request reports