visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: MySql :: File corruption when computer crashes.


By: summerrain U.S.A.  Date: 31/03/2004 00:00:00  English  Points: 250 Status: Answered
Quality : Excellent
Hi,

I have a system that is currently running MySql (MyIsam tables) and windows 2000. The nature of the application is such that the computer can lose power suddenly anytime. Initially it was running fine but lately I have been getting file corruptions after the computer loses power.

And by file corruption, I do not mean index corruption. The data files are corrupted until no data can be recovered via "myisamchk".

Is there a way to prevent the files from being corrupted?
By: VGR Date: 01/04/2004 20:33:00 English  Type : Comment
yes

(1) add an UPS to your system !!!!!

(2) other solution = BACKUP YOUR DATA REGULARILY

no other way.

Power surges and power cuts do happen...

I NEVER HAVE this problem, as I follow advices (1) and (2) ;-)

PS : my PersonalBackup tool was made for this ;-) it could backup my MySql data files each minute if I wanted...
By: monange Date: 01/04/2004 20:57:00 English  Type : Comment
additionally:

(3) use redundant file systems (Raid1 or Raid5)

In fact, backing up the data is only in case (1) and (3) did not help or were not the original problem...

CHeers
By: VGR Date: 01/04/2004 21:10:00 English  Type : Comment
I almost also mentioned I was on RAID 0+1 too ;-)

And I agree with you, but I learnt to be cautious anyway (since the time when two disks failed the one after the other and I lost everything :/ )
By: VGR Date: 01/04/2004 21:12:00 English  Type : Comment
AND I also thought that even RAID arrays would be damaged by a power cut

I think I'm right.

Solution (1) first, against power cuts.
Then solution (3) if you don't want (2) and like (small) risks
Or solution (2) which requires less money, less hardware and, more important, doesn't make you live with the false feeling that "nothing can happen to your precious data" :D
By: summerrain Date: 01/04/2004 21:19:00 English  Type : Comment
The problem is that the power cuts are not due to system failures. It is due to the computer being switched at the mains.

Backing up might not work as it is a real time system and any backup will still incur losses up to the last backup.

What about innodb as compared to myisam? Will there be less chances of a file corruption if I switch to innodb?
By: VGR Date: 01/04/2004 21:34:00 English  Type : Comment
huh ?

We NEVER envisaged that power custs were of system failures' origin !!!

We agreed that an UPS would save your day as for "power cuts"

for general data corruption/system failures (hard disk failures, etc), the RAID is a good idea. The backup is a third good idea. You always will lose some data, unless you are lucky.
By: VGR Date: 01/04/2004 21:35:00 English  Type : Comment
innoDB, isam, etc HAVE NOTHING TO DO WITH THIS PROBLEM of data corruption following a system failure (itself following a power cut or power surge). We are just trying to HELP YOU FOR NEXT TIME, you know ? :D
By: summerrain Date: 02/04/2004 23:06:00 English  Type : Comment
Firstly, the problem is, the system must allow for the user to cut power immediately. This rules out any UPS systems.

Secondly, hardware failures is not a problem. The only problem is the file corruption after the power cuts.

Thirdly, The system must be able to run unattended with minimum intervention from the user (other then cutting power). So how is it to detect that the files have been corrupted and restore from a backup copy?
By: VGR Date: 02/04/2004 23:16:00 English  Type : Comment
HUH !!!??!!!

Well, given those rather hard conditions... There is very little space for a working solution :/

The use rhas the right to cut power down ? Shutdown a server !?! in Production !? With processes running ?!?

this is pure madness.

The "right to cut power" should be "almost immediate" : it should execute a CLEAN shutdown procedure that will stop all processes, preferably in this order :
stop webserver
stop mysqld
shutdown

the "rule to cut down power" doesn't prevent you to have an UPS to protect yourself against REAL accidental power cuts !

this situation stinks
By: summerrain Date: 02/04/2004 23:21:00 English  Type : Comment
I know it stinks. :p
But those are very real constrains given by the user. They must be able to cut power immediately by switching off the mains. And if they shut off the main electricity, there is no time to perform an orderly shut down.
By: VGR Date: 02/04/2004 23:51:00 English  Type : Comment
of course. It is even pointless and useless to ask the question here. There is NO solution if they don't let the machines do a shutdown.

What kind of stupid customer is this ? Does he want the data to be corrupted ?

Only solution I can think of :
An onboard small UPS, well chosen so that it sends the "power shut down" event to the mainboard. For example, my mainboard is able to trigger a shutdown procedure when such an event occurs. Halas, My UPS isn't expensive enough to send such an event (to the serial port, usually, if I'm right)
By: summerrain Date: 03/04/2004 21:52:00 English  Type : Comment
Is there a way to prevent the corruption from happening so often? It happening once every 3 to 4 days now.

Thanks
By: monange Date: 03/04/2004 22:13:00 English  Type : Comment
Are the users "shutting down" the server every day/night????
That are silly people that don't know that computers finally are an assembly of high-technology pieces, and not a tool like a hammer or ordinary screwdriver that they can let fall to the ground without problems...
WHY the hell they want to do that????
By: summerrain Date: 03/04/2004 22:20:00 English  Type : Comment
The computer is located in an unaccessable location. The only way they can reset the computer is via the power switch on the main. Thats the problem. There is no way to put the computer is a more accessable location.
By: monange Date: 03/04/2004 22:22:00 English  Type : Comment
>> The only way they can reset the computer is via the power switch on the main
This only changes the question:
WHY DO THEY NEED TO RESET THE COMPUTER THAT OFTEN???
just curious
By: summerrain Date: 03/04/2004 22:27:00 English  Type : Comment
Its a real time system. And the operators are non-conputer literate. The only thing they know to do when any tiny thing pops up is to reset the computer. Thats why.
By: monange Date: 03/04/2004 22:53:00 English  Type : Comment
Can't you create a "script" that performs a normal shutdown, and give these operators a "button" that executes this script?
>>And the operators are non-conputer literate
That's not a reason to let them reset a computer like this. Do things properly, and if needed (as it is the case here), hide complexity by giving users a button they can press.
CHeers
By: summerrain Date: 03/04/2004 22:57:00 English  Type : Comment
They is no keyboard and mouse attached to the computer. Just a monitor.
By: monange Date: 03/04/2004 23:03:00 English  Type : Answer
!!!!!!!!!!!!!!!!
ok, I understand that. Now, can't you "build" another situation: setup a component in your network, and let the database server check that component (could be a minimum pc). If that PC is unavailable, do a restart.
Now, let the operators "restart" this PC with a main power supply?!

Or give the operators a touch screen, or SOME device they can click on, where this device somehow starts a PROPER shutdown+reboot of the server.

Something I have implemented at a TELCO company is to send a SMS with specific text to specific number, this SMS is captured "somehow" and starts a given process on the network...

Cheers

By: VGR Date: 06/04/2004 04:27:00 English  Type : Assist
agree with angelliii

you have to give the "non-computer literates" operators a simple push-button on their screen ; that button trigger some network event on the remote-unaccessible-computer and will "reboot" (if *nix machine) it cleanly.

Do register to be able to answer

EContact
browser fav
page generated in 382.447000 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page