[mythtv-commits] Ticket #11086: MSqlDatabase::Reconnect() should also reset session parameters set by OpenDatabase()
MythTV
noreply at mythtv.org
Thu Sep 13 13:26:52 UTC 2012
#11086: MSqlDatabase::Reconnect() should also reset session parameters set by
OpenDatabase()
------------------------------------------+-------------------------
Reporter: Adrian Saul <sgtbundy@…> | Owner: beirdo
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: 0.26
Component: MythTV - MythSystem | Version: Master Head
Severity: medium | Keywords:
Ticket locked: 0 |
------------------------------------------+-------------------------
Since upgrading to 0.26 I have had an issue where upcoming scheduled
recordings disappear. After much trouble shooting, it was tracked down to
a combination of my timezone, and the schedulers use of NOW() to filter
programs based on ending time.
When the scheduler starts it opens a dedicated database session, which in
InitDatabase() the mysql session.time_zone is set to UTC (+00:00). With
some debugging code I was able to prove the problem to be that NOW() was
returning local time instead of UTC as needed by the scheduler:
Sep 13 04:11:28 pvr mythlogserver: mythbackend[32223]: D Scheduler
scheduler.cpp:2104 (HandleReschedule) Result for NOW() is
2012-09-12T18:11:28
'''Sep 13 16:16:32 pvr mythlogserver: mythbackend[32223]: D Scheduler
scheduler.cpp:2104 (HandleReschedule) Result for NOW() is
2012-09-13T16:16:32'''
Just prior to this occurring there was a reconnect message for the
Schedulers database session:
Sep 13 16:16:32 pvr mythlogserver: mythbackend[32223]: I Scheduler
mythdbcon.cpp:243 (Reconnect) MySQL reconnected successfully
In Reconnect(), it closes and opens the database connection but does not
re-apply the session parameters. This means should the schedulers session
get timed out, the session will be re-established in local time (or the
database default) and not UTC as needed by the scheduler. In my case
being a GMT+10 timezone this was causing a scheduler SQL clause to fail
resulting in anything ending in the next 2 hours to be dropped from the
scheduled recordings.
I believe the fix is to force the session parameters to be reset when
Reconnect() is called. I have attached a simple patch for this, but
probably a cleaner method would be to define a SetupSession() function
which could be called by both InitDatabase() and Reconnect() to properly
setup the session should additional session parameters be needed in the
future.
--
Ticket URL: <http://code.mythtv.org/trac/ticket/11086>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
More information about the mythtv-commits
mailing list