Chapter 08 · MariaDB Storage Engines Beyond InnoDB
Choose a Storage Engine Deliberately and Avoid Cross-Engine Transaction Assumptions
Choose MariaDB storage engines from atomicity, isolation, locking, crash recovery, integrity, backup, replication/Galera and operational maturity—and prove why mixed-engine transactions inherit the weakest guarantee.
Learning outcomes
ServiceHub now has five engine choices on one server. SQL lets a transaction touch more than one table regardless of engine, which creates a dangerous illusion: the transaction syntax is uniform, but the guarantees underneath are not. A rollback can revert InnoDB while leaving an Aria/MyISAM/MEMORY/CONNECT change outside the same atomicity boundary.
Build an engine decision matrix from correctness and operations rather than feature counts.
Use INFORMATION_SCHEMA.ENGINES to inspect transaction/XA/savepoint capability.
Demonstrate a mixed InnoDB/MyISAM transaction that partially survives ROLLBACK.
Explain backup, replication/Galera and failure-recovery consequences of heterogeneous engines.
Define an approval checklist for any non-InnoDB production table.
1. Start with guarantees, not engine names
| Engine | Best mental model | Transaction/locking boundary | Persistence/recovery boundary |
|---|---|---|---|
| InnoDB | General-purpose transactional OLTP engine. | Transactions, MVCC, record/gap locking; FK support. | Redo/undo/doublewrite/crash recovery; broad backup/HA ecosystem. |
| Aria | Crash-safe MyISAM-successor for read-heavy/internal temp uses. | Non-InnoDB transaction semantics; table-oriented locking. | PAGE/logging can be crash-safe, but not application rollback/MVCC equivalent. |
| MyISAM | Legacy non-transactional table engine. | No transactions/FKs; table locks. | Engine-file repair model; legacy operational tooling. |
| MEMORY | Shared server-local ephemeral table. | No transactional durability; table locks. | Rows disappear on restart; definition survives. |
| CONNECT | External data adapter exposed as a table. | Depends on table type/source; do not assume local atomicity. | Failure/recovery partly belongs to external file/DBMS/network. |
This matrix is intentionally qualitative. Exact capabilities
evolve by version and optional plugin. Always confirm the actual
server using SHOW ENGINES,
INFORMATION_SCHEMA.ENGINES and engine documentation
before deployment.
2. Build the mixed-engine rollback experiment
DROP DATABASE IF EXISTS servicehub_engines_lab;CREATE DATABASE servicehub_engines_lab CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;USE servicehub_engines_lab;CREATE TABLE technicians ( technician_id BIGINT NOT NULL PRIMARY KEY, display_name VARCHAR(80) NOT NULL, active BOOLEAN NOT NULL DEFAULT TRUE) ENGINE=InnoDB;INSERT INTO technicians VALUES (1,'Ava Chen',1),(2,'Mina Patel',1),(3,'Noah Smith',1);CREATE TABLE account_balance_innodb ( account_id BIGINT NOT NULL PRIMARY KEY, balance DECIMAL(12,2) NOT NULL) ENGINE=InnoDB;CREATE TABLE account_balance_myisam ( account_id BIGINT NOT NULL PRIMARY KEY, balance DECIMAL(12,2) NOT NULL) ENGINE=MyISAM;INSERT INTO account_balance_innodb VALUES (10,100.00);INSERT INTO account_balance_myisam VALUES (10,100.00);START TRANSACTION;UPDATE account_balance_innodb SET balance=balance-25 WHERE account_id=10;UPDATE account_balance_myisam SET balance=balance-25 WHERE account_id=10;ROLLBACK;SHOW WARNINGS;SELECT 'InnoDB' AS engine,balance FROM account_balance_innodb WHERE account_id=10UNION ALLSELECT 'MyISAM',balance FROM account_balance_myisam WHERE account_id=10;
The expected outcome exposes the correctness boundary: the InnoDB row returns to 100.00 while the MyISAM row remains 75.00, with MariaDB warning that non-transactional changes could not be rolled back. SQL transaction syntax coordinated session state and metadata locks, but it could not add rollback capability to a non-transactional storage engine.
3. Why cross-engine transactions are operationally expensive even when they are legal
MariaDB can coordinate work involving different engines, and binary logging can require extra coordination such as two-phase commit ordering when transactional and non-transactional changes mix. That machinery helps logging consistency; it does not upgrade the weaker engine’s rollback semantics. Application developers must still design around the weakest guarantee in the unit of work.
A useful rule is to keep one business invariant inside one well-understood transactional boundary. If a durable business operation requires atomic changes across tables, those tables should normally use engines that provide the needed transaction semantics. External systems should be integrated through explicit messaging/outbox/idempotency patterns rather than hidden behind a table abstraction and assumed atomic.
4. Backup and recovery must be evaluated per engine
| Question | Why it matters |
|---|---|
| Can the backup tool capture a transactionally consistent snapshot? | Online consistency mechanisms that work for InnoDB may not mean the same thing for non-transactional/external tables. |
| What must be quiesced or locked? | File-based engines and external sources can require different coordination. |
| What does restore actually recreate? | MEMORY definitions restore but row contents are inherently ephemeral; CONNECT may only recreate a pointer to an external dependency. |
| Can corruption be crash-recovered or must it be repaired/rebuilt? | InnoDB, Aria and MyISAM use different recovery mechanisms and tools. |
| Has restore been tested? | A backup format is not a recovery guarantee until a restore drill proves the required data and dependencies return. |
This is why “mariadb-dump completed successfully” or “mariadb-backup finished” is not the end of backup design. The runbook must state which engines exist, which external files/sources are outside the backup, what locks/snapshots were used and how the restored service is verified.
5. Replication and Galera are engine-specific too
Binary-log replication can carry statements/row events involving multiple engines, but recovery and concurrency semantics at each node still depend on the destination engine. For Galera, current MariaDB guidance treats InnoDB as the fully supported storage engine for replicated data. MyISAM and Aria replication modes are explicitly experimental and should not be relied upon as normal production guarantees.
SHOW VARIABLES LIKE 'wsrep_on';SHOW VARIABLES LIKE 'wsrep_mode';SHOW VARIABLES LIKE 'default_storage_engine';
A standalone server may show no active wsrep provider or
wsrep_on=OFF; that is expected. The purpose is to
establish that “table works on standalone MariaDB” is not proof
it belongs in a Galera workload. Chapter 15 will test clustering
separately with the exact provider/topology.
6. Decision matrix for ServiceHub
| Requirement | Preferred direction | Reason |
|---|---|---|
| Work orders/payments/audit rows | InnoDB | Atomic transactions, MVCC, row-level concurrency and mature recovery/HA behavior. |
| Rebuildable read-heavy lookup/internal disk temp work | Aria may fit | Crash-safe PAGE behavior and MariaDB internal use, if non-transactional/table-lock semantics are acceptable. |
| Existing legacy read-only table | MyISAM only with documented reason | Migration may be deferred, but limitations remain explicit. |
| Shared cache that may empty on restart | MEMORY may fit | Persistence loss is intentional and data can be reconstructed. |
| CSV/ODBC/JDBC access owned externally | CONNECT may fit | Fresh external access is required and external failure/credential semantics are accepted. |
| Galera replicated OLTP | InnoDB | Current fully supported production storage engine; non-InnoDB modes are experimental. |
The word “may” is deliberate. Engine choice is a requirements decision, not a ranking. Even InnoDB can be the wrong tool for analytics/federation if another engine or system better matches the workload, but leaving InnoDB should be an explicit architectural decision with a tested failure model.
7. Deliberately wrong: choose per-table engines from a benchmark spreadsheet
Selecting the fastest engine for each table can create a system whose transaction, backup and HA boundaries nobody can explain. A 5% synthetic read improvement is not worth partial rollback of a financial operation or an un-restorable external dependency. The repair is an engine approval record that includes correctness first and performance only after the contract is acceptable.
| Approval field | Required evidence |
|---|---|
| Business invariant | What must commit/rollback atomically? |
| Concurrency | Expected readers/writers, lock scope, latency SLO and contention test. |
| Durability | What survives process crash, OS crash, host loss and restart? |
| Integrity | PK/UNIQUE/FK/CHECK expectations and which engine enforces them. |
| Backup/restore | Tool, consistency method, external dependencies and successful restore drill. |
| Replication/HA | Async/Galera support status, failover behavior and topology limitations. |
| Security | At-rest encryption/plugin/credential/file-permission requirements. |
| Operations | Monitoring, check/repair/rebuild, upgrades and on-call runbook. |
| Performance | Representative benchmark after all previous requirements pass. |
8. Chapter lab: prove the weakest guarantee and clean up
- Run the mixed InnoDB/MyISAM rollback experiment and save the result.
- Query INFORMATION_SCHEMA.ENGINES for all engines available on your server.
- For each available non-InnoDB engine, write one durability/locking/backup limitation.
- If CONNECT was installed, document its external file/source ownership and uninstall only if your disposable-lab plan calls for it.
-
Drop the lab with
DROP DATABASE servicehub_engines_lab;.
Check your understanding
- Why can one START TRANSACTION contain changes with different rollback guarantees?
- What does warning 1196 tell you?
- Why does binary-log coordination not turn MyISAM into a transactional engine?
- Which engine is currently the fully supported Galera choice?
- What should be evaluated before performance when approving a non-InnoDB engine?
Review the answers
MariaDB transaction syntax can address tables whose engines implement different capabilities; the weakest engine retains its own semantics. Warning 1196 says some non-transactional changes could not be rolled back. Logging coordination preserves ordering/replication needs but cannot add MVCC/rollback to an engine. InnoDB is the fully supported Galera engine; MyISAM/Aria modes are experimental. Correctness, concurrency, durability, integrity, backup/recovery, HA, security and operations should be approved before benchmarking speed.
Default to InnoDB for ordinary OLTP, then deviate only when the alternative engine’s semantics are explicitly required and tested. Never infer transaction, FK, locking, recovery, backup or Galera guarantees from CREATE TABLE success.
Chapter 08 completes the storage-engine decision layer. Chapter 09 returns to access paths—B-tree, generated/expression patterns, FULLTEXT, spatial and vector indexing—while preserving the same rule: an index or engine is useful only when its semantics and observed workload behavior justify it.
9. Observability must expose engine boundaries before an incident
A heterogeneous server should make engine choice visible in
routine inventory, not discover it during recovery. Periodically
query information_schema.TABLES by engine and alert
on unexpected changes. Schema-review tooling can reject a new
non-InnoDB table unless an architecture record names its owner,
durability contract, backup method and HA implications. This is
especially important because an accidental
ENGINE=MyISAM or ENGINE=MEMORY can
look perfectly healthy in ordinary CRUD tests.
Incident runbooks should also identify engine-specific diagnostics: InnoDB status/transaction views, Aria/MyISAM check/repair tools, MEMORY rebuild sources, and CONNECT’s external dependency owner. The operational goal is not to standardize every engine; it is to make the different failure models impossible to overlook.