diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 3474a903f6c..4728e7ef2bf 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -488,10 +488,10 @@ completely purged and trx_purge_free_segment() has started freeing it */ /** Transaction end identifier (if the log is in a history list), or 0 if the transaction has not been committed */ #define TRX_UNDO_TRX_NO 8 -/** Before MariaDB 10.3.1, when purge did not reset DB_TRX_ID of +/* Before MariaDB 10.3.1, when purge did not reset DB_TRX_ID of surviving user records, this used to be called TRX_UNDO_DEL_MARKS. -This field is redundant; it is only being read by some debug assertions. +This field was removed in MariaDB 11.0. The value 1 indicates that purge needs to process the undo log segment. The value 0 indicates that all of it has been processed, and @@ -500,7 +500,7 @@ trx_purge_free_segment() has been invoked, so the log is not safe to access. Before MariaDB 10.3.1, a log segment may carry the value 0 even before trx_purge_free_segment() was called, for those undo log records for which purge would not result in removing delete-marked records. */ -#define TRX_UNDO_NEEDS_PURGE 16 +/*#define TRX_UNDO_NEEDS_PURGE 16*/ #define TRX_UNDO_LOG_START 18 /*!< Offset of the first undo log record of this log on the header page; purge may remove undo log record from the diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 4072ba2f440..0a896411658 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -262,7 +262,6 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr) trx_ulogf_t* undo_header = undo_page->page.frame + undo->hdr_offset; - ut_ad(mach_read_from_2(undo_header + TRX_UNDO_NEEDS_PURGE) <= 1); ut_ad(rseg->needs_purge > trx->id); if (UNIV_UNLIKELY(mach_read_from_4(TRX_RSEG + TRX_RSEG_FORMAT @@ -352,8 +351,6 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr) mtr->write<8,mtr_t::MAYBE_NOP>(*undo_page, undo_header + TRX_UNDO_TRX_NO, trx->rw_trx_hash_element->no); - mtr->write<2,mtr_t::MAYBE_NOP>(*undo_page, undo_header - + TRX_UNDO_NEEDS_PURGE, 1U); if (rseg->last_page_no == FIL_NULL) { rseg->last_page_no = undo->hdr_page_no; @@ -408,13 +405,6 @@ trx_purge_free_segment(mtr_t &mtr, trx_rseg_t* rseg, fil_addr_t hdr_addr) nullptr, BUF_GET_POSSIBLY_FREED, &mtr, &err)) { - /* Mark the last undo log totally purged, so that if the system - crashes, the tail of the undo log will not get accessed again. The - list of pages in the undo log tail gets inconsistent during the - freeing of the segment, and therefore purge should not try to - access them again. */ - mtr.write<2,mtr_t::MAYBE_NOP>(*block, block->page.frame + - hdr_addr.boffset + TRX_UNDO_NEEDS_PURGE, 0U); while (!fseg_free_step_not_header(TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER + block->page.frame, &mtr)) { @@ -925,12 +915,8 @@ static void trx_purge_rseg_get_next_history_log( if (const buf_block_t* undo_page= buf_page_get_gen(page_id_t(purge_sys.rseg->space->id, prev_log_addr.page), 0, RW_S_LATCH, nullptr, BUF_GET_POSSIBLY_FREED, &mtr)) - { - const byte *log_hdr= undo_page->page.frame + prev_log_addr.boffset; - - trx_no= mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO); - ut_ad(mach_read_from_2(log_hdr + TRX_UNDO_NEEDS_PURGE) <= 1); - } + trx_no= mach_read_from_8(undo_page->page.frame + prev_log_addr.boffset + + TRX_UNDO_TRX_NO); mtr.commit(); diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index 638832410a6..1dc3c18fc09 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -522,8 +522,6 @@ static dberr_t trx_rseg_mem_restore(trx_rseg_t *rseg, mtr_t *mtr) rseg->needs_purge= id; rseg->set_last_commit(node_addr.boffset, id); - ut_ad(mach_read_from_2(block->page.frame + node_addr.boffset + - TRX_UNDO_NEEDS_PURGE) <= 1); if (rseg->last_page_no != FIL_NULL) /* There is no need to cover this operation by the purge diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 33b1f93ff65..3b9c598e745 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -588,13 +588,8 @@ static uint16_t trx_undo_header_create(buf_block_t *undo_page, trx_id_t trx_id, undo_page->page.frame) != 0)) mtr->memset(undo_page, free + TRX_UNDO_TRX_NO, 8, 0); - /* Write TRX_UNDO_NEEDS_PURGE=1 and TRX_UNDO_LOG_START. */ - mach_write_to_2(buf, 1); - memcpy_aligned<2>(buf + 2, start, 2); - static_assert(TRX_UNDO_NEEDS_PURGE + 2 == TRX_UNDO_LOG_START, - "compatibility"); - mtr->memcpy(*undo_page, free + TRX_UNDO_NEEDS_PURGE + - undo_page->page.frame, buf, 4); + mtr->memcpy(*undo_page, free + TRX_UNDO_LOG_START + + undo_page->page.frame, start, 2); /* Initialize all fields TRX_UNDO_XID_EXISTS to TRX_UNDO_HISTORY_NODE. */ if (prev_log) {