Do not clear pool while establishing connection if we'll retry it#6431
Do not clear pool while establishing connection if we'll retry it#6431
Conversation
| /// <param name="markHostAsOffline">Whether we treat host as down, even if we're still connecting to PostgreSQL instance.</param> | ||
| /// <returns>The exception given in <paramref name="reason"/> for chaining calls.</returns> | ||
| internal Exception Break(Exception reason) | ||
| internal Exception Break(Exception reason, bool markHostAsOffline = false) |
There was a problem hiding this comment.
Am wondering if we want to not mark as offline by default... I haven't audited all the places where we call Break, but given the current behavior is to always mark as offline, it may be safer to go the other way and say that we mark as offline unless otherwise specified?
But I don't have the full picture and am fine if you think this is the better way.
There was a problem hiding this comment.
it may be safer to go the other way and say that we mark as offline unless otherwise specified?
If I understood you correctly, that's pretty much exactly how it's working right now. The idea is that we do not mark as offline if we're still connecting (connector's state is Connecting) to the host, with the exception if we break with markHostAsOffline = true (which only happens in NpgsqlConnector.Open, after all retries are exhausted).
That means, after we fully established connection, any break will mark as offline (there are other conditions, like being a transient error, but nothing changed in that regard).
There was a problem hiding this comment.
I see, this parameter is only meaningful for the Connecting state (in others we always mark as default in any case).
I'd suggest just tweaking the parameter name to make that clear (I got confused), maybe markHostOfflineOnConnecting or similar...
|
Backported to 10.0.2 via 39eaacf |
Fixes #6427