[mythtv-commits] Ticket #3113: HouseKeeper - Add cleanup of recordedmarkup and recordedseek
MythTV
mythtv at cvs.mythtv.org
Tue Feb 20 07:07:37 UTC 2007
#3113: HouseKeeper - Add cleanup of recordedmarkup and recordedseek
----------------------------------------------+-----------------------------
Reporter: sphery <mtdean at thirdcontact.com> | Owner: ijr
Type: enhancement | Status: new
Priority: minor | Milestone: unknown
Component: mythtv | Version: head
Severity: medium |
----------------------------------------------+-----------------------------
The attached patch (inspired by gnome42) adds code to clean up orphaned
records from recordedmarkup and recordedseek tables in addition to the
existing code that cleans recordedprogram, recordedrating, and
recordedcredits. Several recent posts on the lists seem to indicate
concerns about orphaned records in these tables. Although it's unlikely
that users will have orphaned records from more than a few recordings,
there will be > 7200 records in recordedseek for a single one-hour MPEG-2
recording with 15 frames/GOP, so it's probably worthwhile to clean them
up.
Although the existing code would have worked for cleaning up the two new
tables by simply adding the table names to tables[], performing a JOIN on
recordedseek is not acceptable--my recordedseek table has > 2.8M records
(for ~400 MPEG-2 recordings totaling ~376 hours) and MySQL takes nearly 7
minutes to do the JOIN (when not recording/database is otherwise idle).
However, since it's extremely quick (< 1 sec) to find the DISTINCT
chanid's and starttime's in the table (resulting in approximately the same
number of rows as are in recorded), the patch creates a temporary table
with just this info (takes ~3 sec to copy the data to a temporary table)
and JOINs the temporary table with recorded (the JOIN takes less than 1
sec). The entire process required to find orphaned records in
recordedseek takes less than 4 secs on my system.
The temporary table is only really necessary for the recordedseek table,
but it seemed more elegant to use it for all the tables. If you prefer, I
can instead create a temporary table for recordedseek before the loop and
then use 2 arrays (one specifying the table to use for the JOIN and the
other specifying the table to use for the DELETE), where the arrays are
identical except for recordedseek (one array will specify "recordedseek"
and the other will specify "temprecordedseek"). I decided against this
approach because of the need to keep the two arrays in sync--and the
potential badness that could occur if they fall out of sync.
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/3113>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list