MySQL 26.7.0
Source Code Documentation
trx0purge.h File Reference

Purge old versions. More...

#include "fil0fil.h"
#include "mtr0mtr.h"
#include "page0page.h"
#include "que0types.h"
#include "read0read_view_interface.h"
#include "trx0sys.h"
#include "trx0types.h"
#include "trx0undo_trunc.h"
#include "univ.i"
#include "usr0sess.h"
#include "trx0purge.ic"

Go to the source code of this file.

Classes

struct  purge_iter_t
 This is the purge pointer/iterator. More...
 
struct  trx_purge_t
 The control structure used in the purge operation. More...
 
struct  TrxUndoRsegsIterator
 Choose the rollback segment with the smallest trx_no. More...
 

Enumerations

enum  purge_state_t {
  PURGE_STATE_INIT , PURGE_STATE_RUN , PURGE_STATE_STOP , PURGE_STATE_EXIT ,
  PURGE_STATE_DISABLED
}
 Purge states. More...
 

Functions

static fil_addr_t trx_purge_get_log_from_hist (fil_addr_t node_addr)
 Calculates the file address of an undo log header when we have the file address of its history list node. More...
 
void trx_purge_sys_mem_create ()
 Initialize in-memory purge structures. More...
 
void trx_purge_sys_initialize (uint32_t n_purge_threads, purge_pq_t *purge_queue)
 Creates the global purge system control structure and inits the history mutex. More...
 
void trx_purge_sys_close (void)
 Frees the global purge system control structure. More...
 
void trx_purge_add_update_undo_to_history (trx_t *trx, trx_undo_ptr_t *undo_ptr, page_t *undo_page, bool update_rseg_history_len, ulint n_added_logs, mtr_t *mtr)
 in: mtr More...
 
ulint trx_purge (ulint n_purge_threads, ulint limit, bool truncate)
 This function runs a purge batch. More...
 
void trx_purge_stop (void)
 Stop purge and wait for it to stop, move to PURGE_STATE_STOP. More...
 
void trx_purge_run ()
 Resume purge, move to PURGE_STATE_RUN. More...
 
purge_state_t trx_purge_state (void)
 Get the purge state. More...
 

Variables

trx_purge_tpurge_sys
 The global data structure coordinating a purge. More...
 

Detailed Description

Purge old versions.

Created 3/26/1996 Heikki Tuuri

Enumeration Type Documentation

◆ purge_state_t

Purge states.

Enumerator
PURGE_STATE_INIT 

Purge instance created.

PURGE_STATE_RUN 

Purge should be running.

PURGE_STATE_STOP 

Purge should be stopped.

PURGE_STATE_EXIT 

Purge has been shutdown.

PURGE_STATE_DISABLED 

Purge was never started.

Function Documentation

◆ trx_purge()

ulint trx_purge ( ulint  n_purge_threads,
ulint  batch_size,
bool  truncate 
)

This function runs a purge batch.

Returns
number of undo log pages handled in the batch in: truncate history if true
number of undo log pages handled in the batch
Parameters
n_purge_threadsin: number of purge tasks to submit to the work queue
batch_sizein: the maximum number of records to purge in one batch
truncatein: truncate history if true

◆ trx_purge_add_update_undo_to_history()

void trx_purge_add_update_undo_to_history ( trx_t trx,
trx_undo_ptr_t undo_ptr,
page_t undo_page,
bool  update_rseg_history_len,
ulint  n_added_logs,
mtr_t mtr 
)

in: mtr

in: mtr

Removes the update undo log segment from the rseg slot if it is too big for reuse.

Parameters
trxin: transaction
undo_ptrin/out: update undo log.
undo_pagein: update undo log header page, x-latched
update_rseg_history_lenin: if true: update rseg history len else skip updating it.
n_added_logsin: number of logs added
mtrin: mtr

◆ trx_purge_get_log_from_hist()

static fil_addr_t trx_purge_get_log_from_hist ( fil_addr_t  node_addr)
inlinestatic

Calculates the file address of an undo log header when we have the file address of its history list node.

Returns
file address of the log in: file address of the history list node of the log

◆ trx_purge_run()

void trx_purge_run ( )

Resume purge, move to PURGE_STATE_RUN.

◆ trx_purge_state()

purge_state_t trx_purge_state ( void  )

Get the purge state.

Returns
purge state.

◆ trx_purge_stop()

void trx_purge_stop ( void  )

Stop purge and wait for it to stop, move to PURGE_STATE_STOP.

◆ trx_purge_sys_close()

void trx_purge_sys_close ( void  )

Frees the global purge system control structure.

◆ trx_purge_sys_initialize()

void trx_purge_sys_initialize ( uint32_t  n_purge_threads,
purge_pq_t purge_queue 
)

Creates the global purge system control structure and inits the history mutex.

Parameters
[in]n_purge_threadsnumber of purge threads
[in,out]purge_queueUNDO log min binary heap

◆ trx_purge_sys_mem_create()

void trx_purge_sys_mem_create ( )

Initialize in-memory purge structures.

Variable Documentation

◆ purge_sys

trx_purge_t* purge_sys
extern

The global data structure coordinating a purge.