Details
-
Bug
-
Status: In Review (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.4
Description
The data structure trx_t::autoinc_locks is of type ib_vector_t*. It is unconditionally allocated in trx_create() even when no AUTO_INCREMENT locks will be used by the transaction, even for read-only transactions.
We had better make use of a template that was introduced in MDEV-30289:
small_vector<lock_t*, 4> autoinc_locks;
|
The data elements are trivially assignable and allocated separately; the first 8 table locks of a transaction would use the trx->lock.table_pool in lock_table_create(). Any data-modifying transaction will typically also require a table IX lock in addition to the auto-increment lock. That is why 4 would be a reasonable fixed size.
Only if a transaction involved more than 4 auto-increment locks, we would dynamically allocate a larger vector, similar to how the 16-element mtr_t::m_memo works.
Attachments
Issue Links
- is blocked by
-
MDEV-30289 mtr_t::m_memo is causing frequent memory heap operations
- Closed
- relates to
-
MDEV-35702 ReadViewBase::m_ids had better use an initial fixed part
- Open