15.16.4. Implementing COMMIT
During a commit operation, all changes made during a transaction
are made permanent and a rollback operation is not possible
after that. Depending on the transaction isolation used, this
may be the first time such changes are visible to other threads.
COMMIT, create a function that
matches this definition:
int (*commit)(THD *thd, bool all);
The function name is then listed in the
rollback (twelfth) entry of
THD parameter is used to identify the
transaction that needs to be committed, while the
all parameter indicates if this is a full transaction
commit or just the end of a statement that is part of the
Details of implementing a
will vary by storage engine. Examples can be found in
If the server is in auto-commit mode, the storage engine should
automatically commit all read-only statements such as
In a storage engine, "auto-committing" works by counting locks.
Increment the count for every call to
external_lock(), decrement when
external_lock() is called with an argument
F_UNLCK. When the count drops to zero,
trigger a commit.