• Vlad Lesin's avatar
    MDEV-33757 Get rid of TrxUndoRsegs code · 722df777
    Vlad Lesin authored
    TrxUndoRsegs is wrapper for vector of trx_rseg_t*. It has two
    constructors, both initialize the vector with only one element. And they
    are used to push transactions rseg(the singular) to purge queue. There is
    no function to add elements to the vector. The default constructor is used
    only for declaration of NullElement.
    
    The TrxUndoRsegs was introduced in WL#6915 in MySQL 5.7 and. MySQL 5.7
    would unnecessarily let the purge of history parse the
    temporary undo records, and then look up the table (via a global hash
    table), and only at the point of processing the parsed undo log record
    determine that the table is a temporary table and the undo record must be
    thrown away.
    
    In MariaDB 10.2 we have two disjoint sets of rollback segments (128 for
    persistent, 128 for temporary), and purge does not even see the temporary
    tables. The only reason why temporary tables are visible to other threads
    is a SQL layer bug (MDEV-17805).
    
    purge_sys_t::choose_next_log(): merge the relevant part
    of TrxUndoRsegsIterator::set_next() to the start of
    purge_sys_t::choose_next_log().
    
    purge_sys_t::rseg_get_next_history_log(): add a tail call of
    purge_sys_t::choose_next_log() and adjust the callers, to simplify the
    control flow further.
    
    purge_sys.pq_mutex and purge_sys.purge_queue: make it private by adding
    some simple accessor function.
    
    trx_purge_cleanse_purge_queue(): make it a member of purge_sys_t to have
    have access to private purge_sys.pq_mutex and purge_sys.purge_queue,
    simplify the code with using simple array copy and clearing purge queue
    instead of poping each purge queue element.
    
    rseg_t::last_commit_and_offset: exchange trx_no and offset bits to avoid
    bitwise operations during pushing to/popping from purge queue.
    
    Thanks Marko Mäkelä for historical overview of TrxUndoRsegs development.
    
    Reviewed by: Marko Mäkelä
    722df777
trx0rseg.cc 23 KB