[mythtv-users] ensuring mythbackend will be idle for db optimize

Jerome Yuzyk jerome at supernet.ab.ca
Tue Sep 22 15:53:38 UTC 2015


On Monday, September 21, 2015 04:39:17 PM Peter Bennett wrote:
> On 09/21/2015 02:48 PM, Jerome Yuzyk wrote:
> > I've used optimize_mythdb.pl regularly for a long time without much regard for the database being busy, because it never did more than check the DB and fortunately never found anything to repair, so it was pretty much a read-only operation.
> >
> > But the latest version in 0.27.5 will defragment seektables and that means writing the DB for sure.
> >
> > How will this behave while recordings are being made, processed, or watched?
> >
> > Will MySQL just handle the table-locking automagically? I suspect not.
> >
> > So, I think I need to find or write something that asks if the front- and backend is or will be quiet for the next N minutes, before optimizing. 
> >
> > Has anyone done this already? Creative uses of MythWelcome?
> >
> My solution to this -
> I always run this from the script that is called from "Pre Shutdown
> check-command" (mythtv-setup, General, Shutdown/Wakeup Options). At this
> point mythtv is ready to shut down, so nothing is recording in the near
> future. My script also checks the date and makes sure the DB reorg is
> only run once a week, since that script is called every time you shut down.

Thank you. I had thought I could co-opt MythWelcome to do something other than shutdown/reboot, because it knows about what is in progress. But that may be heavier than I need and it may not be as complete as I want.

Fortunately MythShutdown can give me an Idle status like MythWelcome would use. 

Though the MythWelcome page says "is about to start recording" as a criterion I do not see the same for MythShutdown. Maybe it's just missing in the wiki.

But I can take a little from https://www.mythtv.org/wiki/Upcoming_Parse.pl to see what might be coming and how soon, and with MythShutdown I can get a fair idea of whether the backend is and will be idle in a dozen lines of Perl so far.

A fair idea. A MythFilldatabase might be looming. And I might be watching or listening on the frontend. Not usually, but I'd like to be complete. So I'm adding that now.

-- 
A little of Jerome's MythTV World: http://mythtv.bss.ab.ca


More information about the mythtv-users mailing list