MySQL 8.0.39
Source Code Documentation
Clone_file_ctx Struct Reference

#include <clone0snapshot.h>

Public Types

enum class  State {
  NONE , DROPPING , RENAMING , CREATED ,
  RENAMED , DROPPED , DROPPED_HANDLED
}
 File state: [CREATED] ----------—> [DROPPING] --> [DROPPED] --> [DROPPED_HANDLED] | ^ | | -—> [RENAMING] -> [RENAMED] | | <---------—. More...
 
enum class  Extension { NONE , REPLACE , DDL }
 File extension to use with name. More...
 

Public Member Functions

void init (Extension extn)
 Initialize file state. More...
 
void get_file_name (std::string &name) const
 Get file name with extension. More...
 
void set_ddl (Snapshot_State next_state)
 Mark file added by DDL. More...
 
bool by_ddl (Snapshot_State state) const
 
void begin_wait ()
 Start waiting for DDL. More...
 
void end_wait ()
 Finish waiting for DDL. More...
 
bool is_waiting () const
 
void pin ()
 Pin the file. More...
 
void unpin ()
 Unpin the file. More...
 
bool is_pinned () const
 
bool modifying () const
 
bool deleting () const
 
bool deleted () const
 
bool renamed () const
 
Clone_File_Metaget_file_meta ()
 
const Clone_File_Metaget_file_meta_read () const
 

Public Attributes

std::atomic< Statem_state
 File metadata state. More...
 
Extension m_extension
 File name extension. More...
 

Private Attributes

std::atomic< uint32_t > m_pin
 Pin count incremented and decremented by clone tasks to synchronize with concurrent DDL. More...
 
uint32_t m_waiting
 Waiting count incremented and decremented by clone tasks while waiting DDL file operation in progress. More...
 
bool m_modified_ddl {false}
 true, if file created or modified after clone is started. More...
 
Snapshot_State m_next_state {CLONE_SNAPSHOT_DONE}
 Next state when ddl last modified file. More...
 
Clone_File_Meta m_meta
 File metadata. More...
 

Member Enumeration Documentation

◆ Extension

enum class Clone_file_ctx::Extension
strong

File extension to use with name.

Enumerator
NONE 
REPLACE 
DDL 

◆ State

enum class Clone_file_ctx::State
strong

File state: [CREATED] ----------—> [DROPPING] --> [DROPPED] --> [DROPPED_HANDLED] | ^ | | -—> [RENAMING] -> [RENAMED] | | <---------—.

Enumerator
NONE 
DROPPING 
RENAMING 
CREATED 
RENAMED 
DROPPED 
DROPPED_HANDLED 

Member Function Documentation

◆ begin_wait()

void Clone_file_ctx::begin_wait ( )
inline

Start waiting for DDL.

◆ by_ddl()

bool Clone_file_ctx::by_ddl ( Snapshot_State  state) const
inline
Returns
true iff added or modified by ddl in previous state.
Parameters
[in]statecurrent snapshot state

◆ deleted()

bool Clone_file_ctx::deleted ( ) const
inline
Returns
true, iff file is already deleted.

◆ deleting()

bool Clone_file_ctx::deleting ( ) const
inline
Returns
true, iff DDL is deleting file.

◆ end_wait()

void Clone_file_ctx::end_wait ( )
inline

Finish waiting for DDL.

◆ get_file_meta()

Clone_File_Meta * Clone_file_ctx::get_file_meta ( )
inline
Returns
file metadata.

◆ get_file_meta_read()

const Clone_File_Meta * Clone_file_ctx::get_file_meta_read ( ) const
inline
Returns
file metadata for read.

◆ get_file_name()

void Clone_file_ctx::get_file_name ( std::string &  name) const

Get file name with extension.

Parameters
[out]namefile name.

◆ init()

void Clone_file_ctx::init ( Extension  extn)
inline

Initialize file state.

Parameters
[in]extnfile name extension

◆ is_pinned()

bool Clone_file_ctx::is_pinned ( ) const
inline
Returns
true, iff clone tasks are using the file.

◆ is_waiting()

bool Clone_file_ctx::is_waiting ( ) const
inline
Returns
true, iff there are waiting clone tasks.

◆ modifying()

bool Clone_file_ctx::modifying ( ) const
inline
Returns
true, iff DDL is modifying file.

◆ pin()

void Clone_file_ctx::pin ( )
inline

Pin the file.

◆ renamed()

bool Clone_file_ctx::renamed ( ) const
inline
Returns
true, iff file is already renamed.

◆ set_ddl()

void Clone_file_ctx::set_ddl ( Snapshot_State  next_state)
inline

Mark file added by DDL.

Parameters
[in]next_statenext snapshot state

◆ unpin()

void Clone_file_ctx::unpin ( )
inline

Unpin the file.

Member Data Documentation

◆ m_extension

Extension Clone_file_ctx::m_extension

File name extension.

◆ m_meta

Clone_File_Meta Clone_file_ctx::m_meta
private

File metadata.

◆ m_modified_ddl

bool Clone_file_ctx::m_modified_ddl {false}
private

true, if file created or modified after clone is started.

◆ m_next_state

Snapshot_State Clone_file_ctx::m_next_state {CLONE_SNAPSHOT_DONE}
private

Next state when ddl last modified file.

◆ m_pin

std::atomic<uint32_t> Clone_file_ctx::m_pin
private

Pin count incremented and decremented by clone tasks to synchronize with concurrent DDL.

Protected by snapshot mutex.

◆ m_state

std::atomic<State> Clone_file_ctx::m_state

File metadata state.

Modified by DDL commands. Protected by snapshot mutex. Atomic operation helps clone to skip mutex when no ddl.

◆ m_waiting

uint32_t Clone_file_ctx::m_waiting
private

Waiting count incremented and decremented by clone tasks while waiting DDL file operation in progress.

Protected by snapshot mutex.


The documentation for this struct was generated from the following files: