Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
database/sql: update documentation to explain context cancellation in more detail #27962
The documentation states in various places:
My suggestion is the documentation makes clear that some drivers will cancel the execution of the query whilst others will only cancel waiting for the query results but the execution will still complete behind the scenes.
This is a very important distinction.
Why is it very important?
Even though driver support cancelling query on the server, it only saves some CPU usage.
Canceling remote query is hard and nondeterministic problem. You shouldn't rely on behaviour of canceling.
Some drivers such as MySQL driver do support cancellation.
I was trying to make clear that even if the driver does support cancellation, the documentation should warn that successfully cancelling from Go's point of view does not imply that the query is cancelled from databases point of view.
In the case of MySQL, cancelling does not mean that MySQL has cancelled the execution of the query.