[mythtv] [mythtv-commits] Ticket #1835: Gradually delete big files to avoid I/O starvation on some filesystems

Chris Pinkham cpinkham at bc2va.org
Wed May 24 20:33:20 UTC 2006

* On Wed May 24, 2006 at 11:29:00AM -0000, MythTV wrote:
>  there is no list of manually deleted files, they are just marked in the DB
>  when the delete begins, and removed from the DB when the delete is
>  completed. Chris and I were both assuming that you were doing this for
>  auto-expire too, since this is where most of the deletes happen. It was
>  bad of us to not look carefully at your code.

Auto-Expire uses the normal delete code.  So, I believe his code location
would work for both manual and auto-expire deletes.

>  Anyway, ajlill is right, you should just place these files in the
>  autoexpire list. And then implementing the automatic delete increment
>  should be obvious. There is a list of files that need to be deleted and a
>  deadline for completing the deletes.

I'm not sure about this.  The gradual delete has to happen inside
MainServer::DoDeleteThread() which is where he put it.  The deadline for
deleting is on a per-recording basis.  A recording needs to be deleted within
5 minutes of when we were told to delete it, otherwise it will pop back up on
the Watch Recordings screen.  This logic is in
MainServer::HandleQueryRecordings().  The 5-minute check could be put up to
10 minutes, but that is probably the limit.  I would think that you would
need to calculate the delete increment at the time that you can actually
start the delete.  If you want to take into account all files being deleted,
then some extra logic could be added in to keep track of the amount
of filespace being added and then update that right before the deletelock lock
in mainServer::DoDeleteThread().  After you get the deletelock lock, then
you can see how much space total is being freed and try to plan accordingly,
but this is getting into a huge amount of logic, not just a simple divide
by 5 minutes, since the current recording could need to be deleted in 30 seconds
while the newest recrding to be deleted still has over 4 minutes, so you can't
just divide by 5 minutes because it might not work.

>  Please send any additional questions directly to me by e-mail or to the
>  mythtv-dev mailing list.

Yes, please.


More information about the mythtv-dev mailing list