Hi all,

the Aria storage engine is described to be "crash safe".

Would this mean that Aria is a good choice in production environments where the system power is expected to fail very often? Think about small embedded systems which are run without UPS?

What will happen when power fails right whilst a record being updated or inserted and the corresponding I/O is right written to the disk at that moment? Would the database then come up corrupt after the next boot, with manuel assistance being neccessary -or- will the database be fine in general, and only the last record / the last change / last operation vanishes?

Always presumed, the LOCK TABLES command is sent directly after each data manipulation command.

What about possible operating system or hard disk "write behind" caches?

Thanks and best regards Thomas

Answer Answered by Michael Widenius in this comment.

Aria is designed to be crash safe. - All changes are first written to log and synced - A background process are moving out changed pages and write them the data files. - A block is not written to a datafile until after the change is recorded in the log. - If MariaDB crashes, the recovery routines will update all not changed pages and then roll back the running statements. All of this is logged and can be redone.

From the above point of view, things should good, at least as good as with most other databases. There is however one thing missing (which is the case also for most other storage engines and databases, except InnoDB)

If you get a half write on a data page (not log page), then the recovery will not be able to recover that page and you will lose the information on that page. When run with page checksums this will be noticed, but the table has to be repaired before it can be used again. InnoDB fixes this with it's double write buffer, but Aria doesn't have that.

To summarize: If your system supports atomic writes for up to 8K blocks you are fine. If not, then you may loose something from one data page that is written at exactly the same time you have a total power failure. This is not something that is not very likely to happen, but possible.


Comments loading...