<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Over the weekend I upgraded to 0.26-fixes (RPMforge src.rpm + latest git fixes).  Yesterday, I put back into place my cronjob which optimizes the mythconverg tables (runs as mythtv user).  The script is included in MythTV&#39;s contrib directory.  It uses the Perl API as follows:</span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><div>#!/usr/bin/perl -w</div><div>#</div><div># Connects to the mythtv database and repairs/optimizes the tables that it</div>
<div># finds.  Suggested use is to cron it to run once per day.</div><div>#</div><div># Includes</div><div>use DBI;</div><div>use MythTV;</div><div># Connect to mythbackend</div><div>my $Myth = new MythTV({&#39;connect&#39; =&gt; 0});</div>
<div># Connect to the database</div><div>$dbh = $Myth-&gt;{&#39;dbh&#39;};</div><div># Repair and optimize each table</div><div>    foreach $table ($dbh-&gt;tables) {</div><div>        unless ($dbh-&gt;do(&quot;REPAIR TABLE $table&quot;)) {</div>
<div>            print &quot;Skipped:  $table\n&quot;;</div><div>            next;</div><div>        };</div><div>        if ($dbh-&gt;do(&quot;OPTIMIZE TABLE $table&quot;)) {</div><div>            print &quot;Repaired/Optimized: $table\n&quot;;</div>
<div>        }</div><div>        if ($dbh-&gt;do(&quot;ANALYZE TABLE $table&quot;)) {</div><div>            print &quot;Analyzed: $table\n&quot;;</div><div>        }</div><div>    }</div><div><br></div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
After running this script, MySQL reports all mythconverg tables are &quot;crashed&quot; and need to be repaired:</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<div>130101 12:29:11 [ERROR] /usr/libexec/mysqld: Table &#39;./mythconverg/archiveitems&#39; is marked as crashed and last (automatic?) repair failed</div><div>[snip]</div><div>130101 12:29:32 [ERROR] /usr/libexec/mysqld: Table &#39;./mythconverg/websites&#39; is marked as crashed and last (automatic?) repair failed</div>
<div><br></div><div>At the same time my cron job ran, I got the following in the mythbackend log:</div><div><div>2013-01-01 02:00:43.473444 E [7843/7866] JobQueue mythdbcon.cpp:837 (prepare) - Error preparing query: SELECT <a href="http://j.id">j.id</a>, j.chanid, j.starttime, j.inserttime, j.type, j.cmds, j.flags, j.status, j.statustime, j.hostname, j.args, j.comment, r.endtime, j.schedruntime FROM jobqueue j LEFT JOIN recorded r   ON j.chanid = r.chanid AND j.starttime = r.starttime ORDER BY j.schedruntime, <a href="http://j.id">j.id</a>;</div>
<div>2013-01-01 02:00:43.473481 E [7843/7866] JobQueue mythdbcon.cpp:839 (prepare) - Driver error was [2/144]:</div><div>QMYSQL3: Unable to prepare statement</div><div>Database error was:</div><div>Table &#39;./mythconverg/jobqueue&#39; is marked as crashed and last (automatic?) repair failed</div>
</div><div><br></div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I had to run the following two commands (with mythbackend and mysqld stopped) in order to repair the tables:</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
cd /var/lib/mysql/mythconverg</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><div>myisamchk --fast *.MYI</div><div>myisamchk --force --update-state --key_buffer_size=64M --sort_buffer_size=64M --read_buffer_size=1M --write_buffer_size=1M --fast *.MYI</div>
</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
If I run the <a href="http://optimize_mythdb.pl/" target="_blank" style="color:rgb(17,85,204)">optimize_mythdb.pl</a> script again, the tables are listed as crashed again.  I&#39;ve since disabled this cron job and would like to understand if this script is known to be broken.</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
/Brian/</div>