Page 1 of 1
database tables get corrupted
Posted: Tue Feb 10, 2004 2:01 pm
by victor_diago
hi all, frequently i have the 145 error in mysql for Frrames.MYI and Events.MYI...
anyone know why ?, unfortunatelly, the server is rebooted frequently dye to the lack of eletricity,
may be that ?..
i have made a script that every time the server get up, it check the tables to see if thats allright., will this cause some problem ?
Re: database tables get corrupted
Posted: Tue Feb 10, 2004 3:52 pm
by rdmelin
Hi Victor, Philip, and all,
I recently had this happen too. Being under some time pressure to get the server back on line, I solved it by droping the database, and recreating it. Not a very elegant solution, and tedious as well. Besides of course being unacceptable if important history were involved. Doing some homework since then I find that mysql comes with tools to check, repair, and backup tables and databases. This is not the feature request forum, but since victor brought the subject up...
Could Zoneminder incorporate routines to periodically check and if needed repair the database. Perhaps using mysqlhotcopy or mysqldump to keep a backup database that it could switchto in case of unrepairable errors?
Best regards to all,
Ross
Re: database tables get corrupted
Posted: Tue Feb 10, 2004 4:09 pm
by zoneminder
I think this might be slightly outside what I would consider 'core' functionality. Any kind of repair to the DB risks denying access to functionality that might need it and ZM probably can't decide for itself when this is appropriate. You could easily do something like this yourself though, either by just shutting down ZM (for safety, probably not required) and then running mysqlcheck -f and then restarting it in a cron job for example. It's also possible that I could put this check into zmpkg.pl so it gets run on startup but then this delay may be unacceptable to some people. Not having suffered this kind of DB problem, except on the odd occasion when I run out of disk space I'm not exactly sure what the cause or effect of the errors you are getting is.
The issue of DB data however is something that needs to be thought about. In general backups etc can be achieved by replication, though again this may have a negative performance impact, but ZM currently does not have any DB switching functionality. This could be put in without too much difficulty but then it's a case of deciding what would cause it to switch and when (if ever) it would try and switch back.
Sorry it's a big vague but without knowing a bit more about requirements and your current/desired architecture it's a little difficult to be any more precise.
Cheers,
Phil,
Re: database tables get corrupted
Posted: Tue Feb 10, 2004 4:45 pm
by rdmelin
In my case I got error 145 for Frames.MYI. The effect on Zoneminder was to cause it to create empty events, a new one every 10 seconds on each of 5 monitors on mocord mode. The events were not renamed, they were all called New Event. I have no idea what caused the database error. The problem started after a user rebooted the machine to resolve what seemed to be a display-Xwindows glitch. There may well have been a hardware malfuction.
I will look into creating a script that will periodically check the database and parse the logs for errors.
Best regards,
Ross
Re: database tables get corrupted
Posted: Tue Feb 10, 2004 6:08 pm
by fernando
i get that error many times.. the first time is when i delete 3000 events in one shot..
the others is when the disk is full.
i just type database repair "table" and get solved.. sometime Event sometimes Frames gets bad.
when i move to rd9 and mdk 10 latest mysql i cant crash the databases..
victor you have made a script to erase based on disk space ...... how i set it NO to erase archived events..
Re: database tables get corrupted
Posted: Tue Feb 10, 2004 7:58 pm
by victor_diago
ahmmm... my script is not compatible with that.... but if you tell me how i can know if it is archieved or not... i can made the proper modifications...
so... did you liked my script... it worked well for you ?
Re: database tables get corrupted
Posted: Tue Feb 10, 2004 11:55 pm
by fernando
no did't test it... cuz will erase all the archived events..