diff options
author | Eugene Kosov <claprix@yandex.ru> | 2019-12-11 23:32:50 +0700 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2019-12-11 23:32:50 +0700 |
commit | f4b4284650cc787b8e4c9d4515dca1917cb138b5 (patch) | |
tree | b84d343d3508447e1e439cab5a34ef8669ad3180 /storage/innobase/trx/trx0purge.cc | |
parent | adb117cf6901a0e0da7577267be1209359892207 (diff) | |
download | mariadb-git-f4b4284650cc787b8e4c9d4515dca1917cb138b5.tar.gz |
MDEV-16678 Prefer MDL to dict_sys.latch for innodb background tasks
Use std::queue backed by std::deque instead of list because it does less
allocations which still having O(1) push and pop operations.
Also store trx_purge_rec_t directly, because its only 16 bytes and allocating
it is to wasteful. This should be faster.
purge_node_t::purge_node_t: container is already empty after creation
purge_node_t::end(): replace clearing container with assertion that it's clear
Diffstat (limited to 'storage/innobase/trx/trx0purge.cc')
-rw-r--r-- | storage/innobase/trx/trx0purge.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 6ab2c57056c..0dce72eba87 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1141,7 +1141,7 @@ trx_purge_attach_undo_recs(ulint n_purge_threads) while (UNIV_LIKELY(srv_undo_sources) || !srv_fast_shutdown) { purge_node_t* node; - trx_purge_rec_t* purge_rec; + trx_purge_rec_t purge_rec; ut_a(!thr->is_active); @@ -1149,9 +1149,6 @@ trx_purge_attach_undo_recs(ulint n_purge_threads) node = (purge_node_t*) thr->child; ut_a(que_node_get_type(node) == QUE_NODE_PURGE); - purge_rec = static_cast<trx_purge_rec_t*>( - mem_heap_zalloc(purge_sys.heap, sizeof(*purge_rec))); - /* Track the max {trx_id, undo_no} for truncating the UNDO logs once we have purged the records. */ @@ -1160,18 +1157,18 @@ trx_purge_attach_undo_recs(ulint n_purge_threads) } /* Fetch the next record, and advance the purge_sys.tail. */ - purge_rec->undo_rec = trx_purge_fetch_next_rec( - &purge_rec->roll_ptr, &n_pages_handled, + purge_rec.undo_rec = trx_purge_fetch_next_rec( + &purge_rec.roll_ptr, &n_pages_handled, purge_sys.heap); - if (purge_rec->undo_rec == NULL) { + if (purge_rec.undo_rec == NULL) { break; - } else if (purge_rec->undo_rec == &trx_purge_dummy_rec) { + } else if (purge_rec.undo_rec == &trx_purge_dummy_rec) { continue; } table_id_t table_id = trx_undo_rec_get_table_id( - purge_rec->undo_rec); + purge_rec.undo_rec); auto it = table_id_map.find(table_id); @@ -1189,7 +1186,7 @@ trx_purge_attach_undo_recs(ulint n_purge_threads) table_id_map.insert({table_id, node}); } - node->undo_recs.push_back(purge_rec); + node->undo_recs.push(purge_rec); if (n_pages_handled >= batch_size) { break; |