You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Network is one of unstable environment.
This project already has lots of techniques to detect and handle network problems,
however I sometimes meet unhandled network problem such as network closed without notice to driver.
In this case, developers need to check error type and decide retry or not.
proposal
So...... How about add feature pre-ping process like ping or SELECT 1+1 at JDBC(hibernates JPA), ActiveRecord(rails ORM).
For adding the above feature, I think this BeforeAcquire hook option is needed.
Adding the hook at pool config:
BeforeAcquire func(*Conn) error // function to call on every connection checkout to validate the connection
The text was updated successfully, but these errors were encountered:
@drakejin I understand. One change in 1.18 will allow drivers to correctly wrap errors returned from the driver. If a connection is bad, the driver can return an error that implements interface{ Is(error) bool } and if the Is driver.ErrBadConn returns true, it will discard it.
One of the challenges with a Preflight check is that it still doesn't handle issues where the connection fails between the preflight and the "real" query, so you still have to handle "real" query failures to be robust (though I understand pragmatically that doing so may reduce the number of errors in practice).
I'm would prefer not to add additional features to the existing database/sql; the current design is too brittle. I would prefer to decline this proposal.
@kardianos Oh~~~ driver.ErrBadConn It's such a good idea. I agree with that.
I told the feature about a BeforeAcquire option.
I think this option is more support high logical level. However, I think golang's philosophy doesn't support logically functional features. I understand that's why I like golang.
Okay. I'll ask to other project to sqlx, entd and gorm.
from issue
go-sql-driver/mysql#1290
in my case
Network is one of unstable environment.
This project already has lots of techniques to detect and handle network problems,
however I sometimes meet unhandled network problem such as network closed without notice to driver.
In this case, developers need to check error type and decide retry or not.
proposal
So...... How about add feature pre-ping process like
ping
orSELECT 1+1
at JDBC(hibernates JPA), ActiveRecord(rails ORM).For adding the above feature, I think this
BeforeAcquire
hook option is needed.Adding the hook at pool config:
The text was updated successfully, but these errors were encountered: