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
fix(adbc): re-authenticate on Unauthenticated instead of failing permanently (#73)
* fix(adbc): re-authenticate on Unauthenticated instead of failing permanently
The ADBC FlightSQL connection authenticates only once, when it is opened: the
Basic-auth handshake yields a server-side session token that is then reused for
every prepared statement on that connection. If the server invalidates that
session (e.g. it expires after a period of inactivity), every subsequent
prepared statement fails with Unauthenticated. Because SqlWithParams classified
Unauthenticated as a permanent error, the connection never recovered on its own
— the only remedy was to recreate the SpiceClient (restart the process).
Detect authentication failures (adbc.StatusUnauthenticated / Unauthorized, with
a message fallback) and, when one occurs, re-open the ADBC connection to perform
a fresh handshake and retry the query once. Re-initialization is guarded by a
mutex and a staleness check so concurrent callers re-open the connection at most
once.
The plain (non-parameterized) Sql/Query path is unaffected: it re-authenticates
on every call, so it was already immune.
* fix(adbc): address review comments on re-authentication
- Fix the data race on c.adbcClient: capture the connection once under adbcMu
via ensureADBC() and thread it through execADBCWithBackoff /
queryADBCWithParams / bindParameters, so queries never re-read c.adbcClient
while reinitADBC may be replacing it. reinitADBC returns the fresh connection.
- isADBCAuthError now matches both adbc.Error and *adbc.Error before the message
fallback (new isADBCAuthStatus helper).
- reinitADBC logs a warning when closeADBC() fails instead of discarding it.
- Add *adbc.Error (pointer) cases to TestIsADBCAuthError.
---------
Co-authored-by: Luke Kim <80174+lukekim@users.noreply.github.com>
0 commit comments