diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-08 06:29:20 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-08 09:44:08 +0200 |
commit | 5b72e8136fd439b9d297bdf50d5d5d2e8a119665 (patch) | |
tree | 18f8bd8db7e527d3421e5d81b30a4ad6b2e0e206 | |
parent | 5d596064d676ae691d55cae653b1c461ab012e46 (diff) | |
download | mariadb-git-5b72e8136fd439b9d297bdf50d5d5d2e8a119665.tar.gz |
Cleanup: Do not pass mtr_t* as NULL
PageConverter::update_index_page(): Invoke lower-level writes directly.
-rw-r--r-- | storage/innobase/row/row0import.cc | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index d1b2359f777..212cea838d7 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1819,13 +1819,17 @@ PageConverter::update_index_page( /* This has to be written to uncompressed index header. Set it to the current index id. */ - btr_page_set_index_id( - page, m_page_zip_ptr, m_index->m_srv_index->id, 0); + mach_write_to_8(page + (PAGE_HEADER + PAGE_INDEX_ID), + m_index->m_srv_index->id); + if (m_page_zip_ptr) { + memcpy(&m_page_zip_ptr->data[PAGE_HEADER + PAGE_INDEX_ID], + &block->frame[PAGE_HEADER + PAGE_INDEX_ID], 8); + } - if (dict_index_is_clust(m_index->m_srv_index)) { - dict_index_t* index = const_cast<dict_index_t*>( - m_index->m_srv_index); - if (block->page.id.page_no() == index->page) { + if (m_index->m_srv_index->is_clust()) { + if (block->page.id.page_no() == m_index->m_srv_index->page) { + dict_index_t* index = const_cast<dict_index_t*>( + m_index->m_srv_index); /* Preserve the PAGE_ROOT_AUTO_INC. */ if (index->table->supports_instant()) { if (btr_cur_instant_root_init(index, page)) { @@ -1859,18 +1863,30 @@ PageConverter::update_index_page( } } } else { - /* Clear PAGE_MAX_TRX_ID so that it can be - used for other purposes in the future. IMPORT - in MySQL 5.6, 5.7 and MariaDB 10.0 and 10.1 - would set the field to the transaction ID even - on clustered index pages. */ - page_set_max_trx_id(block, m_page_zip_ptr, 0, NULL); + goto clear_page_max_trx_id; + } + } else if (page_is_leaf(page)) { + /* Set PAGE_MAX_TRX_ID on secondary index leaf pages. */ + mach_write_to_8(&block->frame[PAGE_HEADER + PAGE_MAX_TRX_ID], + m_trx->id); + if (m_page_zip_ptr) { + memcpy(&m_page_zip_ptr + ->data[PAGE_HEADER + PAGE_MAX_TRX_ID], + &block->frame[PAGE_HEADER + PAGE_MAX_TRX_ID], + 8); } } else { - /* Set PAGE_MAX_TRX_ID on secondary index leaf pages, - and clear it on non-leaf pages. */ - page_set_max_trx_id(block, m_page_zip_ptr, - page_is_leaf(page) ? m_trx->id : 0, NULL); +clear_page_max_trx_id: + /* Clear PAGE_MAX_TRX_ID so that it can be + used for other purposes in the future. IMPORT + in MySQL 5.6, 5.7 and MariaDB 10.0 and 10.1 + would set the field to the transaction ID even + on clustered index pages. */ + memset(&block->frame[PAGE_HEADER + PAGE_MAX_TRX_ID], 0, 8); + if (m_page_zip_ptr) { + memset(&m_page_zip_ptr + ->data[PAGE_HEADER + PAGE_MAX_TRX_ID], 0, 8); + } } if (page_is_empty(page)) { |