MySQL 9.1.0
Source Code Documentation
log0ddl.cc File Reference

DDL log. More...

#include <debug_sync.h>
#include "ha_prototypes.h"
#include <current_thd.h>
#include <sql_thd_internal_api.h>
#include <scope_guard.h>
#include "btr0sea.h"
#include "dict0dd.h"
#include "dict0mem.h"
#include "dict0stats.h"
#include "ha_innodb.h"
#include "log0chkp.h"
#include "log0ddl.h"
#include "my_sys.h"
#include "mysql/plugin.h"
#include "mysqld.h"
#include "pars0pars.h"
#include "que0que.h"
#include "row0ins.h"
#include "row0row.h"
#include "row0sel.h"
#include "trx0trx.h"

Functions

void ddl_log_crash_reset (THD *, SYS_VAR *, void *, const void *save)
 Reset all crash injection counters. More...
 
std::ostream & operator<< (std::ostream &o, const DDL_Record &record)
 Display a DDL record. More...
 
static dberr_t replace_and_insert (DDL_Record *record)
 

Variables

Log_DDLlog_ddl = nullptr
 Object to handle Log_DDL. More...
 
thread_local bool thread_local_ddl_log_replay = false
 Whether replaying DDL log Note: we should not write DDL log when replaying DDL log. More...
 
bool innodb_ddl_log_crash_reset_debug
 Used by SET GLOBAL innodb_ddl_log_crash_counter_reset_debug = 1;. More...
 
static uint32_t crash_before_free_tree_log_counter = 1
 Below counters are only used for four types of DDL log: More...
 
static uint32_t crash_after_free_tree_log_counter = 1
 Crash injection counter used after writing FREE TREE log. More...
 
static uint32_t crash_after_free_tree_delete_counter = 1
 Crash injection counter used after deleting FREE TREE log. More...
 
static uint32_t crash_before_delete_space_log_counter = 1
 Crash injection counter used before writing DELETE SPACE log. More...
 
static uint32_t crash_after_delete_space_log_counter = 1
 Crash injection counter used after writing DELETE SPACE log. More...
 
static uint32_t crash_after_delete_space_delete_counter = 1
 Crash injection counter used after deleting DELETE SPACE log. More...
 
static uint32_t crash_before_rename_space_log_counter = 1
 Crash injection counter used before writing RENAME SPACE log. More...
 
static uint32_t crash_after_rename_space_log_counter = 1
 Crash injection counter used after writing RENAME SPACE log. More...
 
static uint32_t crash_after_rename_space_delete_counter = 1
 Crash injection counter used after deleting RENAME SPACE log. More...
 
static uint32_t crash_before_drop_log_counter = 1
 Crash injection counter used before writing DROP log. More...
 
static uint32_t crash_after_drop_log_counter = 1
 Crash injection counter used after writing DROP log. More...
 
static uint32_t crash_after_replay_counter = 1
 Crash injection counter used after any replay. More...
 
static uint32_t crash_before_alter_encrypt_space_log_counter = 1
 Crash injection counter used before writing ALTER ENCRYPT TABLESPACE log. More...
 
static uint32_t crash_after_alter_encrypt_space_log_counter = 1
 Crash injection counter used after writing ALTER ENCRYPT TABLESPACE log. More...
 
static uint32_t crash_post_ddl_apply_step_counter = 1
 Crash injection counter used during post ddl in each step. More...
 
constexpr uint32_t DELETE_IDS_RETRIES_MAX = 10
 

Detailed Description

DDL log.

Created 12/1/2016 Shaohua Wang

Function Documentation

◆ ddl_log_crash_reset()

void ddl_log_crash_reset ( THD thd,
SYS_VAR var,
void *  var_ptr,
const void *  save 
)

Reset all crash injection counters.

It's used by: SET GLOBAL innodb_ddl_log_crash_reset_debug = 1 (0).

Parameters
[in]thdthread handle
[in]varpointer to system variable
[in]var_ptrwhere the formal string goes
[in]saveimmediate result from check function

◆ operator<<()

std::ostream & operator<< ( std::ostream &  o,
const DDL_Record record 
)

Display a DDL record.

Parameters
[in,out]ooutput stream
[in]recordDDL record to display
Returns
the output stream

◆ replace_and_insert()

static dberr_t replace_and_insert ( DDL_Record record)
static

Variable Documentation

◆ crash_after_alter_encrypt_space_log_counter

uint32_t crash_after_alter_encrypt_space_log_counter = 1
static

Crash injection counter used after writing ALTER ENCRYPT TABLESPACE log.

◆ crash_after_delete_space_delete_counter

uint32_t crash_after_delete_space_delete_counter = 1
static

Crash injection counter used after deleting DELETE SPACE log.

◆ crash_after_delete_space_log_counter

uint32_t crash_after_delete_space_log_counter = 1
static

Crash injection counter used after writing DELETE SPACE log.

◆ crash_after_drop_log_counter

uint32_t crash_after_drop_log_counter = 1
static

Crash injection counter used after writing DROP log.

◆ crash_after_free_tree_delete_counter

uint32_t crash_after_free_tree_delete_counter = 1
static

Crash injection counter used after deleting FREE TREE log.

◆ crash_after_free_tree_log_counter

uint32_t crash_after_free_tree_log_counter = 1
static

Crash injection counter used after writing FREE TREE log.

◆ crash_after_rename_space_delete_counter

uint32_t crash_after_rename_space_delete_counter = 1
static

Crash injection counter used after deleting RENAME SPACE log.

◆ crash_after_rename_space_log_counter

uint32_t crash_after_rename_space_log_counter = 1
static

Crash injection counter used after writing RENAME SPACE log.

◆ crash_after_replay_counter

uint32_t crash_after_replay_counter = 1
static

Crash injection counter used after any replay.

◆ crash_before_alter_encrypt_space_log_counter

uint32_t crash_before_alter_encrypt_space_log_counter = 1
static

Crash injection counter used before writing ALTER ENCRYPT TABLESPACE log.

◆ crash_before_delete_space_log_counter

uint32_t crash_before_delete_space_log_counter = 1
static

Crash injection counter used before writing DELETE SPACE log.

◆ crash_before_drop_log_counter

uint32_t crash_before_drop_log_counter = 1
static

Crash injection counter used before writing DROP log.

◆ crash_before_free_tree_log_counter

uint32_t crash_before_free_tree_log_counter = 1
static

Below counters are only used for four types of DDL log:

  1. FREE TREE
  2. DELETE SPACE
  3. RENAME SPACE
  4. DROP Other RENAME_TABLE and REMOVE CACHE doesn't touch the data files at all, so would be skipped Crash injection counter used before writing FREE TREE log

◆ crash_before_rename_space_log_counter

uint32_t crash_before_rename_space_log_counter = 1
static

Crash injection counter used before writing RENAME SPACE log.

◆ crash_post_ddl_apply_step_counter

uint32_t crash_post_ddl_apply_step_counter = 1
static

Crash injection counter used during post ddl in each step.

◆ DELETE_IDS_RETRIES_MAX

constexpr uint32_t DELETE_IDS_RETRIES_MAX = 10
constexpr

◆ innodb_ddl_log_crash_reset_debug

bool innodb_ddl_log_crash_reset_debug

Used by SET GLOBAL innodb_ddl_log_crash_counter_reset_debug = 1;.

◆ log_ddl

Log_DDL* log_ddl = nullptr

Object to handle Log_DDL.

◆ thread_local_ddl_log_replay

thread_local bool thread_local_ddl_log_replay = false

Whether replaying DDL log Note: we should not write DDL log when replaying DDL log.