Fix DB LB errors when escaping input

Merged Yorick Peterse requested to merge load-balancing-connection-quoting into master

What does this MR do?

This adds (another) patch to the DB load balancer so we can deal with connection errors when escaping user input. The reason for this is that Rails will in such cases first try to acquire a database connection, and we were not prepared for this. See the commit message for more details.

I marked this as ~S3 since we can sort of work around it by:

  1. Making sure hosts don't go down (fortunately this doesn't happen very often)
  2. Taking secondaries out of the load balancer before restarting/stopping them

Despite that it's a pretty serious flaw so we should get this on GitLab.com as soon as we can.

Does this MR meet the acceptance criteria?