mysql data loss after server crash
After the server restarted due to a power cut, we lost all data saved in the database during the morning (client records created in the website). A few minutes before the crash, I was able to see such data on "MySQL Query Browser" during some routine checks. After the crash, all records created in the morning disappeared and the most recent ones that I could see were created at 7 p.m. the day before. It seems like all INSERT statements were performed in a cache that could not be flushed because of the power cut. Does MySQL use such caching mechanism ? If yes, is it crash proof and how can I configure it ?
Environment: mysql 5.X + ubuntu 10.4 + raid1 + Jira4.1.2
unless you are using insert delayed, inserts/updates/deletes are committed immediately. The key file may not have written itself completely. If you have a caching controller card, it may have cached it and told the OS that it had committed it. Have you run a check table/repair table against it? If so, you might find that just the index is corrupt and that most of the records are still there.
MyISAM is fast, but, lacks quite a few precautions that need to be taken if a power problem/server crash happens. InnoDB is another method that is a bit safer, but, is slower depending on the types of queries you are doing. It adds row-level locking rather than table locking, but, select count(*) requires a scan of the rows whereas MyISAM can answer that from an index.
You could set up replication to send the data to a mirror, but, if it is in the same data center, you face the same possibility of it having corrupt data.