Please sign in to comment.
Fix SQL reconnection logic. Refs #9704. Refs #9773. Refs #9792.
What this does is get rid of the old KickDatabase() logic and replaces it with a simple reconnect if the DB socket is disconnected, and also gets rid of a recent re-enablement of the automatic reconnects in [dd2d7a1] and importantly it extends the reconnection logic in [528324d] so that it resends the prepare() and rebinds the bindings when a reconnect happens in an exec(). This also makes the QSqlQuery parent of MSqlQuery private and adds some wrappers so we can prevent MSqlQuery users from accessing methods that may invalidate some assumption in MSqlQuery + it adds debugging wrappers for first(), last(), previous(), and seek() like we already had for next(). A little bit of history is in order. In Qt3 the SQL driver automatically reconnected whenever a connection was lost. But the first query after this auto-reconnect always failed. So in 2003 mdz added KickDatabase() which would recover disconnect and reconnect an automatically all was good with the world. In Qt4 the QSqlQuery::prepare() started to actually do prepared statements instead of emulating them. This caused a small problem in now it was possible that a disconnect happened between the call to prepare() and exec() and then the exec() would fail. But odds of this were still pretty low for most uses of the database in MythTV. But at some point trolltech also got rid of the automatic reconnections which caused us trouble in Qt3. To fix this we added reconnection logic in [528324d] and this is where the real trouble began. While this reconnection logic really does exactly the same thing that the auto-reconnection logic did in Qt3, the fact that prepare() doesn't just emulate prepared statements in Qt4 means that it's now that when we reconnect to the database in exec() the prepared statement has not been sent to the database. Note: This should be back-ported to 0.24-fixes after a reasonable burn-in time in master.
- Loading branch information
Showing with 193 additions and 136 deletions.
- +12 −12 mythtv/libs/libmyth/programinfo.cpp
- +1 −1 mythtv/libs/libmythbase/mythdb.cpp
- +3 −2 mythtv/libs/libmythbase/mythdb.h
- +111 −86 mythtv/libs/libmythbase/mythdbcon.cpp
- +46 −7 mythtv/libs/libmythbase/mythdbcon.h
- +1 −1 mythtv/libs/libmythbase/mythversion.h
- +1 −2 mythtv/libs/libmythtv/datadirect.cpp
- +4 −4 mythtv/libs/libmythtv/dbcheck.cpp
- +3 −6 mythtv/programs/mythbackend/httpstatus.cpp
- +5 −7 mythtv/programs/mythbackend/main_helpers.cpp
- +3 −5 mythtv/programs/mythbackend/mainserver.cpp
- +2 −2 mythtv/programs/mythbackend/scheduler.cpp
- +1 −1 mythtv/programs/mythfrontend/progfind.cpp
Oops, something went wrong.