MySQL 8.0.39
Source Code Documentation
clone0desc.cc File Reference

Innodb clone descriptors. More...

#include "clone0desc.h"
#include "dict0dict.h"
#include "mach0data.h"

Functions

uint choose_desc_version (const byte *ref_loc)
 Choose lowest descriptor version between reference locator and currently supported version. More...
 
bool clone_validate_locator (const byte *desc_loc, uint desc_len)
 Check if clone locator is valid. More...
 
bool DESC_CHECK_FLAG (ulint flag, ulint bit)
 Check a specific bit in flag. More...
 
void DESC_SET_FLAG (ulint &flag, ulint bit)
 Set a specific bit in flag. More...
 

Variables

static const uint CLONE_DESC_MAX_VERSION = 100
 Maximum supported descriptor version. More...
 
static const uint CLONE_DESC_VER_OFFSET = 0
 Header: Version is in first 4 bytes. More...
 
static const uint CLONE_DESC_LEN_OFFSET = CLONE_DESC_VER_OFFSET + 4
 Header: Total length is stored in next 4 bytes. More...
 
static const uint CLONE_DESC_TYPE_OFFSET = CLONE_DESC_LEN_OFFSET + 4
 Header: Descriptor type is in next 4 bytes. More...
 
static const uint CLONE_DESC_HEADER_LEN = CLONE_DESC_TYPE_OFFSET + 4
 Header: Fixed length. More...
 
static const uint CLONE_TASK_INDEX_OFFSET = CLONE_DESC_HEADER_LEN
 Task: Clone task index in 4 bytes. More...
 
static const uint CLONE_TASK_CHUNK_OFFSET = CLONE_TASK_INDEX_OFFSET + 4
 Task: Task chunk number in 4 bytes. More...
 
static const uint CLONE_TASK_BLOCK_OFFSET = CLONE_TASK_CHUNK_OFFSET + 4
 Task: Task block number in 4 bytes. More...
 
static const uint CLONE_TASK_META_LEN = CLONE_TASK_BLOCK_OFFSET + 4
 Task: Total length. More...
 
static const uint CLONE_LOC_CID_OFFSET = CLONE_DESC_HEADER_LEN
 Locator: Clone identifier in 8 bytes. More...
 
static const uint CLONE_LOC_SID_OFFSET = CLONE_LOC_CID_OFFSET + 8
 Locator: Snapshot identifier in 8 bytes. More...
 
static const uint CLONE_LOC_IDX_OFFSET = CLONE_LOC_SID_OFFSET + 8
 Locator: Clone array index in 4 bytes. More...
 
static const uint CLONE_LOC_STATE_OFFSET = CLONE_LOC_IDX_OFFSET + 4
 Locator: Clone Snapshot state in 1 byte. More...
 
static const uint CLONE_LOC_META_OFFSET = CLONE_LOC_STATE_OFFSET + 1
 Locator: Clone Snapshot sub-state in 1 byte. More...
 
static const uint CLONE_DESC_LOC_BASE_LEN = CLONE_LOC_META_OFFSET + 1
 Locator: Total length. More...
 
static const uint CLONE_FILE_STATE_OFFSET = CLONE_DESC_HEADER_LEN
 File Metadata: Snapshot state in 4 bytes. More...
 
static const uint CLONE_FILE_SIZE_OFFSET = CLONE_FILE_STATE_OFFSET + 4
 File Metadata: File size in 8 bytes. More...
 
static const uint CLONE_FILE_ALLOC_SIZE_OFFSET = CLONE_FILE_SIZE_OFFSET + 8
 File Metadata: Sparse file allocation size on disk in 8 bytes. More...
 
static const uint CLONE_FILE_FSP_OFFSET = CLONE_FILE_ALLOC_SIZE_OFFSET + 8
 File Metadata: FSP flags in 4 bytes. More...
 
static const uint CLONE_FILE_FSBLK_OFFSET = CLONE_FILE_FSP_OFFSET + 4
 File Metadata: File system block size for compressed tables in 4 bytes. More...
 
static const uint CLONE_FILE_FLAGS_OFFSET = CLONE_FILE_FSBLK_OFFSET + 4
 File Metadata: File space flags in next 2 bytes [Maximum 16 flags]. More...
 
static const uint CLONE_DESC_FILE_FLAG_ZLIB = 1
 Clone File Flag: Compression type ZLIB. More...
 
static const uint CLONE_DESC_FILE_FLAG_LZ4 = 2
 Clone File Flag: Compression type LZ4. More...
 
static const uint CLONE_DESC_FILE_FLAG_AES = 3
 Clone File Flag: Encryption type AES. More...
 
static const uint CLONE_DESC_FILE_FLAG_RENAMED = 4
 Clone File Flag: File is renamed. More...
 
static const uint CLONE_DESC_FILE_FLAG_DELETED = 5
 Clone File Flag: File is deleted. More...
 
static const uint CLONE_DESC_FILE_HAS_KEY = 6
 Clone File Flag: File metadata has encryption key. More...
 
static const uint CLONE_FILE_SPACE_ID_OFFSET = CLONE_FILE_FLAGS_OFFSET + 2
 File Metadata: Tablespace ID in 4 bytes. More...
 
static const uint CLONE_FILE_IDX_OFFSET = CLONE_FILE_SPACE_ID_OFFSET + 4
 File Metadata: File index in 4 bytes. More...
 
static const uint CLONE_FILE_BCHUNK_OFFSET = CLONE_FILE_IDX_OFFSET + 4
 File Metadata: First chunk number in 4 bytes. More...
 
static const uint CLONE_FILE_ECHUNK_OFFSET = CLONE_FILE_BCHUNK_OFFSET + 4
 File Metadata: Last chunk number in 4 bytes. More...
 
static const uint CLONE_FILE_FNAMEL_OFFSET = CLONE_FILE_ECHUNK_OFFSET + 4
 File Metadata: File name length in 4 bytes. More...
 
static const uint CLONE_FILE_FNAME_OFFSET = CLONE_FILE_FNAMEL_OFFSET + 4
 File Metadata: File name. More...
 
static const uint CLONE_FILE_BASE_LEN = CLONE_FILE_FNAME_OFFSET
 File Metadata: Length excluding the file name. More...
 
static const uint CLONE_DESC_STATE_OFFSET = CLONE_DESC_HEADER_LEN
 Clone State: Snapshot state in 4 bytes. More...
 
static const uint CLONE_DESC_TASK_OFFSET = CLONE_DESC_STATE_OFFSET + 4
 Clone State: Task index in 4 bytes. More...
 
static const uint CLONE_DESC_STATE_NUM_CHUNKS = CLONE_DESC_TASK_OFFSET + 4
 Clone State: Number of chunks in 4 bytes. More...
 
static const uint CLONE_DESC_STATE_NUM_FILES = CLONE_DESC_STATE_NUM_CHUNKS + 4
 Clone State: Number of files in 4 bytes. More...
 
static const uint CLONE_DESC_STATE_EST_BYTES = CLONE_DESC_STATE_NUM_FILES + 4
 Clone State: Estimated number of bytes in 8 bytes. More...
 
static const uint CLONE_DESC_STATE_EST_DISK = CLONE_DESC_STATE_EST_BYTES + 8
 Clone State: Estimated number of bytes in 8 bytes. More...
 
static const uint CLONE_DESC_STATE_FLAGS = CLONE_DESC_STATE_EST_DISK + 8
 Clone State: flags in 2 byte [max 16 flags]. More...
 
static const uint CLONE_DESC_STATE_LEN = CLONE_DESC_STATE_FLAGS + 2
 Clone State: Total length. More...
 
static const uint CLONE_DESC_STATE_FLAG_START = 1
 Clone State Flag: Start processing state. More...
 
static const uint CLONE_DESC_STATE_FLAG_ACK = 2
 Clone State Flag: Acknowledge processing state. More...
 
static const uint CLONE_DATA_STATE_OFFSET = CLONE_DESC_HEADER_LEN
 Clone Data: Snapshot state in 4 bytes. More...
 
static const uint CLONE_DATA_TASK_INDEX_OFFSET = CLONE_DATA_STATE_OFFSET + 4
 Clone Data: Task index in 4 bytes. More...
 
static const uint CLONE_DATA_TASK_CHUNK_OFFSET
 Clone Data: Current chunk number in 4 bytes. More...
 
static const uint CLONE_DATA_TASK_BLOCK_OFFSET
 Clone Data: Current block number in 4 bytes. More...
 
static const uint CLONE_DATA_FILE_IDX_OFFSET = CLONE_DATA_TASK_BLOCK_OFFSET + 4
 Clone Data: Data file index in 4 bytes. More...
 
static const uint CLONE_DATA_LEN_OFFSET = CLONE_DATA_FILE_IDX_OFFSET + 4
 Clone Data: Data length in 4 bytes. More...
 
static const uint CLONE_DATA_FOFF_OFFSET = CLONE_DATA_LEN_OFFSET + 4
 Clone Data: Data file offset in 8 bytes. More...
 
static const uint CLONE_DATA_FILE_SIZE_OFFSET = CLONE_DATA_FOFF_OFFSET + 8
 Clone Data: Updated file size in 8 bytes. More...
 
static const uint CLONE_DESC_DATA_LEN = CLONE_DATA_FILE_SIZE_OFFSET + 8
 Clone Data: Total length. More...
 

Detailed Description

Innodb clone descriptors.

Function Documentation

◆ choose_desc_version()

uint choose_desc_version ( const byte ref_loc)

Choose lowest descriptor version between reference locator and currently supported version.

Parameters
[in]ref_locreference locator
Returns
chosen version

◆ clone_validate_locator()

bool clone_validate_locator ( const byte desc_loc,
uint  desc_len 
)

Check if clone locator is valid.

Parameters
[in]desc_locserialized descriptor
[in]desc_lendescriptor length
Returns
true, if valid locator

◆ DESC_CHECK_FLAG()

bool DESC_CHECK_FLAG ( ulint  flag,
ulint  bit 
)
inline

Check a specific bit in flag.

Parameters
[in]flagbit flag
[in]bitcheck bit
Returns
true, iff bit is set in flag.

◆ DESC_SET_FLAG()

void DESC_SET_FLAG ( ulint flag,
ulint  bit 
)
inline

Set a specific bit in flag.

Parameters
[in]flagbit flag
[in]bitset bit

Variable Documentation

◆ CLONE_DATA_FILE_IDX_OFFSET

const uint CLONE_DATA_FILE_IDX_OFFSET = CLONE_DATA_TASK_BLOCK_OFFSET + 4
static

Clone Data: Data file index in 4 bytes.

◆ CLONE_DATA_FILE_SIZE_OFFSET

const uint CLONE_DATA_FILE_SIZE_OFFSET = CLONE_DATA_FOFF_OFFSET + 8
static

Clone Data: Updated file size in 8 bytes.

◆ CLONE_DATA_FOFF_OFFSET

const uint CLONE_DATA_FOFF_OFFSET = CLONE_DATA_LEN_OFFSET + 4
static

Clone Data: Data file offset in 8 bytes.

◆ CLONE_DATA_LEN_OFFSET

const uint CLONE_DATA_LEN_OFFSET = CLONE_DATA_FILE_IDX_OFFSET + 4
static

Clone Data: Data length in 4 bytes.

◆ CLONE_DATA_STATE_OFFSET

const uint CLONE_DATA_STATE_OFFSET = CLONE_DESC_HEADER_LEN
static

Clone Data: Snapshot state in 4 bytes.

◆ CLONE_DATA_TASK_BLOCK_OFFSET

const uint CLONE_DATA_TASK_BLOCK_OFFSET
static
Initial value:
=
static const uint CLONE_DATA_TASK_CHUNK_OFFSET
Clone Data: Current chunk number in 4 bytes.
Definition: clone0desc.cc:985

Clone Data: Current block number in 4 bytes.

◆ CLONE_DATA_TASK_CHUNK_OFFSET

const uint CLONE_DATA_TASK_CHUNK_OFFSET
static
Initial value:
=
static const uint CLONE_DATA_TASK_INDEX_OFFSET
Clone Data: Task index in 4 bytes.
Definition: clone0desc.cc:982

Clone Data: Current chunk number in 4 bytes.

◆ CLONE_DATA_TASK_INDEX_OFFSET

const uint CLONE_DATA_TASK_INDEX_OFFSET = CLONE_DATA_STATE_OFFSET + 4
static

Clone Data: Task index in 4 bytes.

◆ CLONE_DESC_DATA_LEN

const uint CLONE_DESC_DATA_LEN = CLONE_DATA_FILE_SIZE_OFFSET + 8
static

Clone Data: Total length.

◆ CLONE_DESC_FILE_FLAG_AES

const uint CLONE_DESC_FILE_FLAG_AES = 3
static

Clone File Flag: Encryption type AES.

◆ CLONE_DESC_FILE_FLAG_DELETED

const uint CLONE_DESC_FILE_FLAG_DELETED = 5
static

Clone File Flag: File is deleted.

◆ CLONE_DESC_FILE_FLAG_LZ4

const uint CLONE_DESC_FILE_FLAG_LZ4 = 2
static

Clone File Flag: Compression type LZ4.

◆ CLONE_DESC_FILE_FLAG_RENAMED

const uint CLONE_DESC_FILE_FLAG_RENAMED = 4
static

Clone File Flag: File is renamed.

◆ CLONE_DESC_FILE_FLAG_ZLIB

const uint CLONE_DESC_FILE_FLAG_ZLIB = 1
static

Clone File Flag: Compression type ZLIB.

◆ CLONE_DESC_FILE_HAS_KEY

const uint CLONE_DESC_FILE_HAS_KEY = 6
static

Clone File Flag: File metadata has encryption key.

◆ CLONE_DESC_HEADER_LEN

const uint CLONE_DESC_HEADER_LEN = CLONE_DESC_TYPE_OFFSET + 4
static

Header: Fixed length.

◆ CLONE_DESC_LEN_OFFSET

const uint CLONE_DESC_LEN_OFFSET = CLONE_DESC_VER_OFFSET + 4
static

Header: Total length is stored in next 4 bytes.

◆ CLONE_DESC_LOC_BASE_LEN

const uint CLONE_DESC_LOC_BASE_LEN = CLONE_LOC_META_OFFSET + 1
static

Locator: Total length.

◆ CLONE_DESC_MAX_VERSION

const uint CLONE_DESC_MAX_VERSION = 100
static

Maximum supported descriptor version.

The version represents the current set of descriptors and its elements.

◆ CLONE_DESC_STATE_EST_BYTES

const uint CLONE_DESC_STATE_EST_BYTES = CLONE_DESC_STATE_NUM_FILES + 4
static

Clone State: Estimated number of bytes in 8 bytes.

◆ CLONE_DESC_STATE_EST_DISK

const uint CLONE_DESC_STATE_EST_DISK = CLONE_DESC_STATE_EST_BYTES + 8
static

Clone State: Estimated number of bytes in 8 bytes.

◆ CLONE_DESC_STATE_FLAG_ACK

const uint CLONE_DESC_STATE_FLAG_ACK = 2
static

Clone State Flag: Acknowledge processing state.

◆ CLONE_DESC_STATE_FLAG_START

const uint CLONE_DESC_STATE_FLAG_START = 1
static

Clone State Flag: Start processing state.

◆ CLONE_DESC_STATE_FLAGS

const uint CLONE_DESC_STATE_FLAGS = CLONE_DESC_STATE_EST_DISK + 8
static

Clone State: flags in 2 byte [max 16 flags].

◆ CLONE_DESC_STATE_LEN

const uint CLONE_DESC_STATE_LEN = CLONE_DESC_STATE_FLAGS + 2
static

Clone State: Total length.

◆ CLONE_DESC_STATE_NUM_CHUNKS

const uint CLONE_DESC_STATE_NUM_CHUNKS = CLONE_DESC_TASK_OFFSET + 4
static

Clone State: Number of chunks in 4 bytes.

◆ CLONE_DESC_STATE_NUM_FILES

const uint CLONE_DESC_STATE_NUM_FILES = CLONE_DESC_STATE_NUM_CHUNKS + 4
static

Clone State: Number of files in 4 bytes.

◆ CLONE_DESC_STATE_OFFSET

const uint CLONE_DESC_STATE_OFFSET = CLONE_DESC_HEADER_LEN
static

Clone State: Snapshot state in 4 bytes.

◆ CLONE_DESC_TASK_OFFSET

const uint CLONE_DESC_TASK_OFFSET = CLONE_DESC_STATE_OFFSET + 4
static

Clone State: Task index in 4 bytes.

◆ CLONE_DESC_TYPE_OFFSET

const uint CLONE_DESC_TYPE_OFFSET = CLONE_DESC_LEN_OFFSET + 4
static

Header: Descriptor type is in next 4 bytes.

◆ CLONE_DESC_VER_OFFSET

const uint CLONE_DESC_VER_OFFSET = 0
static

Header: Version is in first 4 bytes.

◆ CLONE_FILE_ALLOC_SIZE_OFFSET

const uint CLONE_FILE_ALLOC_SIZE_OFFSET = CLONE_FILE_SIZE_OFFSET + 8
static

File Metadata: Sparse file allocation size on disk in 8 bytes.

◆ CLONE_FILE_BASE_LEN

const uint CLONE_FILE_BASE_LEN = CLONE_FILE_FNAME_OFFSET
static

File Metadata: Length excluding the file name.

◆ CLONE_FILE_BCHUNK_OFFSET

const uint CLONE_FILE_BCHUNK_OFFSET = CLONE_FILE_IDX_OFFSET + 4
static

File Metadata: First chunk number in 4 bytes.

◆ CLONE_FILE_ECHUNK_OFFSET

const uint CLONE_FILE_ECHUNK_OFFSET = CLONE_FILE_BCHUNK_OFFSET + 4
static

File Metadata: Last chunk number in 4 bytes.

◆ CLONE_FILE_FLAGS_OFFSET

const uint CLONE_FILE_FLAGS_OFFSET = CLONE_FILE_FSBLK_OFFSET + 4
static

File Metadata: File space flags in next 2 bytes [Maximum 16 flags].

◆ CLONE_FILE_FNAME_OFFSET

const uint CLONE_FILE_FNAME_OFFSET = CLONE_FILE_FNAMEL_OFFSET + 4
static

File Metadata: File name.

◆ CLONE_FILE_FNAMEL_OFFSET

const uint CLONE_FILE_FNAMEL_OFFSET = CLONE_FILE_ECHUNK_OFFSET + 4
static

File Metadata: File name length in 4 bytes.

◆ CLONE_FILE_FSBLK_OFFSET

const uint CLONE_FILE_FSBLK_OFFSET = CLONE_FILE_FSP_OFFSET + 4
static

File Metadata: File system block size for compressed tables in 4 bytes.

◆ CLONE_FILE_FSP_OFFSET

const uint CLONE_FILE_FSP_OFFSET = CLONE_FILE_ALLOC_SIZE_OFFSET + 8
static

File Metadata: FSP flags in 4 bytes.

◆ CLONE_FILE_IDX_OFFSET

const uint CLONE_FILE_IDX_OFFSET = CLONE_FILE_SPACE_ID_OFFSET + 4
static

File Metadata: File index in 4 bytes.

◆ CLONE_FILE_SIZE_OFFSET

const uint CLONE_FILE_SIZE_OFFSET = CLONE_FILE_STATE_OFFSET + 4
static

File Metadata: File size in 8 bytes.

◆ CLONE_FILE_SPACE_ID_OFFSET

const uint CLONE_FILE_SPACE_ID_OFFSET = CLONE_FILE_FLAGS_OFFSET + 2
static

File Metadata: Tablespace ID in 4 bytes.

◆ CLONE_FILE_STATE_OFFSET

const uint CLONE_FILE_STATE_OFFSET = CLONE_DESC_HEADER_LEN
static

File Metadata: Snapshot state in 4 bytes.

◆ CLONE_LOC_CID_OFFSET

const uint CLONE_LOC_CID_OFFSET = CLONE_DESC_HEADER_LEN
static

Locator: Clone identifier in 8 bytes.

◆ CLONE_LOC_IDX_OFFSET

const uint CLONE_LOC_IDX_OFFSET = CLONE_LOC_SID_OFFSET + 8
static

Locator: Clone array index in 4 bytes.

◆ CLONE_LOC_META_OFFSET

const uint CLONE_LOC_META_OFFSET = CLONE_LOC_STATE_OFFSET + 1
static

Locator: Clone Snapshot sub-state in 1 byte.

◆ CLONE_LOC_SID_OFFSET

const uint CLONE_LOC_SID_OFFSET = CLONE_LOC_CID_OFFSET + 8
static

Locator: Snapshot identifier in 8 bytes.

◆ CLONE_LOC_STATE_OFFSET

const uint CLONE_LOC_STATE_OFFSET = CLONE_LOC_IDX_OFFSET + 4
static

Locator: Clone Snapshot state in 1 byte.

◆ CLONE_TASK_BLOCK_OFFSET

const uint CLONE_TASK_BLOCK_OFFSET = CLONE_TASK_CHUNK_OFFSET + 4
static

Task: Task block number in 4 bytes.

◆ CLONE_TASK_CHUNK_OFFSET

const uint CLONE_TASK_CHUNK_OFFSET = CLONE_TASK_INDEX_OFFSET + 4
static

Task: Task chunk number in 4 bytes.

◆ CLONE_TASK_INDEX_OFFSET

const uint CLONE_TASK_INDEX_OFFSET = CLONE_DESC_HEADER_LEN
static

Task: Clone task index in 4 bytes.

◆ CLONE_TASK_META_LEN

const uint CLONE_TASK_META_LEN = CLONE_TASK_BLOCK_OFFSET + 4
static

Task: Total length.