We have a desktop application on Windows OS that installs with MariaDB server 10.4.10. Sometimes the client loses power and after restarting of PC MariaDB database becomes corrupted and Windows Server is not starting. The logs show that some tables are randomly broken. The server configuration is the default, not heavily loaded with one request per 1-5sec. I'm wondering if there are some configuration changes that can help avoid or at least decrease the probability of this issue?
-
1Do you define all tables using the InnoDB storage engine? InnoDB has crash protection, other storage engines do not. For example, if some tables use MyISAM or Aria, they are susceptible to corruption when the OS crashes. This can happen even if the load is not heavy.– Bill KarwinJun 11 at 21:00
-
@BillKarwin yes, all tables are InnoDB– WhoKnowsJun 12 at 8:01
1 Answer
Most likely it is because of Windows write caching
. While caching provides speed, it also defers writing to disk. You dont normally want to remove it for everything.
One way to fix it,
- create a new partition on your disk
- move the database files onto it
- disable write caching.
Note that there is the Flush
command in MariaDB, that you could try.
-
Thanks. What is the case to use Flush command? If PC was rebooted after power was lost and data is broken on the disk no reason to use this command, right?– WhoKnowsJun 12 at 8:13
-
If you are frequently changing table structure upgrade to 10.6+ that has crash safety around table modifications.– danblackJun 13 at 22:48
-