33#ifndef CLONE_DESC_INCLUDE
34#define CLONE_DESC_INCLUDE
170 bool deserialize(
const byte *desc_hdr, uint desc_len);
205 auto byte_index = index >> 3;
206 ut_ad(byte_index == index / 8);
213 auto bit_pos = index & 31;
214 ut_ad(bit_pos == index % 32);
221 operator bool()
const {
283 void serialize(
byte *&desc_chunk, uint &len);
288 void deserialize(
const byte *desc_chunk, uint &len_left);
347 void serialize(
byte *desc_chunk, uint &len);
352 void deserialize(
const byte *desc_chunk, uint &len_left);
435 bool deserialize(
const byte *desc_task, uint desc_len);
482 bool deserialize(
const byte *desc_state, uint desc_len);
592 bool deserialize(
const byte *desc_file, uint desc_len);
633 bool deserialize(
const byte *desc_data, uint desc_len);
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
Bitmap array index operator implementation.
Definition: clone0desc.h:196
uint32_t *& m_bitmap_ref
Reference to BITMAP array.
Definition: clone0desc.h:245
Bitmap_Operator_Impl(uint32_t *&bitmap, uint32_t index)
Construct bitmap operator.
Definition: clone0desc.h:201
uint32_t m_bit_mask
Mask with current BIT set.
Definition: clone0desc.h:251
void operator=(bool bit)
Set BIT at specific index.
Definition: clone0desc.h:233
uint32_t m_map_index
Current array position.
Definition: clone0desc.h:248
Bitmap for completed chunks in current state.
Definition: clone0desc.h:190
uint32_t size_bits() const
Size of bitmap in bits.
Definition: clone0desc.h:304
void deserialize(const byte *desc_chunk, uint &len_left)
Deserialize the descriptor.
Definition: clone0desc.cc:393
size_t size() const
Size of bitmap in bytes.
Definition: clone0desc.h:300
void serialize(byte *&desc_chunk, uint &len)
Serialize the descriptor.
Definition: clone0desc.cc:328
uint32_t * reset(uint32_t max_bits, mem_heap_t *heap)
Reset bitmap with new size.
Definition: clone0desc.cc:168
size_t get_serialized_length()
Get the length of serialized data.
Definition: clone0desc.cc:296
uint32_t * m_bitmap
BITMAP buffer.
Definition: clone0desc.h:308
Bitmap_Operator_Impl operator[](uint32_t index)
Array index operator.
Definition: clone0desc.h:257
uint32_t m_bits
Total number of BITs in the MAP.
Definition: clone0desc.h:314
Chnunk_Bitmap()
Construct bitmap.
Definition: clone0desc.h:193
uint32_t get_min_unset_bit()
Get minimum BIT position that is not set.
Definition: clone0desc.cc:196
size_t capacity() const
Maximum bit capacity.
Definition: clone0desc.h:296
uint32_t get_max_set_bit()
Get maximum BIT position that is not set.
Definition: clone0desc.cc:244
size_t m_size
BITMAP buffer size: Number of 4 byte blocks.
Definition: clone0desc.h:311
static constexpr size_t KEY_LEN
Encryption key length.
Definition: os0enc.h:117
Clone_Desc_Type
Clone descriptors contain meta information needed for applying cloned data.
Definition: clone0desc.h:130
@ CLONE_DESC_MAX
Must be the last member.
Definition: clone0desc.h:147
@ CLONE_DESC_DATA
Information for a data block.
Definition: clone0desc.h:144
@ CLONE_DESC_FILE_METADATA
Metadata for a database file.
Definition: clone0desc.h:141
@ CLONE_DESC_TASK_METADATA
Metadata for a Task/Thread for clone operation.
Definition: clone0desc.h:135
@ CLONE_DESC_LOCATOR
Logical pointer to identify a clone operation.
Definition: clone0desc.h:132
@ CLONE_DESC_STATE
Information for snapshot state.
Definition: clone0desc.h:138
const uint32_t CLONE_ALIGN_DIRECT_IO
Align by 4K for O_DIRECT.
Definition: clone0desc.h:48
const int CLONE_MAX_TASKS
Maximum number of concurrent tasks for each clone.
Definition: clone0desc.h:51
const uint64_t CLONE_LOC_INVALID_ID
Invalid locator ID.
Definition: clone0desc.h:41
bool clone_validate_locator(const byte *desc_loc, uint desc_len)
Check if clone locator is valid.
Definition: clone0desc.cc:543
Snapshot_State
Snapshot state transfer during clone.
Definition: clone0desc.h:93
@ CLONE_SNAPSHOT_PAGE_COPY
Snapshot state while transferring pages.
Definition: clone0desc.h:104
@ CLONE_SNAPSHOT_REDO_COPY
Snapshot state while transferring redo.
Definition: clone0desc.h:107
@ CLONE_SNAPSHOT_DONE
Snapshot state at end after finishing transfer.
Definition: clone0desc.h:110
@ CLONE_SNAPSHOT_NONE
Invalid state.
Definition: clone0desc.h:95
@ CLONE_SNAPSHOT_INIT
Initialize state when snapshot object is created.
Definition: clone0desc.h:98
@ CLONE_SNAPSHOT_FILE_COPY
Snapshot state while transferring files.
Definition: clone0desc.h:101
const uint32_t CLONE_DESC_MAX_BASE_LEN
Maximum base length for any serialized descriptor.
Definition: clone0desc.h:45
uint choose_desc_version(const byte *ref_loc)
Choose lowest descriptor version between reference locator and currently supported version.
Definition: clone0desc.cc:53
const size_t CLONE_MAX_TRANSFER_STAGES
Total number of data transfer stages in clone.
Definition: clone0desc.h:114
std::map< uint32_t, uint32_t > Chunk_Map
Map for current block number for unfinished chunks.
Definition: clone0desc.h:187
The interface to the operating system file io.
required uint64 version
Definition: replication_group_member_actions.proto:41
Incomplete Chunk information.
Definition: clone0desc.h:318
uint32_t m_min_unres_chunk
Minimum chunk number that is not reserved yet.
Definition: clone0desc.h:329
size_t get_serialized_length(uint32_t num_tasks)
Get the length of serialized data.
Definition: clone0desc.cc:306
void init_chunk_nums()
Initialize Chunk number ranges.
Definition: clone0desc.h:335
void deserialize(const byte *desc_chunk, uint &len_left)
Deserialize the descriptor.
Definition: clone0desc.cc:425
void serialize(byte *desc_chunk, uint &len)
Serialize the descriptor.
Definition: clone0desc.cc:352
Chnunk_Bitmap m_reserved_chunks
Information about chunks completed.
Definition: clone0desc.h:320
uint32_t m_total_chunks
Chunks for current state.
Definition: clone0desc.h:326
uint32_t m_max_res_chunk
Maximum chunk number that is already reserved.
Definition: clone0desc.h:332
Chunk_Map m_incomplete_chunks
Information about unfinished chunks.
Definition: clone0desc.h:323
CLONE_DESC_DATA: Descriptor for data.
Definition: clone0desc.h:596
Clone_Task_Meta m_task_meta
Task information.
Definition: clone0desc.h:604
void serialize(byte *&desc_data, uint &len, mem_heap_t *heap)
Serialize the descriptor.
Definition: clone0desc.cc:1015
uint32_t m_data_len
Data Length.
Definition: clone0desc.h:610
uint32_t m_file_index
File identifier.
Definition: clone0desc.h:607
Snapshot_State m_state
Current snapshot State.
Definition: clone0desc.h:601
uint64_t m_file_offset
File offset for the data.
Definition: clone0desc.h:613
void init_header(uint version)
Initialize header.
Definition: clone0desc.cc:1007
uint64_t m_file_size
Updated file size.
Definition: clone0desc.h:616
Clone_Desc_Header m_header
Descriptor header.
Definition: clone0desc.h:598
bool deserialize(const byte *desc_data, uint desc_len)
Deserialize the descriptor.
Definition: clone0desc.cc:1042
CLONE_DESC_LOCATOR: Descriptor for a task for clone operation.
Definition: clone0desc.h:362
Snapshot_State m_state
Current snapshot State.
Definition: clone0desc.h:376
bool match(Clone_Desc_Locator *other_desc)
Check if the passed locator matches the current one.
Definition: clone0desc.cc:490
void init(uint64_t id, uint64_t snap_id, Snapshot_State state, uint version, uint index)
Initialize clone locator.
Definition: clone0desc.cc:474
void serialize(byte *&desc_loc, uint &len, Chunk_Info *chunk_info, mem_heap_t *heap)
Serialize the descriptor.
Definition: clone0desc.cc:504
Clone_Desc_Header m_header
Descriptor header.
Definition: clone0desc.h:364
uint32_t m_clone_index
Index in clone array for fast reference.
Definition: clone0desc.h:373
uint64_t m_clone_id
Unique identifier for a clone operation.
Definition: clone0desc.h:367
uint64_t m_snapshot_id
Unique identifier for a clone snapshot.
Definition: clone0desc.h:370
bool m_metadata_transferred
Sub-state information: metadata transferred.
Definition: clone0desc.h:379
void deserialize(const byte *desc_loc, uint desc_len, Chunk_Info *chunk_info)
Deserialize the descriptor.
Definition: clone0desc.cc:559
CLONE_DESC_STATE: Descriptor for current snapshot state.
Definition: clone0desc.h:439
bool m_is_start
If start processing state.
Definition: clone0desc.h:462
bool deserialize(const byte *desc_state, uint desc_len)
Deserialize the descriptor.
Definition: clone0desc.cc:948
Snapshot_State m_state
Current snapshot State.
Definition: clone0desc.h:444
uint m_num_chunks
Number of chunks in current state.
Definition: clone0desc.h:450
Clone_Desc_Header m_header
Descriptor header.
Definition: clone0desc.h:441
uint m_task_index
Task identifier.
Definition: clone0desc.h:447
uint64_t m_estimate
Number of estimated bytes to transfer.
Definition: clone0desc.h:456
void init_header(uint version)
Initialize header.
Definition: clone0desc.cc:906
uint m_num_files
Number of files in current state.
Definition: clone0desc.h:453
bool m_is_ack
State transfer Acknowledgement.
Definition: clone0desc.h:465
uint64_t m_estimate_disk
Number of estimated bytes on disk.
Definition: clone0desc.h:459
void serialize(byte *&desc_state, uint &len, mem_heap_t *heap)
Serialize the descriptor.
Definition: clone0desc.cc:914
Type
Algorithm types supported.
Definition: file.h:53
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Version control for database, common definitions, and include files.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93