[mythtv-users] Recordings marked with "deletepending"
Michael T. Dean
mtdean at thirdcontact.com
Sun Aug 3 14:04:34 UTC 2014
On 08/03/2014 09:43 AM, Greg Oliver wrote:
> I rarely use mythweb, but this morning I was looking for a video I
> archived so I fired it up. One thing that caught my eye was that my
> recordings showed a series that I knew I had deleted long, long ago.
> This (and a couple other) series do not show up in the frontends.
>
> Upon investigation, it was due to the "deletepending" column being set
> in the recorded table.
These should never, ever show up in MythWeb (or mythfrontend). If they
are, there's a bug in MythWeb. The only notice you should ever have of
them is some amount of "Space used by deleted recordings" being reported
all the time, even after you've permanently deleted your Deleted recordings.
> Anyone know what would cause that? These recordings were all from the
> 2011/2012 timeframe, so it has been a while, but I am not sure why
> that would be set (I am not sure what it even does to be honest).
>
> One nice thing - I got a free 1/2 TB of disk space back this morning :)
There's a race condition that occurs when you delete a huge number of
shows and shut down mythbackend improperly (i.e. if you kill -KILL (or,
even worse, if you kill it improperly with improper syntax, using kill
-9)). This usually happens because when you shut down mythbackend, even
though it shuts down, it's still listed as a process until the file
system finishes deleting all the shows that it had deleted. Sometimes,
users (or distro scripts?) get impatient and think mythbackend is hung
or something and then use the nuclear option, which can leave some
number of those just-deleted files in an intermediate/not-deleted
state. It's also possible that a power loss that occurs just after a
huge delete could cause the problem (but, again, it's timing related and
only will occur if the improper shutdown/power loss occurs right after a
huge delete).
This will only occur on some systems when you delete a very large amount
of recording data (huge total file size compared to the speed at which
your file system deletes large files--where it would take many 10's of
seconds or minutes to finish deleting) and when you shut down
mythbackend at the wrong time and in the wrong way.
That said, the race condition will never occur if you enable slow
deletes, so even if you don't need them, using slow deletes will prevent
this problem from ever occurring.
Also, messing with the deletepending flag in the database can cause
serious problems with mythbackend if you don't do it properly--so I
highly recommend people don't mess with it. You shouldn't have many (if
any) recordings in limbo unless you frequently shut down mythbackend
incorrectly after deleting lots of recordings.
The find_orphans.py script needs to be modified to detect these and
clean them up, and I think Raymond has done so, but I don't think the
changes ever made it into the wiki version of the script. Eventually,
the master backend will take care of these automatically on restart, but
I haven't finished making the changes.
Mike
More information about the mythtv-users
mailing list