-
Notifications
You must be signed in to change notification settings - Fork 76
Description
As I can see from your docs, you propose to use the pq library to connect to Cockroachdb from the application.
After looking at this library I found several major issues in my opinion:
-
It doesn't support read/write timeouts, only connection timeout. So if we get a connection from the pool and network failed the query will hang because we don't have read timeouts.
I found an open issue for this problem: Support read timeout for queries lib/pq#450 it was opened 4 years ago and they still didn't do anything. Another guy did a PR Added read_timeout and write_timeout lib/pq#792 but maintainers didn't react on it in a year.
Another postgers library supports such timeouts: https://github.com/go-pg/pg -
Another issue with the pq, is that if you want to timeout your queries via the context cancel mechanism, it will try to send a cancel request to the server and if it's unreachable it will, again, hang. Here is the opened issue in this regard (3 years old):
Context cancel hangs if there is no network connectivity lib/pq#620
I think it goes against the highly available and distributed nature of the CockroachDB.
Maybe there are some side car proxies that one can use to offload this timeout logic from the library. Like envoy for http.
So that is your advice in that regard ?