auth: ugly complications to the SQL code to hopefully work better with mysql#16679
auth: ugly complications to the SQL code to hopefully work better with mysql#16679miodvallat wants to merge 6 commits intoPowerDNS:masterfrom
Conversation
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Will be used shortly. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
Use this in executeStatement() to retry once after forcing reconnection. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
…cute(). Should they occur, raise an exception with the "try again after reconnecting" flag. This ought to solve PowerDNS#16571. Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
7e2fce4 to
985c705
Compare
Pull Request Test Coverage Report for Build 20488499056Details
💛 - Coveralls |
|
Hi, miodvallat! I tested this branch and ran into some weird behavior. On my gmysql backend I have a small zone with a few records: I started up pdns_server from this PR's branch (commit 985c705) with a basic pdns.conf: I disabled the SQL query caches so that queries would always hit the backend. Then I sent some digs and got the expected answers: Then I killed the MySQL database connections from the database server side: Then I re-ran the same digs and got some interesting answers: Note the REFUSED responses, and the corrupted TXT RRset answer which appears to be a combination of two different TXT RRsets in the zone. And here is what the server logged: When I revert to a pdns_server binary built from the current (Edit: Just to make sure I rebased this branch on top of the current master and still got the same faulty behavior.) |
Short description
As reported in #16571, some mysql "looks like we lost our connection to the server" do not get detected by
isConnectionUsable(), and instead, we receive an error while attempting to execute the SQL statement.This PR tries to cope with that situation in three steps:
false, i.e. don't bother to reconnect.This PR is probably better read commit-by-commit, as the plumbing for that feature is quite invasive, compared to its actual usage.
You also get a bonus bugfix in the first commit, because I couldn't help but notice this while doing the plumbing.
Not sure how to test it, though. None of the existing tests should break, but I am not sure how to setup an unreliable mysql connection to exercize this code; advice welcome.
Checklist
I have: