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
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
1.9-beta2
What operating system and processor architecture are you using (go env)?
Windows 10 64-bit
I'd like to be able to return a ErrBadConn from my driver implementation of driver.Rows.Next().
The reason is that I want to add HA support for the Apache Phoenix/Avatica sql driver. With Avatica, you open a connection to the query server by generating a connection id, sending it to the server and then referencing all further operations with this id.
In HA mode, you'd have multiple Avatica servers using stick sessions or some other form of client routing sitting behind a load balancer. If we initially opened a connection against server 1 and it failed, we are able to open new connections to another server by returning driver.ErrBadConn in Open(), Exec(), Query(), Prepare(), Close(), Begin() and Ping(). However, in the case of the methods on driver.Rows that returns an error, it appears the database/sql package does not attempt to create or use another connection to try again.
With Avatica, it is able to signal in the response if the server we're connecting to requires us to recreate the state (for example, missing SQL statements, because the server we were previously talking to failed) to support HA. For example, it is able to signal this to use if we attempt to execute a prepared statement in driver.Stmt.Exec() or driver.Stmt.Query(). or fetch more rows in driver.Rows.Next().
In this case, if the server we're talking to previously fails, we need a new connection. However, there does not appear to be a way to signal this in driver.Rows.
It would be great if driver.Rows.Next() is able to ask database/sql to get or create a new connection if ErrBadConn is returned from those methods.
The text was updated successfully, but these errors were encountered:
F21
changed the title
database/sql: Support retrying on ErrBadConn in driver.Rows and driver.Stmt
database/sql: Support retrying on ErrBadConn in driver.Rows
Jul 18, 2017
@F21 I think it would be better for you to do this reconnecting behind the scenes and if you encounter a fundamental issue (dial fail to failover) set Rows.Err.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.9-beta2
What operating system and processor architecture are you using (
go env
)?Windows 10 64-bit
I'd like to be able to return a
ErrBadConn
from my driver implementation ofdriver.Rows.Next()
.The reason is that I want to add HA support for the Apache Phoenix/Avatica sql driver. With Avatica, you open a connection to the query server by generating a connection id, sending it to the server and then referencing all further operations with this id.
In HA mode, you'd have multiple Avatica servers using stick sessions or some other form of client routing sitting behind a load balancer. If we initially opened a connection against server 1 and it failed, we are able to open new connections to another server by returning
driver.ErrBadConn
inOpen()
,Exec()
,Query()
,Prepare()
,Close()
,Begin()
andPing()
. However, in the case of the methods ondriver.Rows
that returns an error, it appears thedatabase/sql
package does not attempt to create or use another connection to try again.With Avatica, it is able to signal in the response if the server we're connecting to requires us to recreate the state (for example, missing SQL statements, because the server we were previously talking to failed) to support HA. For example, it is able to signal this to use if we attempt to execute a prepared statement in
driver.Stmt.Exec()
ordriver.Stmt.Query()
. or fetch more rows indriver.Rows.Next()
.In this case, if the server we're talking to previously fails, we need a new connection. However, there does not appear to be a way to signal this in
driver.Rows
.It would be great if
driver.Rows.Next()
is able to askdatabase/sql
to get or create a new connection ifErrBadConn
is returned from those methods.The text was updated successfully, but these errors were encountered: