MySQL 8.0.39
Source Code Documentation
clone0desc.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2017, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/clone0desc.h
29 Innodb clone descriptors
30
31 *******************************************************/
32
33#ifndef CLONE_DESC_INCLUDE
34#define CLONE_DESC_INCLUDE
35
36#include "mem0mem.h"
37#include "os0file.h"
38#include "univ.i"
39
40/** Invalid locator ID. */
41const uint64_t CLONE_LOC_INVALID_ID = 0;
42
43/** Maximum base length for any serialized descriptor. This is only used for
44optimal allocation and has no impact on version compatibility. */
47/** Align by 4K for O_DIRECT */
48const uint32_t CLONE_ALIGN_DIRECT_IO = 4 * 1024;
49
50/** Maximum number of concurrent tasks for each clone */
51const int CLONE_MAX_TASKS = 128;
52
53/** Snapshot state transfer during clone.
54
55Clone Type: HA_CLONE_BLOCKING
56@startuml
57 state CLONE_SNAPSHOT_INIT
58 state CLONE_SNAPSHOT_FILE_COPY
59 state CLONE_SNAPSHOT_DONE
60
61 [*] -down-> CLONE_SNAPSHOT_INIT : Build snapshot
62 CLONE_SNAPSHOT_INIT -right-> CLONE_SNAPSHOT_FILE_COPY
63 CLONE_SNAPSHOT_FILE_COPY -right-> CLONE_SNAPSHOT_DONE
64 CLONE_SNAPSHOT_DONE -down-> [*] : Destroy snapshot
65@enduml
66
67Clone Type: HA_CLONE_REDO
68@startuml
69 state CLONE_SNAPSHOT_REDO_COPY
70
71 [*] -down-> CLONE_SNAPSHOT_INIT : Build snapshot
72 CLONE_SNAPSHOT_INIT -right-> CLONE_SNAPSHOT_FILE_COPY : Start redo archiving
73 CLONE_SNAPSHOT_FILE_COPY -right-> CLONE_SNAPSHOT_REDO_COPY
74 CLONE_SNAPSHOT_REDO_COPY -right-> CLONE_SNAPSHOT_DONE
75 CLONE_SNAPSHOT_DONE -down-> [*] : Destroy snapshot
76@enduml
77
78Clone Type: HA_CLONE_HYBRID
79@startuml
80 state CLONE_SNAPSHOT_PAGE_COPY
81
82 [*] -down-> CLONE_SNAPSHOT_INIT : Build snapshot
83 CLONE_SNAPSHOT_INIT -right-> CLONE_SNAPSHOT_FILE_COPY : Start page tracking
84 CLONE_SNAPSHOT_FILE_COPY -right-> CLONE_SNAPSHOT_PAGE_COPY : Start redo \
85 archiving
86 CLONE_SNAPSHOT_PAGE_COPY -right-> CLONE_SNAPSHOT_REDO_COPY
87 CLONE_SNAPSHOT_REDO_COPY -right> CLONE_SNAPSHOT_DONE
88 CLONE_SNAPSHOT_DONE -down-> [*] : Destroy snapshot
89@enduml
90
91Clone Type: HA_CLONE_PAGE: Not implemented
92*/
93enum Snapshot_State : uint32_t {
94 /** Invalid state */
96
97 /** Initialize state when snapshot object is created */
99
100 /** Snapshot state while transferring files. */
102
103 /** Snapshot state while transferring pages. */
105
106 /** Snapshot state while transferring redo. */
108
109 /** Snapshot state at end after finishing transfer. */
112
113/** Total number of data transfer stages in clone. */
115
116/** Choose lowest descriptor version between reference locator
117and currently supported version.
118@param[in] ref_loc reference locator
119@return chosen version */
120uint choose_desc_version(const byte *ref_loc);
121
122/** Check if clone locator is valid
123@param[in] desc_loc serialized descriptor
124@param[in] desc_len descriptor length
125@return true, if valid locator */
126bool clone_validate_locator(const byte *desc_loc, uint desc_len);
127
128/** Clone descriptors contain meta information needed for applying cloned data.
129These are PODs with interface to serialize and deserialize them. */
131 /** Logical pointer to identify a clone operation */
133
134 /** Metadata for a Task/Thread for clone operation */
136
137 /** Information for snapshot state */
139
140 /** Metadata for a database file */
142
143 /** Information for a data block */
145
146 /** Must be the last member */
149
150/** Header common to all descriptors. */
152 /** Descriptor version */
154
155 /** Serialized length of descriptor in bytes */
157
158 /** Descriptor type */
160
161 /** Serialize the descriptor header: Caller must allocate
162 the serialized buffer.
163 @param[out] desc_hdr serialized header */
164 void serialize(byte *desc_hdr);
165
166 /** Deserialize the descriptor header.
167 @param[in] desc_hdr serialized header
168 @param[in] desc_len descriptor length
169 @return true, if successful. */
170 bool deserialize(const byte *desc_hdr, uint desc_len);
171};
172
173/** Task information in clone operation. */
175 /** Index in task array. */
177
178 /** Current chunk number reserved by the task. */
180
181 /** Current block number that is already transferred. */
183};
184
185/** Map for current block number for unfinished chunks. Used during
186restart from incomplete clone operation. */
187using Chunk_Map = std::map<uint32_t, uint32_t>;
188
189/** Bitmap for completed chunks in current state */
191 public:
192 /** Construct bitmap */
194
195 /** Bitmap array index operator implementation */
197 public:
198 /** Construct bitmap operator
199 @param[in] bitmap reference to bitmap buffer
200 @param[in] index array operation index */
201 Bitmap_Operator_Impl(uint32_t *&bitmap, uint32_t index)
202
203 : m_bitmap_ref(bitmap) {
204 /* BYTE position */
205 auto byte_index = index >> 3;
206 ut_ad(byte_index == index / 8);
207
208 /* MAP array position */
209 m_map_index = byte_index >> 2;
210 ut_ad(m_map_index == byte_index / 4);
211
212 /* BIT position */
213 auto bit_pos = index & 31;
214 ut_ad(bit_pos == index % 32);
215
216 m_bit_mask = 1 << bit_pos;
217 }
218
219 /** Check value at specified index in BITMAP
220 @return true if the BIT is set */
221 operator bool() const {
222 auto &val = m_bitmap_ref[m_map_index];
223
224 if ((val & m_bit_mask) == 0) {
225 return (false);
226 }
227
228 return (true);
229 }
230
231 /** Set BIT at specific index
232 @param[in] bit bit value to set */
233 void operator=(bool bit) {
234 auto &val = m_bitmap_ref[m_map_index];
235
236 if (bit) {
237 val |= m_bit_mask;
238 } else {
239 val &= ~m_bit_mask;
240 }
241 }
242
243 private:
244 /** Reference to BITMAP array */
245 uint32_t *&m_bitmap_ref;
246
247 /** Current array position */
248 uint32_t m_map_index;
249
250 /** Mask with current BIT set */
251 uint32_t m_bit_mask;
252 };
253
254 /** Array index operator
255 @param[in] index bitmap array index
256 @return operator implementation object */
258 /* Convert to zero based index */
259 --index;
260
261 ut_a(index < m_bits);
262 return (Bitmap_Operator_Impl(m_bitmap, index));
263 }
264
265 /** Reset bitmap with new size
266 @param[in] max_bits number of BITs to hold
267 @param[in] heap heap for allocating memory
268 @return old buffer pointer */
269 uint32_t *reset(uint32_t max_bits, mem_heap_t *heap);
270
271 /** Get minimum BIT position that is not set
272 @return BIT position */
273 uint32_t get_min_unset_bit();
274
275 /** Get maximum BIT position that is not set
276 @return BIT position */
277 uint32_t get_max_set_bit();
278
279 /** Serialize the descriptor. Caller should pass
280 the length if allocated.
281 @param[out] desc_chunk serialized chunk info
282 @param[in,out] len length of serialized descriptor */
283 void serialize(byte *&desc_chunk, uint &len);
284
285 /** Deserialize the descriptor.
286 @param[in] desc_chunk serialized chunk info
287 @param[in,out] len_left length left in bytes */
288 void deserialize(const byte *desc_chunk, uint &len_left);
289
290 /** Get the length of serialized data
291 @return length serialized chunk info */
292 size_t get_serialized_length();
293
294 /** Maximum bit capacity
295 @return maximum number of BITs it can hold */
296 size_t capacity() const { return (8 * size()); }
297
298 /** Size of bitmap in bytes
299 @return BITMAP buffer size */
300 size_t size() const { return (m_size * 4); }
301
302 /** Size of bitmap in bits
303 @return number of BITs stored */
304 uint32_t size_bits() const { return (m_bits); }
305
306 private:
307 /** BITMAP buffer */
308 uint32_t *m_bitmap;
309
310 /** BITMAP buffer size: Number of 4 byte blocks */
311 size_t m_size;
312
313 /** Total number of BITs in the MAP */
314 uint32_t m_bits;
315};
316
317/** Incomplete Chunk information */
319 /** Information about chunks completed */
321
322 /** Information about unfinished chunks */
324
325 /** Chunks for current state */
327
328 /** Minimum chunk number that is not reserved yet */
330
331 /** Maximum chunk number that is already reserved */
333
334 /** Initialize Chunk number ranges */
338
341 }
342
343 /** Serialize the descriptor. Caller should pass
344 the length if allocated.
345 @param[out] desc_chunk serialized chunk info
346 @param[in,out] len length of serialized descriptor */
347 void serialize(byte *desc_chunk, uint &len);
348
349 /** Deserialize the descriptor.
350 @param[in] desc_chunk serialized chunk info
351 @param[in,out] len_left length left in bytes */
352 void deserialize(const byte *desc_chunk, uint &len_left);
353
354 /** Get the length of serialized data
355 @param[in] num_tasks number of tasks to include
356 @return length serialized chunk info */
357 size_t get_serialized_length(uint32_t num_tasks);
358};
359
360/** CLONE_DESC_LOCATOR: Descriptor for a task for clone operation.
361A task is used by exactly one thread */
363 /** Descriptor header */
365
366 /** Unique identifier for a clone operation. */
367 uint64_t m_clone_id;
368
369 /** Unique identifier for a clone snapshot. */
371
372 /** Index in clone array for fast reference. */
374
375 /** Current snapshot State */
377
378 /** Sub-state information: metadata transferred */
380
381 /** Initialize clone locator.
382 @param[in] id Clone identifier
383 @param[in] snap_id Snapshot identifier
384 @param[in] state snapshot state
385 @param[in] version Descriptor version
386 @param[in] index clone index */
387 void init(uint64_t id, uint64_t snap_id, Snapshot_State state, uint version,
388 uint index);
389
390 /** Check if the passed locator matches the current one.
391 @param[in] other_desc input locator descriptor
392 @return true if matches */
393 bool match(Clone_Desc_Locator *other_desc);
394
395 /** Serialize the descriptor. Caller should pass
396 the length if allocated.
397 @param[out] desc_loc serialized descriptor
398 @param[in,out] len length of serialized descriptor
399 @param[in] chunk_info chunk information to serialize
400 @param[in] heap heap for allocating memory */
401 void serialize(byte *&desc_loc, uint &len, Chunk_Info *chunk_info,
402 mem_heap_t *heap);
403
404 /** Deserialize the descriptor.
405 @param[in] desc_loc serialized locator
406 @param[in] desc_len locator length
407 @param[in,out] chunk_info chunk information */
408 void deserialize(const byte *desc_loc, uint desc_len, Chunk_Info *chunk_info);
409};
410
411/** CLONE_DESC_TASK_METADATA: Descriptor for a task for clone operation.
412A task is used by exactly one thread */
414 /** Descriptor header */
416
417 /** Task information */
419
420 /** Initialize header
421 @param[in] version descriptor version */
423
424 /** Serialize the descriptor. Caller should pass
425 the length if allocated.
426 @param[out] desc_task serialized descriptor
427 @param[in,out] len length of serialized descriptor
428 @param[in] heap heap for allocating memory */
429 void serialize(byte *&desc_task, uint &len, mem_heap_t *heap);
430
431 /** Deserialize the descriptor.
432 @param[in] desc_task serialized descriptor
433 @param[in] desc_len descriptor length
434 @return true, if successful. */
435 bool deserialize(const byte *desc_task, uint desc_len);
436};
437
438/** CLONE_DESC_STATE: Descriptor for current snapshot state */
440 /** Descriptor header */
442
443 /** Current snapshot State */
445
446 /** Task identifier */
448
449 /** Number of chunks in current state */
451
452 /** Number of files in current state */
454
455 /** Number of estimated bytes to transfer */
456 uint64_t m_estimate;
457
458 /** Number of estimated bytes on disk */
460
461 /** If start processing state */
463
464 /** State transfer Acknowledgement */
466
467 /** Initialize header
468 @param[in] version descriptor version */
470
471 /** Serialize the descriptor. Caller should pass
472 the length if allocated.
473 @param[out] desc_state serialized descriptor
474 @param[in,out] len length of serialized descriptor
475 @param[in] heap heap for allocating memory */
476 void serialize(byte *&desc_state, uint &len, mem_heap_t *heap);
477
478 /** Deserialize the descriptor.
479 @param[in] desc_state serialized descriptor
480 @param[in] desc_len descriptor length
481 @return true, if successful. */
482 bool deserialize(const byte *desc_state, uint desc_len);
483};
484
485/** Clone file information */
487 /** Set file as deleted chunk.
488 @param[in] chunk chunk number that is found deleted. */
489 inline void set_deleted_chunk(uint32_t chunk) {
490 m_begin_chunk = chunk;
491 m_end_chunk = 0;
492 m_deleted = true;
493 }
494
495 /** @return true, iff file is deleted. */
496 bool is_deleted() const { return m_deleted; }
497
498 /** @return true, iff file is deleted. */
499 bool is_renamed() const { return m_renamed; }
500
501 /** @return true, iff file is encrypted. */
503
504 /** Reset DDL state of file metadata. */
505 void reset_ddl() {
506 m_renamed = false;
507 m_deleted = false;
508 }
509
510 /* Initialize parameters. */
511 void init();
512
513 /** File size in bytes */
514 uint64_t m_file_size;
515
516 /** File allocation size on disk for sparse files. */
517 uint64_t m_alloc_size;
518
519 /** Tablespace FSP flags */
520 uint32_t m_fsp_flags;
521
522 /** File compression type */
524
525 /** If transparent compression is needed. It is derived information
526 and is not transferred. */
528
529 /* Set file metadata as deleted. */
531
532 /* Set file metadata as renamed. */
534
535 /* Contains encryption key to be transferred. */
537
538 /** File system block size. */
540
541 /** Tablespace ID for the file */
543
544 /** File index in clone data file vector */
546
547 /** Chunk number for the first chunk in file */
549
550 /** Chunk number for the last chunk in file */
552
553 /** File name length in bytes */
555
556 /** Allocation length of name buffer. */
558
559 /** File name */
560 const char *m_file_name;
561
562 /** Encryption metadata. */
564};
565
566/** CLONE_DESC_FILE_METADATA: Descriptor for file metadata */
568 /** Descriptor header */
570
571 /** Current snapshot State */
573
574 /** File metadata */
576
577 /** Initialize header
578 @param[in] version descriptor version */
580
581 /** Serialize the descriptor. Caller should pass
582 the length if allocated.
583 @param[out] desc_file serialized descriptor
584 @param[in,out] len length of serialized descriptor
585 @param[in] heap heap for allocating memory */
586 void serialize(byte *&desc_file, uint &len, mem_heap_t *heap);
587
588 /** Deserialize the descriptor.
589 @param[in] desc_file serialized descriptor
590 @param[in] desc_len descriptor length
591 @return true, if successful. */
592 bool deserialize(const byte *desc_file, uint desc_len);
593};
594
595/** CLONE_DESC_DATA: Descriptor for data */
597 /** Descriptor header */
599
600 /** Current snapshot State */
602
603 /** Task information */
605
606 /** File identifier */
607 uint32_t m_file_index;
608
609 /** Data Length */
610 uint32_t m_data_len;
611
612 /** File offset for the data */
614
615 /** Updated file size */
616 uint64_t m_file_size;
617
618 /** Initialize header
619 @param[in] version descriptor version */
621
622 /** Serialize the descriptor. Caller should pass
623 the length if allocated.
624 @param[out] desc_data serialized descriptor
625 @param[in,out] len length of serialized descriptor
626 @param[in] heap heap for allocating memory */
627 void serialize(byte *&desc_data, uint &len, mem_heap_t *heap);
628
629 /** Deserialize the descriptor.
630 @param[in] desc_data serialized descriptor
631 @param[in] desc_len descriptor length
632 @return true, if successful. */
633 bool deserialize(const byte *desc_data, uint desc_len);
634};
635
636#endif /* CLONE_DESC_INCLUDE */
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:51
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 memory management.
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_FILE_METADATA: Descriptor for file metadata.
Definition: clone0desc.h:567
Clone_File_Meta m_file_meta
File metadata.
Definition: clone0desc.h:575
bool deserialize(const byte *desc_file, uint desc_len)
Deserialize the descriptor.
Definition: clone0desc.cc:755
void init_header(uint version)
Initialize header.
Definition: clone0desc.cc:657
void serialize(byte *&desc_file, uint &len, mem_heap_t *heap)
Serialize the descriptor.
Definition: clone0desc.cc:671
Snapshot_State m_state
Current snapshot State.
Definition: clone0desc.h:572
Clone_Desc_Header m_header
Descriptor header.
Definition: clone0desc.h:569
Header common to all descriptors.
Definition: clone0desc.h:151
uint m_version
Descriptor version.
Definition: clone0desc.h:153
Clone_Desc_Type m_type
Descriptor type.
Definition: clone0desc.h:159
bool deserialize(const byte *desc_hdr, uint desc_len)
Deserialize the descriptor header.
Definition: clone0desc.cc:79
void serialize(byte *desc_hdr)
Serialize the descriptor header: Caller must allocate the serialized buffer.
Definition: clone0desc.cc:73
uint m_length
Serialized length of descriptor in bytes.
Definition: clone0desc.h:156
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
CLONE_DESC_TASK_METADATA: Descriptor for a task for clone operation.
Definition: clone0desc.h:413
Clone_Desc_Header m_header
Descriptor header.
Definition: clone0desc.h:415
void serialize(byte *&desc_task, uint &len, mem_heap_t *heap)
Serialize the descriptor.
Definition: clone0desc.cc:116
bool deserialize(const byte *desc_task, uint desc_len)
Deserialize the descriptor.
Definition: clone0desc.cc:134
void init_header(uint version)
Initialize header.
Definition: clone0desc.cc:108
Clone_Task_Meta m_task_meta
Task information.
Definition: clone0desc.h:418
Clone file information.
Definition: clone0desc.h:486
bool is_renamed() const
Definition: clone0desc.h:499
uint m_file_index
File index in clone data file vector.
Definition: clone0desc.h:545
Compression::Type m_compress_type
File compression type.
Definition: clone0desc.h:523
uint32_t m_fsp_flags
Tablespace FSP flags.
Definition: clone0desc.h:520
void reset_ddl()
Reset DDL state of file metadata.
Definition: clone0desc.h:505
void init()
Definition: clone0desc.cc:1072
bool m_transfer_encryption_key
Definition: clone0desc.h:536
size_t m_file_name_alloc_len
Allocation length of name buffer.
Definition: clone0desc.h:557
size_t m_fsblk_size
File system block size.
Definition: clone0desc.h:539
space_id_t m_space_id
Tablespace ID for the file.
Definition: clone0desc.h:542
uint64_t m_alloc_size
File allocation size on disk for sparse files.
Definition: clone0desc.h:517
bool can_encrypt() const
Definition: clone0desc.h:502
bool is_deleted() const
Definition: clone0desc.h:496
size_t m_file_name_len
File name length in bytes.
Definition: clone0desc.h:554
void set_deleted_chunk(uint32_t chunk)
Set file as deleted chunk.
Definition: clone0desc.h:489
bool m_deleted
Definition: clone0desc.h:530
bool m_punch_hole
If transparent compression is needed.
Definition: clone0desc.h:527
uint64_t m_file_size
File size in bytes.
Definition: clone0desc.h:514
const char * m_file_name
File name.
Definition: clone0desc.h:560
Encryption_metadata m_encryption_metadata
Encryption metadata.
Definition: clone0desc.h:563
uint m_end_chunk
Chunk number for the last chunk in file.
Definition: clone0desc.h:551
bool m_renamed
Definition: clone0desc.h:533
uint m_begin_chunk
Chunk number for the first chunk in file.
Definition: clone0desc.h:548
Task information in clone operation.
Definition: clone0desc.h:174
uint m_block_num
Current block number that is already transferred.
Definition: clone0desc.h:182
uint m_chunk_num
Current chunk number reserved by the task.
Definition: clone0desc.h:179
uint m_task_index
Index in task array.
Definition: clone0desc.h:176
Type
Algorithm types supported.
Definition: file.h:53
Encryption metadata.
Definition: os0enc.h:445
bool can_encrypt() const
Definition: os0enc.h:458
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
unsigned int uint
Definition: uca9-dump.cc:75
Version control for database, common definitions, and include files.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:69
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:57