Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21364

Implement transaction support for "transactional" Aria tables

    XMLWordPrintable

    Details

      Description

      Aria tables can be made "transactional" by setting the TRANSACTIONAL table option. However, these "transactional" Aria tables do not actually support transactions. Instead, Aria's transaction log makes them crash-safe.

      For example, try running the following statements:

      CREATE TABLE aria_tab (id int) ENGINE=Aria TRANSACTIONAL=1;
      BEGIN;
      INSERT INTO aria_tab VALUES (1);
      ROLLBACK;
      SHOW WARNINGS;
      SELECT * FROM aria_tab;
      

      You'll see that the ROLLBACK doesn't work, because the "transactional" Aria table is considered to be a "non-transactional table." See here:

      MariaDB [db1]> CREATE TABLE aria_tab (id int) ENGINE=Aria TRANSACTIONAL=1;
      Query OK, 0 rows affected (0.01 sec)
       
      MariaDB [db1]> BEGIN;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [db1]> INSERT INTO aria_tab VALUES (1);
      Query OK, 1 row affected (0.00 sec)
       
      MariaDB [db1]> ROLLBACK;
      Query OK, 0 rows affected, 1 warning (0.00 sec)
       
      MariaDB [db1]> SHOW WARNINGS;
      +---------+------+---------------------------------------------------------------+
      | Level   | Code | Message                                                       |
      +---------+------+---------------------------------------------------------------+
      | Warning | 1196 | Some non-transactional changed tables couldn't be rolled back |
      +---------+------+---------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [db1]> SELECT * FROM aria_tab;
      +------+
      | id   |
      +------+
      |    1 |
      +------+
      1 row in set (0.00 sec)
      

      This behavior is consistent with what is displayed by SHOW ENGINES, which shows that Aria is not transactional:

      MariaDB [db1]> SHOW ENGINES;
      +--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
      | Engine             | Support | Comment                                                                          | Transactions | XA   | Savepoints |
      +--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
      ...
      | Aria               | YES     | Crash-safe tables with MyISAM heritage                                           | NO           | NO   | NO         |
      ...
      +--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+
      8 rows in set (0.00 sec)
      

        Attachments

          Activity

            People

            Assignee:
            ralf.gebhardt@mariadb.com Ralf Gebhardt
            Reporter:
            GeoffMontee Geoff Montee
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: