[mythtv-users] Database damage?

Stephen Worthington stephen_agent at jsw.gen.nz
Thu Feb 11 02:08:40 UTC 2021

On Wed, 10 Feb 2021 19:37:39 -0500, you wrote:

>> On Feb 10, 2021, at 12:56 PM, Stephen Worthington <stephen_agent at jsw.gen.nz> wrote:
>Upfront, I really appreciate your detailed response.  Unfortunately I’m not quite there yet.
>> On Wed, 10 Feb 2021 11:44:30 -0500, you wrote:
>>> ...
>>> I tried to run find_orppans.py.  It found 673 recordings with missing files.  If I select "Delete orphaned recording entries?, I get the message:
>>> Warning: Failed to delete 'MediumMini.local: Republic of Doyle - The Driver'
>>> Then the list of orphaned recordings, etc, is re-displayed?nothing has apparently been fixed.
>> It takes time for mythbackend to delete things, so when you are
>> deleting a long list of missing file recordings, only one or two will
>> have actually been deleted by the time that find_orphans.py creates
>> its new list of missing file recordings.  So you need to re-run
>> find_orphans.py and get it to re-create the list, until you see that
>> the deletions have been completed.  When you delete recordings, you
>> are actually just telling mythbackend to add the delete requests to a
>> delete queue, which it processes in the background until it is empty.
>> The delete queue is saved over a shutdown of mythbackend and will be
>> restarted on the startup of mythbackend.
>I should have mentioned that in multiple attempts to run find_orphans.py, it _always_ comes back with the same message about "Republic of Doyle - The Driver’.  In mythfrontend, there is no such recording visible.  Months ago that when I started to failed recordings, I believe I got this message and then tried to delete this particular recording in the frontend.  I don’t recall any obvious problems at that time but maybe this is what is gumming up the works for me.
>Should I try zapping something in the database to remove any remnants of The Driver?

It is best to investigate first before trying to manually modify the
database.  One thing that sometimes happens when people say that a
recording is not visible is that it has been put in a different
recording group and mythfrontend is not displaying that recording
group at present.  So first, in mythfrontend go to the recordings list
and use M(enu) > Change Group Filter and make sure it is set to "All
Programmes".  Then use Ctrl-S and search for "Doyle" and see if you
can find the missing recording.

If it is still not visible, the next thing to do is to look for its
data in the recorded and recordedprogram tables and go through it all
to see if you can find any anomalies:

sudo mysql
use mythconverg;
select * from recorded where title='Republic of Doyle - The Driver'\G
select * from recordedprogram where chanid=(select chanid from
recorded where title='Republic of Doyle - The Driver') and
starttime=(select progstart from recorded where title='Republic of
Doyle - The Driver')\G

In any case, one corrupt recording in the database is unlikely to be
causing any problems with other recordings.

>>> Checking the MariaDB error log, quite a few tables are marked as crashed, e.g. settings, recorded, oldrecorded, etc.  I have a daily backup of the database (using mythconverg_backup.pl) and I run optimize_mythdb.pl on a daily basis.  Even though optimization complete successfully, it MariaDB complains the next time I start the database.
>> I have been in the situation you find yourself in and I did manage to
>> repair the database without having to restore from backup.  So I have
>> some suggestions.
>> [good advice on free space and mysqlcheck elided]
>I have verified that the partition has 30+ gigs of free space.
>Thanks for reminding me about mysqlcheck.  I’ve now run the regular and extended checks and all tables are reporting OK.  I’ll have to look further at the error log—maybe I was looking at old error messages?

You can run optimize_mythdb.pl manually and get its output on the
command line, rather than relying on log files.

>Thanks again, Stephen, for taking the time to give me some helpful advice.

More information about the mythtv-users mailing list