31#ifndef ddl0impl_buffer_h
32#define ddl0impl_buffer_h
56 m_ptr =
static_cast<byte *
>(
60 if (
m_ptr !=
nullptr) {
152 void clear() noexcept;
160 [[nodiscard]]
bool is_fts() const noexcept {
179 [[nodiscard]]
bool empty() const noexcept {
return size() == 0; }
201 (
sizeof(std::remove_pointer<
decltype(
210 void deep_copy(
size_t n_fields,
size_t data_size)
noexcept;
223 using DTuples = std::vector<DTuple, ut::allocator<DTuple>>;
A utility class which, if inherited from, prevents the descendant class from being copied,...
Definition: ut0class_life_cycle.h:40
Allocator that allows std::* containers to manage their memory through ut::malloc* and ut::free libra...
Definition: ut0new.h:2179
dberr_t
Definition: db0err.h:38
DDL implementation include file.
static ulint dict_index_is_unique(const dict_index_t *index)
Check whether the index is unique.
constexpr uint32_t DICT_FTS
FTS index; can't be combined with the other flags.
Definition: dict0mem.h:103
unsigned char byte
Blob class.
Definition: common.h:150
static void * mem_heap_alloc(mem_heap_t *heap, ulint n)
Allocates n bytes of memory from a memory heap.
static void mem_heap_free(mem_heap_t *heap)
Frees the space occupied by a memory heap.
uint16_t value_type
Definition: vt100.h:183
The general architecture is that the work is done in two phases, roughly the read and write phase.
Definition: btr0load.cc:41
std::pair< byte *, os_offset_t > IO_buffer
Block size for DDL I/O operations.
Definition: ddl0impl.h:46
void * malloc_large_page_withkey(PSI_memory_key_t key, std::size_t size) noexcept
Dynamically allocates memory backed up by large (huge) pages.
Definition: ut0new.h:1245
PSI_memory_key_t make_psi_memory_key(PSI_memory_key key)
Convenience helper function to create type-safe representation of PSI_memory_key.
Definition: ut0new.h:188
bool free_large_page(void *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::malloc_large_page*() var...
Definition: ut0new.h:1322
uint64_t os_offset_t
File offset in bytes.
Definition: os0file.h:83
required string type
Definition: replication_group_member_actions.proto:33
Buffer used for reading and writing to the temporary files.
Definition: ddl0impl-buffer.h:82
IO_buffer io_buffer() noexcept
Get the IO buffer.
Definition: ddl0impl-buffer.h:111
PFS_buffer m_buffer
Raw buffer (unaligned pointer).
Definition: ddl0impl-buffer.h:115
bool allocate(size_t size) noexcept
Allocate the buffer.
Definition: ddl0impl-buffer.h:92
~Aligned_buffer()=default
Destructor.
Aligned_buffer()=default
Constructor.
IO_buffer m_io_buffer
The IO buffer.
Definition: ddl0impl-buffer.h:118
Structure for reporting duplicate records.
Definition: ddl0ddl.h:131
Buffer for sorting in main memory.
Definition: ddl0impl-buffer.h:122
bool full() const noexcept
Definition: ddl0impl-buffer.h:176
dberr_t serialize(IO_buffer io_buffer, Function &&f) noexcept
Serialize the contents for storing to disk.
Definition: ddl0buffer.cc:116
bool is_fts() const noexcept
Definition: ddl0impl-buffer.h:160
bool will_fit(size_t n) const noexcept
Check if n bytes will fit in the buffer.
Definition: ddl0impl-buffer.h:198
Key_sort_buffer(dict_index_t *index, size_t size) noexcept
Constructor.
Definition: ddl0buffer.cc:80
size_t m_buffer_size
Buffer size.
Definition: ddl0impl-buffer.h:244
size_t size() const noexcept
Definition: ddl0impl-buffer.h:173
dfield_t * alloc(size_t n) noexcept
Allocate fields from the heap.
Definition: ddl0impl-buffer.h:190
std::vector< DTuple, ut::allocator< DTuple > > DTuples
Definition: ddl0impl-buffer.h:223
static int compare(const dfield_t *lhs, const dfield_t *rhs, Dup *dup) noexcept
Compare two merge data tuples.
Definition: ddl0buffer.cc:218
bool is_clustered() const noexcept
Definition: ddl0impl-buffer.h:155
size_t m_n_tuples
Number of data tuples.
Definition: ddl0impl-buffer.h:235
bool is_unique() const noexcept
Definition: ddl0impl-buffer.h:165
size_t m_total_size
Total amount of data bytes.
Definition: ddl0impl-buffer.h:232
std::function< dberr_t(IO_buffer io_buffer, os_offset_t &n)> Function
Callback for writing serialized data to to disk.
Definition: ddl0impl-buffer.h:131
mem_heap_t * heap() noexcept
Definition: ddl0impl-buffer.h:170
dict_index_t * m_index
The index the tuples belong to.
Definition: ddl0impl-buffer.h:229
void deep_copy(size_t n_fields, size_t data_size) noexcept
Deep copy the field data starting from the back.
Definition: ddl0buffer.cc:87
DTuples m_dtuples
Array of data tuples.
Definition: ddl0impl-buffer.h:241
dfield_t *& back() noexcept
Definition: ddl0impl-buffer.h:182
~Key_sort_buffer() noexcept
Destructor.
Definition: ddl0impl-buffer.h:139
size_t m_max_tuples
Maximum number of data tuples.
Definition: ddl0impl-buffer.h:238
mem_heap_t * m_heap
Memory heap where allocated.
Definition: ddl0impl-buffer.h:226
void sort(ddl::Dup *dup) noexcept
Sort the elements in m_dtuples.
Definition: ddl0buffer.cc:103
void clear() noexcept
Reset the sort buffer.
Definition: ddl0buffer.cc:97
bool empty() const noexcept
Definition: ddl0impl-buffer.h:179
For DDL memory allocations that use the mem_key_ddl handle.
Definition: ddl0impl-buffer.h:40
size_t m_size
Number of bytes allocated.
Definition: ddl0impl-buffer.h:78
byte * m_ptr
Pointer to allocated buffer.
Definition: ddl0impl-buffer.h:75
byte * allocate(size_t size) noexcept
Definition: ddl0impl-buffer.h:52
PFS_buffer()=default
Constructor.
byte Type
Definition: ddl0impl-buffer.h:41
~PFS_buffer() noexcept
Destructor.
Definition: ddl0impl-buffer.h:48
void deallocate() noexcept
Deallocate the memory.
Definition: ddl0impl-buffer.h:69
Structure for an SQL data field.
Definition: data0data.h:604
Data structure for an index.
Definition: dict0mem.h:1045
unsigned type
index type (DICT_CLUSTERED, DICT_UNIQUE, DICT_IBUF, DICT_CORRUPT)
Definition: dict0mem.h:1072
bool is_clustered() const
Definition: dict0mem.h:1310
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:301
Definition: ut0new.h:1329
static const size_t UNIV_SECTOR_SIZE
Definition: univ.i:640
static void * ut_align(const void *ptr, ulint align_no)
The following function rounds up a pointer to the nearest aligned address.
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:56
PSI_memory_key mem_key_ddl
Definition: ut0new.cc:59
int n
Definition: xcom_base.cc:508