Skip to content

Handle driver timeout error#3

Closed
shlomi-noach wants to merge 2 commits intoopenark:masterfrom
ajm188:handle_driver_timeout_error
Closed

Handle driver timeout error#3
shlomi-noach wants to merge 2 commits intoopenark:masterfrom
ajm188:handle_driver_timeout_error

Conversation

@shlomi-noach
Copy link

re-submitting github#835 by @ajm188

Closes github#822.

In go-sql-driver/mysql#1075, @acharis notes
that the way the go-sql driver is written, query timeout errors don't
get set in rows.Err() until after a call to rows.Next() is made.

Because this kind of error means there will be no rows in the result
set, the for rows.Next() will never enter the for loop, so we must
check the value of rows.Err() after the loop, and surface the error up
appropriately.

I then went ahead and fixed up the error checking in the two remaining
places we use db.Query, and validated I've covered all cases by
running:

Andrew Mason added 2 commits March 31, 2020 16:25
Closes github#822.

In go-sql-driver/mysql#1075, @acharis notes
that the way the go-sql driver is written, query timeout errors don't
get set in `rows.Err()` until _after_ a call to `rows.Next()` is made.

Because this kind of error means there will be no rows in the result
set, the `for rows.Next()` will never enter the for loop, so we must
check the value of `rows.Err()` after the loop, and surface the error up
appropriately.
@shlomi-noach
Copy link
Author

Replaced by #8 , which I expect to merge in this repo

shlomi-noach pushed a commit that referenced this pull request Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server query timeout lead to data loss

1 participant