MySQL 9.6.0
Source Code Documentation
ddl0bulk.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2022, 2025, 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/ddl0bulk.h
29BULK Data Load. Currently treated like DDL */
30
31#pragma once
32
33#include <list>
34#include "api0api.h"
35#include "btr0mtib.h"
36#include "data0type.h"
37#include "db0err.h"
38#include "dict0types.h"
39#include "mem0mem.h"
41#include "row0mysql.h"
42#include "sql/handler.h"
43
44namespace ddl_bulk {
45
46class Loader {
47 public:
48 using Blob_context = void *;
49 using byte = unsigned char;
50
52 public:
53 bool init(const std::string &schema, const std::string &table,
54 const row_prebuilt_t *prebuilt,
55 const std::optional<Rows_mysql> &lower_bound,
56 const std::optional<Rows_mysql> &upper_bound);
57
58 bool is_initialized() const { return m_initialized; }
60
61 ib_tpl_t read() { /* Read the current row from cursor position */
62 return m_read_tuple;
63 }
64
65 void next() {
68 if (err != DB_SUCCESS) {
70 return;
71 }
73 IB_CUR_L, nullptr, nullptr, nullptr);
75 }
76
77 Table_reader() = default;
78 Table_reader(Table_reader &&other) = default;
79
81 if (m_initialized) {
83
84 if (!m_prebuilt->index->is_clustered()) {
86 }
87
88 if (m_cmp_tuple != nullptr) {
90 }
91
92 if (m_read_tuple != nullptr) {
94 }
95
98 }
99 }
100
101 private:
103 bool m_initialized{false};
104 std::string m_table_name;
106 std::optional<Rows_mysql> m_lower_bound;
107 std::vector<std::unique_ptr<char[]>> m_lower_bound_data;
108 std::optional<Rows_mysql> m_upper_bound;
109 std::vector<std::unique_ptr<char[]>> m_upper_bound_data;
116 };
117
119 public:
120 /** Initialize thread specific data.
121 @param[in] prebuilt prebuilt structures from innodb table handler */
122 void init(const row_prebuilt_t *prebuilt);
123
124 /** Load rows to a sub-tree for a specific thread.
125 @param[in] prebuilt prebuilt structures from innodb table handler
126 @param[in,out] sub_tree sub tree to load data to
127 @param[in] rows rows to be loaded to the cluster index sub-tree
128 @param[in] wait_cbk Stat callbacks
129 @return innodb error code */
130 dberr_t load(const row_prebuilt_t *prebuilt,
131 Btree_multi::Btree_load *sub_tree, const Rows_mysql &rows,
132 Bulk_load::Stat_callbacks &wait_cbk);
133
135 const row_prebuilt_t *prebuilt,
136 const Bulk_load::Source_table_data &source_table);
137
139 Btree_multi::Btree_load *sub_tree,
140 Bulk_load::Stat_callbacks &wait_cbk);
141
142 /** Create a blob.
143 @param[in] sub_tree sub tree to load data to
144 @param[out] blob_ctx pointer to an opaque object representing a blob.
145 @param[out] ref blob reference to be placed in the record.
146 @return DB_SUCCESS on success or a failure error code. */
148 lob::ref_t &ref) {
149 return sub_tree->open_blob(blob_ctx, ref);
150 }
151
152 /** Write data into the blob.
153 @param[in] sub_tree sub tree to load data to
154 @param[in] blob_ctx pointer to blob into which data is written.
155 @param[out] ref blob reference to be placed in the record.
156 @param[in] data buffer containing data to be written
157 @param[in] len length of the data to be written.
158 @return DB_SUCCESS on success or a failure error code. */
160 lob::ref_t &ref, const byte *data, size_t len) {
161 return sub_tree->write_blob(blob_ctx, ref, data, len);
162 }
163
164 /** Indicate that the blob has been completed, so that resources can be
165 removed, and as necessary flushing can be done.
166 @param[in] sub_tree sub tree to load data to
167 @param[in] blob_ctx pointer to blob which has been completely written.
168 @param[out] ref blob reference to be placed in the record.
169 @return DB_SUCCESS on success or a failure error code. */
171 lob::ref_t &ref) {
172 return sub_tree->close_blob(blob_ctx, ref);
173 }
174
175 /** Free thread specific data. */
176 void free();
177
178 dberr_t get_error() const { return m_err; }
179 std::string get_error_string() const { return m_sout.str(); }
180
181 /** Get the client error code (eg. ER_LOAD_BULK_DATA_UNSORTED).
182 @return the client error code. */
183 int get_error_code() const { return m_errcode; }
184
185 /** Add given subtree to the list of subtrees.
186 @param[in] subtree the subtree to be added. */
188 m_list_subtrees.push_back(subtree);
189 }
190
191 /** Get the last subtree created by this thread. */
193
195 auto iter = std::find_if(m_list_subtrees.begin(), m_list_subtrees.end(),
196 [ctx](const auto &subtree) {
197 return subtree->verify_blob_context(ctx);
198 });
199 ut_ad(iter != m_list_subtrees.end());
200 return *iter;
201 }
202
203 /** Flush queue size used by the Bulk_flusher */
205
206 /** Each subtree needs to have a disjoint set of keys. In the case of
207 generated DB_ROW_ID as PK, each thread can build one subtree for one range
208 of row ids. */
209 std::list<Btree_multi::Btree_load *> m_list_subtrees;
210
211 /** The last DB_ROW_ID used by this thread. */
212 uint64_t m_last_rowid{0};
213
214 private:
215 void read_input_entry(const Rows_mysql &rows, size_t &row_index,
216 const row_prebuilt_t *prebuilt, mem_heap_t *gcol_heap,
217 bool &gcol_blobs_flushed);
218 void read_table_entry(const row_prebuilt_t *prebuilt);
219
221 const Rows_mysql &rows,
222 size_t &row_index,
223 Btree_multi::Btree_load *sub_tree,
224 mem_heap_t *gcol_heap,
225 bool &gcol_blobs_flushed);
226
228 const row_prebuilt_t *prebuilt, Btree_multi::Btree_load *sub_tree);
229
230 void insert_smaller_entry(const row_prebuilt_t *prebuilt,
231 Btree_multi::Btree_load *sub_tree,
232 const Rows_mysql &rows, size_t &row_index,
233 const ddl::Compare_key &compare_key,
234 mem_heap_t *gcol_heap, bool &gcol_blobs_flushed);
235
236 /** Heap for allocating tuple memory. */
238
239 /** Tuple for converting input data to table row. */
241
243
244 /** Tuple for inserting row to index. */
246
247 /** Tuple for inserting row to index. */
249
250 /** Contains the tuple we detected an error, either m_original_table_entry
251 or m_input_entry. */
253
254 /** Column data for system column transaction ID. */
256
257 /** Column data for system column Roll pointer. */
259
260 /** Column data for system column DATA_ROW_ID. */
262
263 /** Error code at thread level. */
265
266 int m_errcode{0};
267
269
271
275 std::optional<std::string> m_original_table_name{};
276 };
277
278 /** Loader context constructor.
279 @param[in] num_threads Number of threads to use for bulk loading
280 @param[in] keynr index number
281 @param[in] trx transaction context. */
282 Loader(size_t num_threads, size_t keynr, const trx_t *trx)
283 : m_num_threads(num_threads), m_keynr(keynr), m_trx(trx) {}
284
285 /** Prepare bulk loading by multiple threads.
286 @param[in] prebuilt prebuilt structures from innodb table handler
287 @param[in] data_size total data size to load in bytes
288 @param[in] memory memory to be used from buffer pool
289 @return innodb error code */
290 dberr_t begin(const row_prebuilt_t *prebuilt, size_t data_size,
291 size_t memory);
292
293 /** Load rows to a sub-tree by a thread. Called concurrently by multiple
294 execution threads.
295 @param[in] prebuilt prebuilt structures from innodb table handler
296 @param[in] thread_index identifies the thread and the B-tree to use.
297 @param[in] rows rows to be loaded to the cluster index sub-tree
298 @param[in] wait_cbk Stat callbacks
299 @return innodb error code */
300 dberr_t load(const row_prebuilt_t *prebuilt, size_t thread_index,
301 const Rows_mysql &rows, Bulk_load::Stat_callbacks &wait_cbk);
302
304 const row_prebuilt_t *prebuilt,
305 const std::vector<Bulk_load::Source_table_data> &source_table_data);
306
308 size_t thread_index,
309 Bulk_load::Stat_callbacks &wait_cbk);
310
311 size_t get_keynr() const { return m_keynr; }
312
313 /** Open a blob.
314 @param[in] thread_index identifies the thread and the B-tree to use.
315 @param[out] blob_ctx pointer to an opaque object representing a blob.
316 @param[out] ref blob reference to be placed in the record.
317 @return DB_SUCCESS on success or a failure error code. */
318 dberr_t open_blob(size_t thread_index, Blob_context &blob_ctx,
319 lob::ref_t &ref);
320
321 /** Write data into the blob.
322 @param[in] thread_index identifies the thread and the B-tree to use.
323 @param[in] blob_ctx pointer to blob into which data is written.
324 @param[out] ref blob reference to be placed in the record.
325 @param[in] data buffer containing data to be written
326 @param[in] len length of the data to be written.
327 @return DB_SUCCESS on success or a failure error code. */
328 dberr_t write_blob(size_t thread_index, Blob_context blob_ctx,
329 lob::ref_t &ref, const byte *data, size_t len);
330
331 /** Indicate that the blob has been completed, so that resources can be
332 removed, and as necessary flushing can be done.
333 @param[in] thread_index identifies the thread and the B-tree to use.
334 @param[in] blob_ctx pointer to blob which has been completely written.
335 @param[out] ref blob reference to be placed in the record.
336 @return DB_SUCCESS on success or a failure error code. */
337 dberr_t close_blob(size_t thread_index, Blob_context blob_ctx,
338 lob::ref_t &ref);
339
340 /** Finish bulk load operation, combining the sub-trees produced by
341 concurrent threads.
342 @param[in] is_error true if called for cleanup and rollback after an error
343 @return innodb error code */
344 dberr_t end(bool is_error);
345
348 using Thread_ctxs = std::vector<Thread_data, ut::allocator<Thread_data>>;
349
350 dberr_t get_error() const;
351 std::string get_error_string() const;
352
353 /** Get the client error code (e.g. ER_LOAD_BULK_DATA_UNSORTED).
354 @return the client error code. */
355 int get_error_code() const;
356
357 /** @return table name where the data is being loaded. */
358 const char *get_table_name() const {
359 if (m_original_table_name.has_value()) {
360 return m_original_table_name.value().c_str();
361 }
362 return m_table->name.m_name;
363 }
364
365 /** @return index name where the data is being loaded. */
366 const char *get_index_name() const { return m_index->name(); }
367
368 private:
369 /** Ensure that dict_sys->row_id is greater than max rowid used in bulk
370 load of this table.
371 @param[in] max_rowid max rowid used in this table. */
372 void set_sys_max_rowid(uint64_t max_rowid);
373
374 /** Merge the sub-trees to build the cluster index.
375 @return innodb error code. */
377
378 /** Calculate the flush queue size to be used based on the available memory.
379 @param[in] memory total buffer pool memory to use
380 @param[out] flush_queue_size calculated queue size
381 @param[out] allocate_in_pages true if need to allocate in pages
382 false if need to allocate in extents */
383 void get_queue_size(size_t memory, size_t &flush_queue_size,
384 bool &allocate_in_pages) const;
385
386 private:
387 /** Number of threads for bulk loading. */
388 const size_t m_num_threads{};
389
390 const size_t m_keynr{};
391
392 /** All thread specific data. */
394
395 /** Sub-tree loading contexts. */
397
398 /** Innodb dictionary table object. */
400
401 /** Index being loaded. Could be primary or secondary index. */
403
404 /** Allocator to extend tablespace and allocate extents. */
406
407 const trx_t *const m_trx{};
408
409 /** Flush queue size used by the Bulk_flusher */
411
412 std::mutex m_gcol_mutex;
413
414 std::optional<std::string> m_original_table_name;
415};
416
417inline std::string Loader::get_error_string() const {
418 std::string error;
419 for (auto &thr : m_ctxs) {
420 if (thr.get_error() != DB_SUCCESS) {
421 error = thr.get_error_string();
422 break;
423 }
424 }
425 return error;
426}
427
428inline int Loader::get_error_code() const {
429 int errcode = 0;
430 for (auto &thr : m_ctxs) {
431 errcode = thr.get_error_code();
432 if (errcode != 0) {
433 break;
434 }
435 }
436 return errcode;
437}
438
441 for (auto &thr : m_ctxs) {
442 e = thr.get_error();
443 if (e != DB_SUCCESS) {
444 break;
445 }
446 }
447 return e;
448}
449
450} // namespace ddl_bulk
void ib_tuple_delete(ib_tpl_t ib_tpl)
Destroy an InnoDB tuple.
Definition: api0api.cc:2325
ib_err_t ib_cursor_close(ib_crsr_t ib_crsr)
Close an InnoDB table and free the cursor.
Definition: api0api.cc:956
ib_err_t ib_cursor_read_row(ib_crsr_t ib_crsr, ib_tpl_t ib_tpl, ib_tpl_t cmp_tpl, int mode, void **row_buf, uint64_t *slot, uint64_t *used_len)
Read current row.
Definition: api0api.cc:1576
ib_err_t ib_cursor_next(ib_crsr_t ib_crsr)
Move cursor to the next user record in the table.
Definition: api0api.cc:1684
InnoDB Native API.
enum dberr_t ib_err_t
All InnoDB error codes are represented by ib_err_t.
Definition: api0api.h:56
@ IB_CUR_L
If search key is not found then position the cursor on the row that is less than the search key.
Definition: api0api.h:226
Multi Threaded Index Build (MTIB) using BUF_BLOCK_MEMORY and dedicated Bulk_flusher threads.
Services for bulk data conversion and load to SE.
void * Blob_context
Definition: bulk_data_service.h:53
Definition: btr0mtib.h:901
dberr_t open_blob(Blob_context &blob_ctx, lob::ref_t &ref)
Create a blob.
Definition: btr0mtib.h:918
dberr_t close_blob(Blob_context blob_ctx, lob::ref_t &ref)
Indicate that the blob has been completed, so that resources can be removed, and as necessary flushin...
Definition: btr0mtib.h:938
dberr_t write_blob(Blob_context blob_ctx, lob::ref_t &ref, const byte *data, size_t len)
Write data into the blob.
Definition: btr0mtib.h:928
Definition: btr0mtib.h:481
Implements the row and column memory management for parse and load operations.
Definition: bulk_data_service.h:305
Definition: ddl0bulk.h:51
trx_t * m_trx
Definition: ddl0bulk.h:110
bool m_initialized
Definition: ddl0bulk.h:103
ib_tpl_t m_cmp_tuple
Definition: ddl0bulk.h:113
std::string m_table_name
Definition: ddl0bulk.h:104
Table_reader(Table_reader &&other)=default
bool more_records_available() const
Definition: ddl0bulk.h:59
const row_prebuilt_t * m_prebuilt
Definition: ddl0bulk.h:105
bool init(const std::string &schema, const std::string &table, const row_prebuilt_t *prebuilt, const std::optional< Rows_mysql > &lower_bound, const std::optional< Rows_mysql > &upper_bound)
Definition: ddl0bulk.cc:1278
bool is_initialized() const
Definition: ddl0bulk.h:58
void next()
Definition: ddl0bulk.h:65
std::vector< std::unique_ptr< char[]> > m_upper_bound_data
Definition: ddl0bulk.h:109
std::vector< std::unique_ptr< char[]> > m_lower_bound_data
Definition: ddl0bulk.h:107
bool m_more_records_available
Definition: ddl0bulk.h:102
ib_crsr_t m_table_cursor
Definition: ddl0bulk.h:111
std::optional< Rows_mysql > m_lower_bound
Definition: ddl0bulk.h:106
ib_crsr_t m_read_cursor
Definition: ddl0bulk.h:112
ib_tpl_t read()
Definition: ddl0bulk.h:61
std::optional< Rows_mysql > m_upper_bound
Definition: ddl0bulk.h:108
unsigned char m_cmp_tuple_row_id_data[DATA_ROW_ID_LEN]
Definition: ddl0bulk.h:114
~Table_reader()
Definition: ddl0bulk.h:80
ib_tpl_t m_read_tuple
Definition: ddl0bulk.h:115
Definition: ddl0bulk.h:118
bool set_source_table_data(const row_prebuilt_t *prebuilt, const Bulk_load::Source_table_data &source_table)
Definition: ddl0bulk.cc:195
Table_reader m_table_reader
Definition: ddl0bulk.h:272
std::list< Btree_multi::Btree_load * > m_list_subtrees
Each subtree needs to have a disjoint set of keys.
Definition: ddl0bulk.h:209
std::ostringstream m_sout
Definition: ddl0bulk.h:268
Btree_multi::Btree_load * get_subtree()
Get the last subtree created by this thread.
Definition: ddl0bulk.h:192
void free()
Free thread specific data.
Definition: ddl0bulk.cc:685
dberr_t m_err
Error code at thread level.
Definition: ddl0bulk.h:264
dtuple_t * m_input_entry
Tuple for inserting row to index.
Definition: ddl0bulk.h:245
dberr_t write_blob(Btree_multi::Btree_load *sub_tree, Blob_context blob_ctx, lob::ref_t &ref, const byte *data, size_t len)
Write data into the blob.
Definition: ddl0bulk.h:159
void insert_from_input_and_move_to_next(const row_prebuilt_t *prebuilt, const Rows_mysql &rows, size_t &row_index, Btree_multi::Btree_load *sub_tree, mem_heap_t *gcol_heap, bool &gcol_blobs_flushed)
Definition: ddl0bulk.cc:411
dtuple_t * m_error_entry
Contains the tuple we detected an error, either m_original_table_entry or m_input_entry.
Definition: ddl0bulk.h:252
void read_input_entry(const Rows_mysql &rows, size_t &row_index, const row_prebuilt_t *prebuilt, mem_heap_t *gcol_heap, bool &gcol_blobs_flushed)
Definition: ddl0bulk.cc:370
dberr_t open_blob(Btree_multi::Btree_load *sub_tree, Blob_context &blob_ctx, lob::ref_t &ref)
Create a blob.
Definition: ddl0bulk.h:147
std::string get_error_string() const
Definition: ddl0bulk.h:179
unsigned char m_rowid_data[DATA_ROW_ID_LEN]
Column data for system column DATA_ROW_ID.
Definition: ddl0bulk.h:261
int get_error_code() const
Get the client error code (eg.
Definition: ddl0bulk.h:183
bool m_more_available_in_original_table
Definition: ddl0bulk.h:274
void insert_from_original_table_and_move_to_next(const row_prebuilt_t *prebuilt, Btree_multi::Btree_load *sub_tree)
Definition: ddl0bulk.cc:431
mem_heap_t * m_heap
Heap for allocating tuple memory.
Definition: ddl0bulk.h:237
dtuple_t * m_input_row
Tuple for converting input data to table row.
Definition: ddl0bulk.h:240
dtuple_t * m_original_table_entry
Tuple for inserting row to index.
Definition: ddl0bulk.h:248
size_t m_nth_index
Definition: ddl0bulk.h:270
dberr_t close_blob(Btree_multi::Btree_load *sub_tree, Blob_context blob_ctx, lob::ref_t &ref)
Indicate that the blob has been completed, so that resources can be removed, and as necessary flushin...
Definition: ddl0bulk.h:170
int m_errcode
Definition: ddl0bulk.h:266
unsigned char m_rollptr_data[DATA_ROLL_PTR_LEN]
Column data for system column Roll pointer.
Definition: ddl0bulk.h:258
bool m_more_available_in_input
Definition: ddl0bulk.h:273
void add_subtree(Btree_multi::Btree_load *subtree)
Add given subtree to the list of subtrees.
Definition: ddl0bulk.h:187
std::optional< std::string > m_original_table_name
Definition: ddl0bulk.h:275
Btree_multi::Btree_load * get_subtree(Blob_context ctx) const
Definition: ddl0bulk.h:194
dtuple_t * m_table_row
Definition: ddl0bulk.h:242
dberr_t load(const row_prebuilt_t *prebuilt, Btree_multi::Btree_load *sub_tree, const Rows_mysql &rows, Bulk_load::Stat_callbacks &wait_cbk)
Load rows to a sub-tree for a specific thread.
Definition: ddl0bulk.cc:463
void read_table_entry(const row_prebuilt_t *prebuilt)
Definition: ddl0bulk.cc:392
dberr_t copy_existing_data(const row_prebuilt_t *prebuilt, Btree_multi::Btree_load *sub_tree, Bulk_load::Stat_callbacks &wait_cbk)
Definition: ddl0bulk.cc:608
void insert_smaller_entry(const row_prebuilt_t *prebuilt, Btree_multi::Btree_load *sub_tree, const Rows_mysql &rows, size_t &row_index, const ddl::Compare_key &compare_key, mem_heap_t *gcol_heap, bool &gcol_blobs_flushed)
Definition: ddl0bulk.cc:442
uint64_t m_last_rowid
The last DB_ROW_ID used by this thread.
Definition: ddl0bulk.h:212
void init(const row_prebuilt_t *prebuilt)
Initialize thread specific data.
Definition: ddl0bulk.cc:155
dberr_t get_error() const
Definition: ddl0bulk.h:178
size_t m_queue_size
Flush queue size used by the Bulk_flusher.
Definition: ddl0bulk.h:204
unsigned char m_trx_data[DATA_TRX_ID_LEN]
Column data for system column transaction ID.
Definition: ddl0bulk.h:255
Definition: ddl0bulk.h:46
std::mutex m_gcol_mutex
Definition: ddl0bulk.h:412
std::vector< Btree_multi::Btree_load *, ut::allocator< Btree_multi::Btree_load * > > Btree_loads
Definition: ddl0bulk.h:347
Btree_loads m_sub_tree_loads
Sub-tree loading contexts.
Definition: ddl0bulk.h:396
void get_queue_size(size_t memory, size_t &flush_queue_size, bool &allocate_in_pages) const
Calculate the flush queue size to be used based on the available memory.
Definition: ddl0bulk.cc:204
Loader(size_t num_threads, size_t keynr, const trx_t *trx)
Loader context constructor.
Definition: ddl0bulk.h:282
dict_index_t * m_index
Index being loaded.
Definition: ddl0bulk.h:402
const char * get_index_name() const
Definition: ddl0bulk.h:366
const trx_t *const m_trx
Definition: ddl0bulk.h:407
dberr_t begin(const row_prebuilt_t *prebuilt, size_t data_size, size_t memory)
Prepare bulk loading by multiple threads.
Definition: ddl0bulk.cc:228
std::optional< std::string > m_original_table_name
Definition: ddl0bulk.h:414
Btree_multi::Bulk_extent_allocator m_extent_allocator
Allocator to extend tablespace and allocate extents.
Definition: ddl0bulk.h:405
dberr_t load(const row_prebuilt_t *prebuilt, size_t thread_index, const Rows_mysql &rows, Bulk_load::Stat_callbacks &wait_cbk)
Load rows to a sub-tree by a thread.
Definition: ddl0bulk.cc:266
const char * get_table_name() const
Definition: ddl0bulk.h:358
int get_error_code() const
Get the client error code (e.g.
Definition: ddl0bulk.h:428
size_t m_queue_size
Flush queue size used by the Bulk_flusher.
Definition: ddl0bulk.h:410
size_t get_keynr() const
Definition: ddl0bulk.h:311
dict_table_t * m_table
Innodb dictionary table object.
Definition: ddl0bulk.h:399
dberr_t merge_subtrees()
Merge the sub-trees to build the cluster index.
Definition: ddl0bulk.cc:1270
bool set_source_table_data(const row_prebuilt_t *prebuilt, const std::vector< Bulk_load::Source_table_data > &source_table_data)
Definition: ddl0bulk.cc:291
dberr_t end(bool is_error)
Finish bulk load operation, combining the sub-trees produced by concurrent threads.
Definition: ddl0bulk.cc:694
void * Blob_context
Definition: ddl0bulk.h:48
dberr_t get_error() const
Definition: ddl0bulk.h:439
std::string get_error_string() const
Definition: ddl0bulk.h:417
dberr_t close_blob(size_t thread_index, Blob_context blob_ctx, lob::ref_t &ref)
Indicate that the blob has been completed, so that resources can be removed, and as necessary flushin...
Definition: ddl0bulk.cc:324
dberr_t copy_existing_data(const row_prebuilt_t *prebuilt, size_t thread_index, Bulk_load::Stat_callbacks &wait_cbk)
Definition: ddl0bulk.cc:281
void set_sys_max_rowid(uint64_t max_rowid)
Ensure that dict_sys->row_id is greater than max rowid used in bulk load of this table.
Definition: ddl0bulk.cc:750
dberr_t write_blob(size_t thread_index, Blob_context blob_ctx, lob::ref_t &ref, const byte *data, size_t len)
Write data into the blob.
Definition: ddl0bulk.cc:315
std::vector< Thread_data, ut::allocator< Thread_data > > Thread_ctxs
Definition: ddl0bulk.h:348
Thread_ctxs m_ctxs
All thread specific data.
Definition: ddl0bulk.h:393
dberr_t open_blob(size_t thread_index, Blob_context &blob_ctx, lob::ref_t &ref)
Open a blob.
Definition: ddl0bulk.cc:306
const size_t m_num_threads
Number of threads for bulk loading.
Definition: ddl0bulk.h:388
const size_t m_keynr
Definition: ddl0bulk.h:390
Allocator that allows std::* containers to manage their memory through ut::malloc* and ut::free libra...
Definition: ut0new.h:2183
Data types.
constexpr size_t DATA_ROLL_PTR_LEN
Rollback data pointer type size in bytes.
Definition: data0type.h:191
constexpr size_t DATA_TRX_ID_LEN
Transaction ID type size in bytes.
Definition: data0type.h:185
constexpr uint32_t DATA_ROW_ID_LEN
stored length for row id
Definition: data0type.h:179
Global error codes for the database.
dberr_t
Definition: db0err.h:39
@ DB_SUCCESS
Definition: db0err.h:43
Data dictionary global types.
The memory management.
void error(const char *format,...)
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
Definition: ddl0bulk.cc:57
Container::const_iterator find_if(const Container &c, Find_if &&find_if)
Definition: generic.h:54
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:924
Definition: aligned_atomic.h:44
ValueType max(X &&first)
Definition: gtid.h:103
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2876
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2880
Interface between Innobase row operations and MySQL.
Definition: bulk_data_service.h:876
Callbacks for collecting time statistics.
Definition: bulk_data_service.h:866
Compare the keys of an index.
Definition: ddl0impl-compare.h:41
Data structure for an index.
Definition: dict0mem.h:1067
id_name_t name
index name
Definition: dict0mem.h:1075
bool is_clustered() const
Definition: dict0mem.h:1314
Data structure for a database table.
Definition: dict0mem.h:1925
table_name_t name
Table name.
Definition: dict0mem.h:2000
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
Cursor instance for traversing tables/indexes.
Definition: api0api.cc:127
InnoDB tuple used for key operations.
Definition: api0api.cc:203
The struct 'lob::ref_t' represents an external field reference.
Definition: lob0lob.h:198
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:515
dict_index_t * index
current index for a search, if any
Definition: row0mysql.h:523
char * m_name
The name in internal representation.
Definition: dict0mem.h:468
Definition: trx0trx.h:675
void trx_free_for_background(trx_t *trx)
Free a transaction that was allocated by background or user threads.
Definition: trx0trx.cc:595
void trx_commit(trx_t *trx)
Commits a transaction.
Definition: trx0trx.cc:2229
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105