An undo log is a collection of undo log records associated with a single read-write transaction. An undo log record contains information about how to undo the latest change by a transaction to a clustered index record. If another transaction needs to see the original data as part of a consistent read operation, the unmodified data is retrieved from undo log records. Undo logs exist within undo log segments, which are contained within rollback segments. Rollback segments are physically part of the system tablespace.
InnoDB supports 128 rollback segments. The
defines the number of rollback segments used by
Each rollback segment supports up to 1024 transactions, depending on the number of undo logs assigned to each transaction. (The 1024 value is the number of undo slots in a rollback segment.) A transaction is assigned up to two undo logs, one for each of the following operation types:
Undo logs are assigned as needed. For example, a transaction that
DELETE operations is assigned two
undo logs. A transaction that performs only
INSERT operations is assigned a
single undo log. Undo logs are assigned to a transaction from a
single rollback segment that is also assigned to the transaction.
An undo log assigned to a transaction remains tied to the
transaction for its duration. For example, an undo log assigned to
a transaction for an
operation is used for all
operations performed by that transaction.
Given the factors described above, the following formulas can be
used to estimate the number of concurrent read-write transactions
InnoDB is capable of supporting.
A transaction can encounter a concurrent transaction limit error
before reaching the number of concurrent read-write transactions
InnoDB is capable of supporting. This
occurs when the rollback segment assigned to a transaction runs
out of undo slots. In such cases, try rerunning the transaction.
1024 * innodb_rollback_segments
(1024 / 2) * innodb_rollback_segments