Aria storage engine

吴英武
2023-12-01

The Aria storage engine is compiled in by default in MariaDB 5.1 and it is required to be 'in use' when mysqld is started.

Additionally, internal on-disk tables are in the Aria table format instead of the MyISAM table format. This should speed up some GROUP BY and DISTINCT queries because Aria has better caching than MyISAM. The inclusion of Aria is one of the differences between MariaDB 5.1 and MySQL 5.1.

Note: The Aria storage engine was previously called Maria (see Rename Maria for details on the rename) and in previous versions of MariaDB the engine was still called Maria.

There are also some new options to CREATE TABLE:

  • TRANSACTIONAL= 0 | 1 : Transactional means crash-safe for Aria
  • PAGE_CHECKSUM= 0 | 1 : If index and data should use page checksums for extra safety.
  • TABLE_CHECKSUM= 0 | 1 : Same as CHECKSUM in MySQL 5.1
  • ROW_FORMAT=PAGE : The new cacheable row format for Aria tables. Default row format for Aria tables and only row format that can be used if TRANSACTIONAL=1. To emulate MyISAM, use ROW_FORMAT=FIXED or ROW_FORMAT=DYNAMIC
  • CHECKSUM TABLE now ignores values in NULL fields. This makes CHECKSUM TABLE faster and fixes some cases where same table definition could give different checksum values depending on row format. The disadvantage is that the value is now different compared to other MySQL installations. The new checksum calculation is fixed for all table engines that uses the default way to calculate and MyISAM which does the calculation internally. Note: Old MyISAM tables with internal checksum will return the same checksum as before. To fix them to calculate according to new rules you have to do an ALTER TABLE. You can use the old ways to calculate checksums by using the option --old to mysqld or set the system variable '@@old' to 1 when you do CHECKSUM TABLE ... EXTENDED;
  • At startup Aria will check the Aria logs and automatically recover the tables from last checkpoint if mysqld was not taken down correctly.

mysqld startup options for Aria

OptionDescriptionDefault value
--aria[=#]Enable or disable Aria plugin. Possible values are ONOFFFORCE (don't start if the plugin fails to load).ON
--aria-block-size=# Block size to be used for Aria index pages.8192
--aria-checkpoint-interval=# Interval between automatic checkpoints, in seconds; 0 means 'no automatic checkpoints' which makes sense only for testing.30
--aria-force-start-after-recovery-failures=# Number of consecutive log recovery failures after which logs will be automatically deleted to cure the problem; 0 (the default) disables the feature.0
--aria-group-commit=# Specifies Aria group commit mode. Possible values are "none" (no group commit), "hard" (with waiting to actual commit), "soft" (no wait for commit (DANGEROUS!!!))none
--aria-group-commit-interval=# Interval between commits in microseconds (1/1000000 second). 0stands for no waiting for other threads to come and do a commit in "hard" mode and no sync()/commit at all in "soft" mode. Option has only an effect ifaria_group_commit is used0
--aria-log-dir-path=namePath to the directory where to store transactional logSame as 'datadir'
--aria-log-file-size=# Limit for transaction log size1073741824
--aria-log-purge-type=# Specifies how Aria transactional log will be purged. Possible values of name are "immediate", "external" and "at_flush"immediate
--aria-max-sort-file-size=# Don't use the fast sort index method to created index if the temporary file would get bigger than this.9223372036853727232
--aria-page-checksumMaintain page checksums (can be overridden per table withPAGE_CHECKSUM clause inCREATE TABLE)TRUE
--aria-pagecache-age-threshold=# This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in the page cache.300
--aria-pagecache-buffer-size=# The size of the buffer used for index blocks for Aria tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford.134217720 (= 128M)
--aria-pagecache-division-limit=# The minimum percentage of warm blocks in key cache100
--aria-recover[=#]Specifies how corrupted tables should be automatically repaired. Possible values are "NORMAL" (the default), "BACKUP", "FORCE", "QUICK", or "OFF" which is like not using the option.NORMAL
--aria-repair-threads=# Number of threads to use when repairing Aria tables. The value of 1 disables parallel repair.1
--aria-sort-buffer-size=# The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEXor ALTER TABLE.134217728
--aria-stats-method=# Specifies how Aria index statistics collection code should treat NULLs. Possible values are "nulls_unequal", "nulls_equal", and "nulls_ignored".nulls_unequal
--aria-sync-log-dir=# Controls syncing directory after log file growth and new file creation. Possible values are "never", "newfile" and "always").NEWFILE

In normal operations, the only variables you have to consider are:

  • aria-pagecache-buffer-size
    • This is where all data and index are cached. The bigger this is, the faster Aria will work.
  • aria-block-size
    • The default value 8192, should be ok for most cases. The only with a higher value is that it takes long to find a packed key in the block as one has to search roughly 8192/2 to find each key. We plan to fix this by adding a dictionary at the end of the page to be able to do a binary search within the block before starting a scan. Until this is done and key lookups takes too long time even if you are not hitting disk, then you should consider making this smaller.
    • Possible values to try are 20484096 or 8192
    • Note that you can't change this without dumping, deleting old tables and deleting all log files and then restoring your Aria tables. (This is the only option that requires a dump and load)
  • aria-log-purge-type
    • Set this to "at_flush" if you want to keep a copy of the transaction logs (good as an extra backup). The logs will stay around until you execute FLUSH LOGS;

 类似资料:

相关阅读

相关文章

相关问答