Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Incorrect key file for table: 'Hits_Track' - Fatal Error

Quote Reply
Incorrect key file for table: 'Hits_Track' - Fatal Error
I haven't changed any configurations, so I was wondering if anyone knew where this error is coming from:
Quote:
Software error:
DBSQL (31265): Fatal Error: Unable to execute query: DELETE FROM Hits_Track WHERE TO_DAYS(NOW()) - TO_DAYS(created) > 2. Reason: Incorrect key file for table: 'Hits_Track'. Try to repair it at jump.cgi line 70

This happens when I try to click on a link:
http://lessonplanz.com/...rch.cgi?query=easter

Thanks for any insight you can provide Smile
Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
I hope someone can help.

I contacted my host to see if it was a problem on their end, but no response yet.

I was tired of waiting with my site useless as it was, so I went into jump.cgi and put a # in front of the line causing the error:

Quote:
# Remove old hit tracks.
# $db->do ("DELETE FROM Hits_Track WHERE TO_DAYS(NOW()) - TO_DAYS(created) > 2");

Now I assume my hit counts won't work properly, but at least users can click through now... Does anyone know how to truly fix this problem?

Thanks

Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
Ok.... here's something to try.

Go in and DELETE the Hits_Track table. Then, make a back-up copy of your 'defs' directory. (you might want to back up your database too... I won't take responsiblity!!)

Go to the admin/setup/setup.cgi and re-build the tables. You should get an error saying all the tables already exist, except for the Hits_Track. (alternatively, you can go to the SQL.mysql file, copy the CREATE statement for the Hits_Track table, and paste it into the SQL monitor.)

Then, in the admin area, RESYNC all the def files.

Copy your old def files back over the newly created ones -- EXCEPT for the Hits_Track.def file.

You now have a new table, new .def file, and hopefull all the index files have been rebuilt.

Now, re-index your site -- just for S&G's and then rebuild.

Try jump.cgi and see what happens.

From your last error message and this, I think some of the necessary index files are missing from the MySQL subdirectory, and this is the best way to replace it -- especially since the Hits_Track file contains no long-term data you need to preserve.




Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
Before I try this, I want to make sure my db is backed up. Whenever I build my pages, I have it perform a backup. I have the files for Links Categories and Subscribers in the backup dir. Will this be sufficient, or do I have to follow these directions:
http://www.mysql.com/php/manual.php3?section=Backup

There is also a section at mysql that talks about trying to repair the index files:
http://www.mysql.com/php/manual.php3?section=Repair

Should I try that or take care of everything from Links SQL?
Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
If you delete the Hits_Track table manually, then CREATE it manually from the SQL monitor, without running the setup.cgi program, the risk is trivial to non-existant.

You are only operating on that specific table, without any automated processes.

The create table command will rebuild the indexes, etc. Then, do the 'defs' back up as indicated before resyncing, so you preserve the 'weights' in the Links and Category tables.

You can manually verify the Hits_Track.def if you know what you are doing, and make sure all the fields match the database fields, but the backup/resyc/copy is as fast and it's what I do when I need to make changes or think something got out of sync.

Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
Thanks, pugdog.. Smile

Everything is working fine again. Before this, I didn't know any mysql commands, but I learned some along the way! I was able to delete the table, but I couldn't figure out how to manually create a table with all the correct definitions. Therefore, I followed your first directions to recreate the tables from setup.

Thanks for all your help.. I was lost without it!

Amanda
Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
Great! I thought it would be safe..

But look in the setup directory. There is a file called SQL.mysql.

It contains all the database definitions, and really just inserts them into the SQL during setup. It's what the setup.cgi uses to create the files.

I keep suggesting if you make any changes to the database -- adding tables, changing tables, changing defaults, etc you should make the same mods to this file.

Then, if you have to re-create anything, it's already up to date. You won't have to make the mods manually.

I really hope to get the FAQ updated this week. There have been a lot of good threads, and should be indexed.
Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
I've been a bit scared to use isamchk on my tables, but that's because I am my own ISP and I don't understand it all <G>

Some people don't have telnet ability, so the drop/create works well especially for transient data like any of the 'build' tables.

For the Links table, isamchk would be the preferred method of database maint. They provide several suggested uses, as does the MySQL & mSQL book.

Here is the link to the info in the MySQL docs.

http://www.mysql.com/...on=Table_maintenance
Quote Reply
Re: Incorrect key file for table: 'Hits_Track' - Fatal Error In reply to
Glad you got it working! By the way this sort of error:

Reason: Incorrect key file for table: 'Hits_Track'. Try to repair it at jump.cgi line 70

Indicates a mysql data corruption problem and can usually be fixed easily without any loss of data by running the isamchk tool (comes with mysql). You should make sure your ISP runs this on a regular schedule to make sure your database is running smoothly.

Cheers,

Alex