MySQL 26.7.0
Source Code Documentation
ha_innopart.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2014, 2026, 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/* The InnoDB Partition handler: the interface between MySQL and InnoDB. */
29
30#ifndef ha_innopart_h
31#define ha_innopart_h
32
33#include <stddef.h>
34#include <sys/types.h>
35
36#include "ha_innodb.h"
37#include "my_compiler.h"
38#include "my_inttypes.h"
40#include "row0mysql.h"
41#include "ut0bitset.h"
42
43/* Forward declarations */
45class partition_info;
46
47/* Error Text */
48static constexpr auto PARTITION_IN_SHARED_TABLESPACE =
49 "InnoDB : A partitioned table"
50 " is not allowed in a shared tablespace.";
51
52/** HA_DUPLICATE_POS and HA_READ_BEFORE_WRITE_REMOVAL is not
53set from ha_innobase, but cannot yet be supported in ha_innopart.
54Full text and geometry is not yet supported. */
58
60
61/** InnoDB partition specific Handler_share. */
63 private:
64 /** Array of all included table definitions (one per partition). */
66
67 /** Instead of INNOBASE_SHARE::idx_trans_tbl. Maps MySQL index number
68 to InnoDB index per partition. */
70
71 /** Total number of partitions. */
73
74 /** Number of indexes. */
76
77 /** Reference count. */
79
80 /** Pointer back to owning TABLE_SHARE. */
82
83 public:
84 Ha_innopart_share(TABLE_SHARE *table_share);
85
86 ~Ha_innopart_share() override;
87
88 /** Set innodb table for given partition.
89 @param[in] part_id Partition number.
90 @param[in] table Table. */
91 inline void set_table_part(uint part_id, dict_table_t *table) {
92 ut_ad(m_table_parts != nullptr);
93 ut_ad(part_id < m_tot_parts);
94 m_table_parts[part_id] = table;
95 }
96 /** Get table reference for given partition.
97 @param[in] part_id Partition number
98 @return InnoDB table reference. */
99 inline dict_table_t **get_table_part_ref(uint part_id) {
100 return (&m_table_parts[part_id]);
101 }
102
103 /** Return innodb table for given partition.
104 @param[in] part_id Partition number.
105 @return InnoDB table. */
106 inline dict_table_t *get_table_part(uint part_id) const {
107 ut_ad(m_table_parts != nullptr);
108 ut_ad(part_id < m_tot_parts);
109 return (m_table_parts[part_id]);
110 }
111
112 /** Return innodb index for given partition and key number.
113 @param[in] part_id Partition number.
114 @param[in] keynr Key number.
115 @return InnoDB index. */
116 dict_index_t *get_index(uint part_id, uint keynr);
117
118 /** Get MySQL key number corresponding to InnoDB index.
119 Calculates the key number used inside MySQL for an Innobase index. We will
120 first check the "index translation table" for a match of the index to get
121 the index number. If there does not exist an "index translation table",
122 or not able to find the index in the translation table, then we will fall back
123 to the traditional way of looping through dict_index_t list to find a
124 match. In this case, we have to take into account if we generated a
125 default clustered index for the table
126 @param[in] part_id Partition the index belongs to.
127 @param[in] index Index to return MySQL key number for.
128 @return the key number used inside MySQL or UINT_MAX if key is not
129 found. */
130 uint get_mysql_key(uint part_id, const dict_index_t *index);
131
132 /** Return whether share has opened InnoDB tables for partitions. */
133 bool has_table_parts() const { return (m_table_parts != nullptr); }
134
135 /** Increment share and InnoDB tables reference counters. */
137
138 /** Open InnoDB tables for partitions and return them as array.
139 @param[in,out] thd Thread context
140 @param[in] table MySQL table definition
141 @param[in] dd_table Global DD table object
142 @param[in] part_info Partition info (partition names to use)
143 @param[in] table_name Table name (db/table_name)
144 @return Array on InnoDB tables on success else nullptr. */
145 static dict_table_t **open_table_parts(THD *thd, const TABLE *table,
146 const dd::Table *dd_table,
147 partition_info *part_info,
148 const char *table_name);
149
150 /** Initialize the share with table and indexes per partition.
151 @param[in] part_info Partition info (partition names to use).
152 @param[in] table_parts Array of InnoDB tables for partitions.
153 @return false on success else true. */
155 dict_table_t **table_parts);
156
157 /** Close the table partitions.
158 If all instances are closed, also release the resources.*/
159 void close_table_parts();
160
161 /** Close InnoDB tables for partitions.
162 @param[in] table_parts Array of InnoDB tables for partitions.
163 @param[in] tot_parts Number of partitions. */
164 static void close_table_parts(dict_table_t **table_parts, uint tot_parts);
165
166 /** @return the TABLE SHARE object */
167 const TABLE_SHARE *get_table_share() const { return (m_table_share); }
168
169 /** Get the number of partitions
170 @return number of partitions */
171 uint get_num_parts() const {
172 ut_ad(m_tot_parts != 0);
173 return (m_tot_parts);
174 }
175
176 /** Set up the virtual column template for partition table, and points
177 all m_table_parts[]->vc_templ to it.
178 @param[in] table MySQL TABLE object
179 @param[in] ib_table InnoDB dict_table_t
180 @param[in] name Table name (db/table_name) */
181 void set_v_templ(TABLE *table, dict_table_t *ib_table, const char *name);
182
183 private:
184 /** Disable default constructor. */
185 Ha_innopart_share() = default;
186
187 /** Open one partition
188 @param[in,out] client Data dictionary client
189 @param[in] thd Thread THD
190 @param[in] table MySQL table definition
191 @param[in] dd_part dd::Partition
192 @param[in] part_name Table name of this partition
193 @param[out] part_dict_table InnoDB table for partition
194 @retval false On success
195 @retval true On failure */
197 THD *thd, const TABLE *table,
198 const dd::Partition *dd_part,
199 const char *part_name,
200 dict_table_t **part_dict_table);
201};
202
203/** Get explicit specified tablespace for one (sub)partition, checking
204from lowest level
205@param[in] tablespace table-level tablespace if specified
206@param[in] part Partition to check
207@param[in] sub_part Sub-partition to check, if no, just NULL
208@return Tablespace name, if nullptr or [0] = '\0' then nothing specified */
209const char *partition_get_tablespace(const char *tablespace,
210 const partition_element *part,
211 const partition_element *sub_part);
212
213/** The class defining a partitioning aware handle to an InnoDB table.
214Based on ha_innobase and extended with
215- Partition_helper for re-using common partitioning functionality
216- Partition_handler for providing partitioning specific api calls.
217Generic partitioning functions are implemented in Partition_helper.
218Lower level storage functions are implemented in ha_innobase.
219Partition_handler is inherited for implementing the handler level interface
220for partitioning specific functions, like truncate_partition.
221InnoDB specific functions related to partitioning is implemented here. */
223 public Partition_helper,
224 public Partition_handler {
225 public:
226 ha_innopart(handlerton *hton, TABLE_SHARE *table_arg);
227
228 ~ha_innopart() override = default;
229
230 /** Clone this handler, used when needing more than one cursor
231 to the same table.
232 @param[in] name Table name.
233 @param[in] mem_root mem_root to allocate from.
234 @retval Pointer to clone or NULL if error. */
235 handler *clone(const char *name, MEM_ROOT *mem_root) override;
236
237 /** \defgroup ONLINE_ALTER_TABLE_INTERFACE On-line ALTER TABLE interface
238 @see handler0alter.cc
239 @{ */
240
241 /** Check if InnoDB supports a particular alter table in-place.
242 @param[in] altered_table TABLE object for new version of table.
243 @param[in,out] ha_alter_info Structure describing changes to be done
244 by ALTER TABLE and holding data used during in-place alter.
245 @retval HA_ALTER_INPLACE_NOT_SUPPORTED Not supported
246 @retval HA_ALTER_INPLACE_NO_LOCK Supported
247 @retval HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE Supported, but
248 requires lock during main phase and exclusive lock during prepare
249 phase.
250 @retval HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE Supported, prepare
251 phase requires exclusive lock. */
253 TABLE *altered_table, Alter_inplace_info *ha_alter_info) override;
254
255 /** Prepare in-place ALTER for table.
256 Allows InnoDB to update internal structures with concurrent
257 writes blocked (provided that check_if_supported_inplace_alter()
258 did not return HA_ALTER_INPLACE_NO_LOCK).
259 This will be invoked before inplace_alter_table().
260 @param[in] altered_table TABLE object for new version of table.
261 @param[in,out] ha_alter_info Structure describing changes to be done
262 by ALTER TABLE and holding data used during in-place alter.
263 @param[in] old_table_def dd::Table object describing old
264 version of the table.
265 @param[in,out] new_table_def dd::Table object for the new version
266 of the table. Can be adjusted by this call. Changes to the table
267 definition will be persisted in the data-dictionary at statement
268 commit time.
269 @retval true Failure.
270 @retval false Success. */
271 bool prepare_inplace_alter_table(TABLE *altered_table,
272 Alter_inplace_info *ha_alter_info,
273 const dd::Table *old_table_def,
274 dd::Table *new_table_def) override;
275
276 /** Alter the table structure in-place.
277 Alter the table structure in-place with operations
278 specified using HA_ALTER_FLAGS and Alter_inplace_information.
279 The level of concurrency allowed during this operation depends
280 on the return value from check_if_supported_inplace_alter().
281 @param[in] altered_table TABLE object for new version of table.
282 @param[in,out] ha_alter_info Structure describing changes to be done
283 by ALTER TABLE and holding data used during in-place alter.
284 @param[in] old_table_def dd::Table object describing old
285 version of the table.
286 @param[in,out] new_table_def dd::Table object for the new version
287 of the table. Can be adjusted by this call. Changes to the table
288 definition will be persisted in the data-dictionary at statement
289 commit time.
290 @retval true Failure.
291 @retval false Success. */
292 bool inplace_alter_table(TABLE *altered_table,
293 Alter_inplace_info *ha_alter_info,
294 const dd::Table *old_table_def,
295 dd::Table *new_table_def) override;
296
297 /** Commit or rollback.
298 Commit or rollback the changes made during
299 prepare_inplace_alter_table() and inplace_alter_table() inside
300 the storage engine. Note that the allowed level of concurrency
301 during this operation will be the same as for
302 inplace_alter_table() and thus might be higher than during
303 prepare_inplace_alter_table(). (E.g concurrent writes were
304 blocked during prepare, but might not be during commit).
305 @param[in] altered_table TABLE object for new version of table.
306 @param[in,out] ha_alter_info Structure describing changes to be done
307 by ALTER TABLE and holding data used during
308 in-place alter.
309 @param[in] commit true => Commit, false => Rollback.
310 @param[in] old_table_def dd::Table object describing old
311 version of the table.
312 @param[in,out] new_table_def dd::Table object for the new version
313 of the table. Can be adjusted by this call. Changes to the table
314 definition will be persisted in the data-dictionary at statement
315 commit time.
316 @retval true Failure.
317 @retval false Success. */
318 bool commit_inplace_alter_table(TABLE *altered_table,
319 Alter_inplace_info *ha_alter_info,
320 bool commit, const dd::Table *old_table_def,
321 dd::Table *new_table_def) override;
322 /** @} */
323
324 /** Allows InnoDB to update internal structures with concurrent
325 writes blocked (given that check_if_supported_inplace_alter()
326 did not return HA_ALTER_INPLACE_NO_LOCK).
327 This is for 'ALTER TABLE ... PARTITION' and a corresponding function
328 to inplace_alter_table().
329 This will be invoked before inplace_alter_partition().
330
331 @param[in,out] altered_table TABLE object for new version of table
332 @param[in,out] ha_alter_info Structure describing changes to be done
333 by ALTER TABLE and holding data used during
334 in-place alter.
335 @param[in] old_dd_tab Table definition before the ALTER
336 @param[in,out] new_dd_tab Table definition after the ALTER
337 @retval true Failure
338 @retval false Success */
339 bool prepare_inplace_alter_partition(TABLE *altered_table,
340 Alter_inplace_info *ha_alter_info,
341 const dd::Table *old_dd_tab,
342 dd::Table *new_dd_tab);
343
344 /** Alter the table structure in-place with operations
345 specified using HA_ALTER_FLAGS and Alter_inplace_information.
346 This is for 'ALTER TABLE ... PARTITION' and a corresponding function
347 to inplace_alter_table().
348 The level of concurrency allowed during this operation depends
349 on the return value from check_if_supported_inplace_alter().
350
351 @param[in,out] ha_alter_info Structure describing changes to be done
352 by ALTER TABLE and holding data used
353 during in-place alter.
354 @retval true Failure
355 @retval false Success */
356 bool inplace_alter_partition(Alter_inplace_info *ha_alter_info);
357
358 /** Prepare to commit or roll back ALTER TABLE...ALGORITHM=INPLACE.
359 This is for 'ALTER TABLE ... PARTITION' and a corresponding function
360 to commit_inplace_alter_table().
361 @param[in,out] altered_table TABLE object for new version of table.
362 @param[in,out] ha_alter_info ALGORITHM=INPLACE metadata
363 @param[in] commit true=Commit, false=Rollback.
364 @param[in] old_dd_tab old table
365 @param[in,out] new_dd_tab new table
366 @retval true on failure (my_error() will have been called)
367 @retval false on success */
368 bool commit_inplace_alter_partition(TABLE *altered_table,
369 Alter_inplace_info *ha_alter_info,
370 bool commit, const dd::Table *old_dd_tab,
371 dd::Table *new_dd_tab);
372
373 // TODO: should we implement init_table_handle_for_HANDLER() ?
374 // (or is sql_stat_start handled correctly anyway?)
375 /** Optimize table.
376 This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds
377 the table in MySQL.
378 @param[in] thd Connection thread handle.
379 @param[in] check_opt Currently ignored.
380 @return 0 for success else error code. */
381 int optimize(THD *thd, HA_CHECK_OPT *check_opt) override;
382
383 /** Set DD discard attribute for tablespace.
384 @param[in] table_def dd table
385 @param[in] discard True if this table is discarded
386 @return 0 or error number. */
387 int set_dd_discard_attribute(dd::Table *table_def, bool discard);
388
389 int discard_or_import_tablespace(bool discard, dd::Table *table_def) override;
390
391 /** Compare key and rowid.
392 Helper function for sorting records in the priority queue.
393 a/b points to table->record[0] rows which must have the
394 key fields set. The bytes before a and b store the rowid.
395 This is used for comparing/sorting rows first according to
396 KEY and if same KEY, by rowid (ref).
397
398 @param[in] key_info Null terminated array of index
399 information.
400 @param[in] a Pointer to record+ref in first record.
401 @param[in] b Pointer to record+ref in second record.
402 @return Return value is SIGN(first_rec - second_rec)
403 @retval 0 Keys are equal.
404 @retval -1 second_rec is greater than first_rec.
405 @retval +1 first_rec is greater than second_rec. */
406 static int key_and_rowid_cmp(KEY **key_info, uchar *a, uchar *b);
407
408 int extra(enum ha_extra_function operation) override;
409
410 void print_error(int error, myf errflag) override;
411
412 bool is_ignorable_error(int error) override;
413
414 int start_stmt(THD *thd, thr_lock_type lock_type) override;
415
416 ha_rows records_in_range(uint inx, key_range *min_key,
417 key_range *max_key) override;
418
420
422
423 void update_create_info(HA_CREATE_INFO *create_info) override;
424
425 int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info,
426 dd::Table *table_def) override;
427
428 /** Drop a table.
429 @param[in] name table name
430 @param[in,out] dd_table data dictionary table
431 @return error number
432 @retval 0 on success */
433 int delete_table(const char *name, const dd::Table *dd_table) override;
434
435 /** Rename a table.
436 @param[in] from table name before rename
437 @param[in] to table name after rename
438 @param[in] from_table data dictionary table before rename
439 @param[in,out] to_table data dictionary table after rename
440 @return error number
441 @retval 0 on success */
442 int rename_table(const char *from, const char *to,
443 const dd::Table *from_table, dd::Table *to_table) override;
444
445 int check(THD *thd, HA_CHECK_OPT *check_opt) override;
446
447 /** Repair a partitioned table.
448 Only repairs records in wrong partitions (moves them to the correct
449 partition or deletes them if not in any partition).
450 @param[in] thd MySQL THD object/thread handle.
451 @param[in] repair_opt Repair options.
452 @return 0 or error code. */
453 int repair(THD *thd, HA_CHECK_OPT *repair_opt) override;
454
455 /** Get the current auto_increment value.
456 @param[in] offset Table auto-inc offset.
457 @param[in] increment Table auto-inc increment.
458 @param[in] nb_desired_values Number of required values.
459 @param[out] first_value The auto increment value.
460 @param[out] nb_reserved_values Number of reserved values. */
461 void get_auto_increment(ulonglong offset, ulonglong increment,
462 ulonglong nb_desired_values, ulonglong *first_value,
463 ulonglong *nb_reserved_values) override;
464
465 /* Get partition row type
466 @param[in] partition_table partition table
467 @param[in] part_id Id of partition for which row type to be retrieved
468 @return Partition row type. */
469 enum row_type get_partition_row_type(const dd::Table *partition_table,
470 uint part_id) override;
471
472 int cmp_ref(const uchar *ref1, const uchar *ref2) const override;
473
474 int bulk_load_end(THD *thd, void *load_ctx, bool is_error) override;
475
476 int read_range_first(const key_range *start_key, const key_range *end_key,
477 bool eq_range_arg, bool sorted) override {
478 return (Partition_helper::ph_read_range_first(start_key, end_key,
479 eq_range_arg, sorted));
480 }
481
482 void position(const uchar *record) override {
484 }
485
486 /* TODO: Implement these! */
488 uint table_changes
489 [[maybe_unused]]) override {
490 ut_d(ut_error);
491 ut_o(return (COMPATIBLE_DATA_NO));
492 }
493
494 int delete_all_rows() override { return (handler::delete_all_rows()); }
495
496 int disable_indexes(uint mode [[maybe_unused]]) override {
497 return (HA_ERR_WRONG_COMMAND);
498 }
499
500 int enable_indexes(uint mode [[maybe_unused]]) override {
501 return (HA_ERR_WRONG_COMMAND);
502 }
503
504 int ft_init() override {
505 ut_d(ut_error);
506 ut_o(return (HA_ERR_WRONG_COMMAND));
507 }
508
509 FT_INFO *ft_init_ext(uint flags [[maybe_unused]], uint inx [[maybe_unused]],
510 String *key [[maybe_unused]]) override {
511 ut_d(ut_error);
512 ut_o(return (nullptr));
513 }
514
515 FT_INFO *ft_init_ext_with_hints(uint inx [[maybe_unused]],
516 String *key [[maybe_unused]],
517 Ft_hints *hints [[maybe_unused]]) override {
518 ut_d(ut_error);
519 ut_o(return (nullptr));
520 }
521
522 int ft_read(uchar *buf [[maybe_unused]]) override {
523 ut_d(ut_error);
524 ut_o(return (HA_ERR_WRONG_COMMAND));
525 }
526
527 bool get_foreign_dup_key(char *child_table_name [[maybe_unused]],
528 uint child_table_name_len [[maybe_unused]],
529 char *child_key_name [[maybe_unused]],
530 uint child_key_name_len [[maybe_unused]]) override {
531 ut_d(ut_error);
532 ut_o(return (false));
533 }
534
535 int read_range_next() override {
537 }
538
539 uint32_t calculate_key_hash_value(Field **field_array) override {
541 }
542
543 Table_flags table_flags() const override {
545 }
546
547 void release_auto_increment() override {
549 }
550
551 /** Implementing Partition_handler interface @see partition_handler.h
552 @{ */
553
554 /** See Partition_handler. */
556 ha_checksum *check_sum,
557 uint part_id) override {
559 part_id);
560 }
561
562 uint alter_flags(uint flags [[maybe_unused]]) const override {
564 }
565
567 return (static_cast<Partition_handler *>(this));
568 }
569
570 void set_part_info(partition_info *part_info, bool early) override {
571 Partition_helper::set_part_info_low(part_info, early);
572 }
573
574 void initialize_partitioning(partition_info *part_info, bool early) {
575 Partition_helper::set_part_info_low(part_info, early);
576 }
577
578 handler *get_handler() override { return (static_cast<handler *>(this)); }
579 /** @} */
580
581 /** Get number of threads that would be spawned for parallel read.
582 @param[out] scan_ctx A scan context created by this method
583 that has to be used in
584 parallel_scan
585 @param[out] num_threads Number of threads to be spawned
586 @param[in] use_reserved_threads true if reserved threads are to be used
587 if we exhaust the max cap of number of
588 parallel read threads that can be
589 spawned at a time
590 @param[in] max_desired_threads Maximum number of desired read threads;
591 passing 0 has no effect, it is ignored;
592 upper-limited by the current value of
593 innodb_parallel_read_threads.
594 @return error code
595 @return 0 on success */
596 int parallel_scan_init(void *&scan_ctx, size_t *num_threads,
597 bool use_reserved_threads,
598 size_t max_desired_threads) override;
599
601
602 /** Start parallel read of data.
603 @param[in] scan_ctx Scan context created by parallel_scan_init
604 @param[in] thread_ctxs context for each of the spawned threads
605 @param[in] init_fn callback called by each parallel load
606 thread at the beginning of the parallel load.
607 @param[in] load_fn callback called by each parallel load
608 thread when processing of rows is required.
609 @param[in] end_fn callback called by each parallel load
610 thread when processing of rows has ended.
611 @return error code
612 @return 0 on success */
613 int parallel_scan(void *scan_ctx, void **thread_ctxs, Reader::Init_fn init_fn,
614 Reader::Load_fn load_fn, Reader::End_fn end_fn) override;
615 /** Run the parallel read of data.
616 @param[in] parallel_scan_ctx a scan context created by
617 parallel_scan_init
618 */
619 void parallel_scan_end(void *parallel_scan_ctx) override;
620
621 private:
622 /** Pointer to Ha_innopart_share on the TABLE_SHARE. */
624
626 /** saved m_prebuilt->ins_node */
628
629 /** saved m_prebuilt->upd_node */
631
632 /** saved m_prebuilt->blob_heap */
634
635 /** saved m_prebuilt->trx_id (which in turn reflects table->def_trx_id) */
637
638 /** saved m_prebuilt->row_read_type */
640
641 /** save m_prebuilt->new_rec_lock[] values */
643 };
644 /* Per partition information storing last values of m_prebuilt when we've last
645 finished using given partition, so we can restore it when we return to it.
646 Synchronized with m_prebuilt when changing partitions:
647 set_partition(part_id) copies to m_prebuilt from m_parts[part_id]
648 update_partition(part_id) copies to m_parts[part_id] from m_prebuilt
649
650 NOTE: these are not the only fields synchronized with m_prebuilt.
651 */
653
654 /** byte array for sql_stat_start bitset */
655 byte *m_bitset;
656
657 /** sql_stat_start per partition. */
659
660 /** persistent cursors per partition. */
662
663 /** persistent cluster cursors per partition. */
665
666 /** map from part_id to offset in above two arrays. */
667 uint16_t *m_pcur_map;
668
669 /** Original m_prebuilt->pcur. */
671
672 /** Original m_prebuilt->clust_pcur. */
674
675 /** New partitions during ADD/REORG/... PARTITION. */
677
678 /** Can reuse the template for the previous partition. */
680
681 /** Clear used ins_nodes and upd_nodes. */
682 void clear_ins_upd_nodes();
683
684 /** Clear the blob heaps for all partitions */
685 void clear_blob_heaps();
686
687 /** Reset state of file to after 'open'. This function is called
688 after every statement for all tables used by that statement. */
689 int reset() override;
690
691 /** Changes the active index of a handle.
692 @param[in] part_id Use this partition.
693 @param[in] keynr Use this index; MAX_KEY means always clustered index,
694 even if it was internally generated by InnoDB.
695 @return 0 or error number. */
696 int change_active_index(uint part_id, uint keynr);
697
698 /** Move to next partition and set its index.
699 @return 0 for success else error number. */
701
702 /** Internally called for initializing auto increment value.
703 Should never be called, but defined to catch such errors.
704 @return 0 on success else error code. */
706
707 /** Get the index for the current partition
708 @param[in] keynr MySQL index number.
709 @return InnoDB index or NULL. */
710 dict_index_t *innobase_get_index(uint keynr) override;
711
712 /** Get the index for a handle.
713 Does not change active index.
714 @param[in] keynr Use this index; MAX_KEY means always clustered index,
715 even if it was internally generated by InnoDB.
716 @param[in] part_id From this partition.
717 @return NULL or index instance. */
718 dict_index_t *innopart_get_index(uint part_id, uint keynr);
719
720 /** Change active partition.
721 Copies needed info into m_prebuilt from the partition specific memory.
722 @param[in] part_id Partition to set as active. */
723 void set_partition(uint part_id);
724
725 /** Update active partition.
726 Copies needed info from m_prebuilt into the partition specific memory.
727 @param[in] part_id Partition to set as active. */
728 void update_partition(uint part_id);
729
730 /** TRUNCATE an InnoDB partitioned table.
731 @param[in] name table name
732 @param[in] form table definition
733 @param[in,out] table_def dd::Table describing table to be
734 truncated. Can be adjusted by SE, the changes will be saved into
735 the data-dictionary at statement commit time.
736 @return error number
737 @retval 0 on success */
738 int truncate_impl(const char *name, TABLE *form, dd::Table *table_def);
739
740 /** @defgroup PARTITION_HANDLER_HELPERS Helpers needed by Partition_helper
741 @see partition_handler.h
742 @{ */
743
744 /** Set the autoinc column max value.
745 This should only be called once from ha_innobase::open().
746 Therefore there's no need for a covering lock.
747 @param[in] no_lock If locking should be skipped. Not used!
748 @return 0 for success or error code. */
749 int initialize_auto_increment(bool no_lock) override;
750
751 /** Save currently highest auto increment value.
752 @param[in] nr Auto increment value to save. */
753 void save_auto_increment(ulonglong nr) override;
754
755 /** Setup the ordered record buffer and the priority queue.
756 @param[in] used_parts Number of used partitions in query.
757 @return false for success, else true. */
758 int init_record_priority_queue_for_parts(uint used_parts) override;
759
760 /** Destroy the ordered record buffer and the priority queue. */
762
763 /** Create the Altered_partitoins object
764 @param[in] ha_alter_info thd DDL operation
765 @retval true On failure
766 @retval false On success */
768
769 /** write row to new partition.
770 @param[in] new_part New partition to write to.
771 @return 0 for success else error code. */
772 int write_row_in_new_part(uint new_part) override;
773
774 /** Write a row in specific partition.
775 Stores a row in an InnoDB database, to the table specified in this
776 handle.
777 @param[in] part_id Partition to write to.
778 @param[in] record A row in MySQL format.
779 @return error code. */
780 int write_row_in_part(uint part_id, uchar *record) override;
781
782 /** Update a row in partition.
783 Updates a row given as a parameter to a new value.
784 @param[in] part_id Partition to update row in.
785 @param[in] old_row Old row in MySQL format.
786 @param[in] new_row New row in MySQL format.
787 @return 0 or error number. */
788 int update_row_in_part(uint part_id, const uchar *old_row,
789 uchar *new_row) override;
790
791 /** Deletes a row in partition.
792 @param[in] part_id Partition to delete from.
793 @param[in] record Row to delete in MySQL format.
794 @return 0 or error number. */
795 int delete_row_in_part(uint part_id, const uchar *record) override;
796
797 /** Return first record in index from a partition.
798 @param[in] part Partition to read from.
799 @param[out] record First record in index in the partition.
800 @return error number or 0. */
801 int index_first_in_part(uint part, uchar *record) override;
802
803 /** Return last record in index from a partition.
804 @param[in] part Partition to read from.
805 @param[out] record Last record in index in the partition.
806 @return error number or 0. */
807 int index_last_in_part(uint part, uchar *record) override;
808
809 /** Return previous record in index from a partition.
810 @param[in] part Partition to read from.
811 @param[out] record Last record in index in the partition.
812 @return error number or 0. */
813 int index_prev_in_part(uint part, uchar *record) override;
814
815 /** Return next record in index from a partition.
816 @param[in] part Partition to read from.
817 @param[out] record Last record in index in the partition.
818 @return error number or 0. */
819 int index_next_in_part(uint part, uchar *record) override;
820
821 /** Return next same record in index from a partition.
822 This routine is used to read the next record, but only if the key is
823 the same as supplied in the call.
824 @param[in] part Partition to read from.
825 @param[out] record Last record in index in the partition.
826 @param[in] key Key to match.
827 @param[in] length Length of key.
828 @return error number or 0. */
829 int index_next_same_in_part(uint part, uchar *record, const uchar *key,
830 uint length) override;
831
832 /** Start index scan and return first record from a partition.
833 This routine starts an index scan using a start key. The calling
834 function will check the end key on its own.
835 @param[in] part Partition to read from.
836 @param[out] record First matching record in index in the partition.
837 @param[in] key Key to match.
838 @param[in] keypart_map Which part of the key to use.
839 @param[in] find_flag Key condition/direction to use.
840 @return error number or 0. */
841 int index_read_map_in_part(uint part, uchar *record, const uchar *key,
842 key_part_map keypart_map,
843 enum ha_rkey_function find_flag) override;
844
845 /** Return last matching record in index from a partition.
846 @param[in] part Partition to read from.
847 @param[out] record Last matching record in index in the partition.
848 @param[in] key Key to match.
849 @param[in] keypart_map Which part of the key to use.
850 @return error number or 0. */
851 int index_read_last_map_in_part(uint part, uchar *record, const uchar *key,
852 key_part_map keypart_map) override;
853
854 /** Start index scan and return first record from a partition.
855 This routine starts an index scan using a start and end key.
856 @param[in] part Partition to read from.
857 @param[in,out] record First matching record in index in the
858 partition, if NULL use table->record[0] as return buffer.
859 @param[in] start_key Start key to match.
860 @param[in] end_key End key to match.
861 @param[in] sorted Return rows in sorted order.
862 @return error number or 0. */
863 int read_range_first_in_part(uint part, uchar *record,
864 const key_range *start_key,
865 const key_range *end_key, bool sorted) override;
866
867 /** Return next record in index range scan from a partition.
868 @param[in] part Partition to read from.
869 @param[in,out] record First matching record in index in the partition,
870 if NULL use table->record[0] as return buffer.
871 @return error number or 0. */
872 int read_range_next_in_part(uint part, uchar *record) override;
873
874 /** Start index scan and return first record from a partition.
875 This routine starts an index scan using a start key. The calling
876 function will check the end key on its own.
877 @param[in] part Partition to read from.
878 @param[out] record First matching record in index in the partition.
879 @param[in] index Index to read from.
880 @param[in] key Key to match.
881 @param[in] keypart_map Which part of the key to use.
882 @param[in] find_flag Key condition/direction to use.
883 @return error number or 0. */
884 int index_read_idx_map_in_part(uint part, uchar *record, uint index,
885 const uchar *key, key_part_map keypart_map,
886 enum ha_rkey_function find_flag) override;
887
888 /** Initialize sampling.
889 @param[out] scan_ctx A scan context created by this method that has to be
890 used in sample_next
891 @param[in] sampling_percentage percentage of records that need to be
892 sampled
893 @param[in] sampling_seed random seed that the random generator will
894 use
895 @param[in] sampling_method sampling method to be used; currently only
896 SYSTEM sampling is supported
897 @param[in] tablesample true if the sampling is for tablesample
898 @return 0 for success, else one of the HA_xxx values in case of error. */
899 int sample_init(void *&scan_ctx, double sampling_percentage,
900 int sampling_seed, enum_sampling_method sampling_method,
901 const bool tablesample) override;
902
903 /** Get the next record for sampling.
904 @param[in] scan_ctx Scan context of the sampling
905 @param[in] buf buffer to place the read record
906 @return 0 for success, else one of the HA_xxx values in case of error. */
907 int sample_next(void *scan_ctx, uchar *buf) override;
908
909 /** End sampling.
910 @param[in] scan_ctx Scan context of the sampling
911 @return 0 for success, else one of the HA_xxx values in case of error. */
912 int sample_end(void *scan_ctx) override;
913
914 /** Initialize random read/scan of a specific partition.
915 @param[in] part_id Partition to initialize.
916 @param[in] scan True for scan else random access.
917 @return error number or 0. */
918 int rnd_init_in_part(uint part_id, bool scan) override;
919
920 /** Get next row during scan of a specific partition.
921 Also used to read the FIRST row in a table scan.
922 @param[in] part_id Partition to read from.
923 @param[out] buf Next row.
924 @return error number or 0. */
925 int rnd_next_in_part(uint part_id, uchar *buf) override;
926
927 /** End random read/scan of a specific partition.
928 @param[in] part_id Partition to end random read/scan.
929 @param[in] scan True for scan else random access.
930 @return error number or 0. */
931 int rnd_end_in_part(uint part_id, bool scan) override;
932
933 /** Return position for cursor in last used partition.
934 Stores a reference to the current row to 'ref' field of the handle. Note
935 that in the case where we have generated the clustered index for the
936 table, the function parameter is illogical: we MUST ASSUME that 'record'
937 is the current 'position' of the handle, because if row ref is actually
938 the row id internally generated in InnoDB, then 'record' does not contain
939 it. We just guess that the row id must be for the record where the handle
940 was positioned the last time.
941 @param[out] ref_arg Pointer to buffer where to write the position.
942 @param[in] record Record to position for. */
943 void position_in_last_part(uchar *ref_arg, const uchar *record) override;
944
945 /** Read row using position using given record to find.
946 This works as position()+rnd_pos() functions, but does some
947 extra work,calculating m_last_part - the partition to where
948 the 'record' should go.
949 Only useful when position is based on primary key
950 (HA_PRIMARY_KEY_REQUIRED_FOR_POSITION).
951 @param[in] record Current record in MySQL Row Format.
952 @return 0 for success else error code. */
953 int rnd_pos_by_record(uchar *record) override;
954
955 /** Copy a cached MySQL row.
956 If requested, also avoids overwriting non-read columns.
957 @param[out] buf Row in MySQL format.
958 @param[in] cached_row Which row to copy. */
959 void copy_cached_row(uchar *buf, const uchar *cached_row) override;
960 /** @} */
961
962 /** @defgroup PRIVATE_HANDLER InnoDB Partitioning Private Handler
963 Functions specific for native InnoDB partitioning.
964 @see handler.h
965 @{ */
966
967 /** Open an InnoDB table.
968 @param[in] name table name
969 @param[in] mode access mode
970 @param[in] test_if_locked test if the file to be opened is locked
971 @param[in] table_def dd::Table describing table to be opened
972 @retval 1 if error
973 @retval 0 if success */
974 int open(const char *name, int mode, uint test_if_locked,
975 const dd::Table *table_def) override;
976
977 int close() override;
978
979 double scan_time() override;
980
981 /** Was the last returned row semi consistent read.
982 In an UPDATE or DELETE, if the row under the cursor was locked by
983 another transaction, and the engine used an optimistic read of the last
984 committed row value under the cursor, then the engine returns 1 from
985 this function. MySQL must NOT try to update this optimistic value. If
986 the optimistic value does not match the WHERE condition, MySQL can
987 decide to skip over this row. This can be used to avoid unnecessary
988 lock waits.
989
990 If this method returns true, it will also signal the storage
991 engine that the next read will be a locking re-read of the row.
992 @see handler.h and row0mysql.h
993 @return true if last read was semi consistent else false. */
994 bool was_semi_consistent_read() override;
995
996 /** Try semi consistent read.
997 Tell the engine whether it should avoid unnecessary lock waits.
998 If yes, in an UPDATE or DELETE, if the row under the cursor was locked
999 by another transaction, the engine may try an optimistic read of
1000 the last committed row value under the cursor.
1001 @see handler.h and row0mysql.h
1002 @param[in] yes Should semi-consistent read be used. */
1003 void try_semi_consistent_read(bool yes) override;
1004
1005 /** Removes a lock on a row.
1006 Removes a new lock set on a row, if it was not read optimistically.
1007 This can be called after a row has been read in the processing of
1008 an UPDATE or a DELETE query. @see ha_innobase::unlock_row(). */
1009 void unlock_row() override;
1010
1011 int index_init(uint index, bool sorted) override;
1012
1013 int index_end() override;
1014
1015 int rnd_init(bool scan) override {
1016 return (Partition_helper::ph_rnd_init(scan));
1017 }
1018
1019 int rnd_end() override { return (Partition_helper::ph_rnd_end()); }
1020
1021 int external_lock(THD *thd, int lock_type) override;
1022
1024 thr_lock_type lock_type) override;
1025
1026 int write_row(uchar *record) override {
1027 bool entered = false;
1028 auto trx = m_prebuilt->trx;
1029
1030 /* Enter innodb to order Auto INC partition lock after Innodb. No need to
1031 enter if there are tickets left. Currently we cannot handle re-enter
1032 without exit if no more tickets left.
1033
1034 1. We avoid consuming the last ticket as there could be another enter
1035 call from innobase.
1036
1037 2. If we enter innodb here, there is at least one more ticket left as
1038 the minimum value for "innodb_concurrency_tickets" is 1 */
1039
1040 if (!trx->declared_to_be_inside_innodb) {
1041 auto err = srv_concurrency_enter();
1042 if (err != 0) {
1043 return (err);
1044 }
1045 entered = true;
1046 }
1047
1049
1050 if (entered) {
1052 }
1053
1054 return (err);
1055 }
1056
1057 int update_row(const uchar *old_record, uchar *new_record) override {
1058 return (Partition_helper::ph_update_row(old_record, new_record));
1059 }
1060
1061 int delete_row(const uchar *record) override {
1063 }
1064 /** @} */
1065
1066 /** Delete all rows in the requested partitions.
1067 Done by deleting the partitions and recreate them again.
1068 @param[in,out] dd_table dd::Table object for partitioned table
1069 which partitions need to be truncated. Can be adjusted by this call.
1070 Changes to the table definition will be persisted in the data-dictionary
1071 at statement commit time.
1072 @return 0 or error number. */
1073 int truncate_partition_low(dd::Table *dd_table) override;
1074
1075 /** Exchange partition.
1076 Low-level primitive which implementation is provided here.
1077 @param[in] part_id The id of the partition to be exchanged
1078 @param[in] part_table partitioned table to be exchanged
1079 @param[in] swap_table table to be exchanged
1080 @return error number
1081 @retval 0 on success */
1082 int exchange_partition_low(uint part_id, dd::Table *part_table,
1083 dd::Table *swap_table) override;
1084
1085 /** Access methods to protected areas in handler to avoid adding
1086 friend class Partition_helper in class handler.
1087 @see partition_handler.h
1088 @{ */
1089
1090 THD *get_thd() const override { return ha_thd(); }
1091
1092 TABLE *get_table() const override { return table; }
1093
1094 bool get_eq_range() const override { return eq_range; }
1095
1096 void set_eq_range(bool eq_range_arg) override { eq_range = eq_range_arg; }
1097
1098 void set_range_key_part(KEY_PART_INFO *key_part) override {
1099 range_key_part = key_part;
1100 }
1101 /** @} */
1102
1103 /** Fill in data_dir_path and tablespace name from internal data
1104 dictionary.
1105 @param[in,out] part_elem Partition element to fill.
1106 @param[in] ib_table InnoDB table to copy from.
1107 @param[in] display_tablespace Display tablespace name if
1108 set. */
1109 void update_part_elem(partition_element *part_elem, dict_table_t *ib_table,
1110 bool display_tablespace);
1111
1112 protected:
1113 /** Protected handler:: functions specific for native InnoDB partitioning.
1114 @see handler.h
1115 @{ */
1116
1117 int rnd_next(uchar *record) override {
1119 }
1120
1121 int rnd_pos(uchar *record, uchar *pos) override;
1122
1123 int records(ha_rows *num_rows) override;
1124
1125 int index_next(uchar *record) override {
1127 }
1128
1129 int index_next_same(uchar *record, const uchar *, uint keylen) override {
1131 }
1132
1133 int index_prev(uchar *record) override {
1135 }
1136
1137 int index_first(uchar *record) override {
1139 }
1140
1141 int index_last(uchar *record) override {
1143 }
1144
1146 key_part_map keypart_map) override {
1147 return (Partition_helper::ph_index_read_last_map(record, key, keypart_map));
1148 }
1149
1150 int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
1151 enum ha_rkey_function find_flag) override {
1152 return (
1153 Partition_helper::ph_index_read_map(buf, key, keypart_map, find_flag));
1154 }
1155
1157 key_part_map keypart_map,
1158 enum ha_rkey_function find_flag) override {
1160 keypart_map, find_flag));
1161 }
1162 /** @} */
1163
1164 /** Updates and return statistics.
1165 Returns statistics information of the table to the MySQL interpreter,
1166 in various fields of the handle object.
1167 @param[in] flag Flags for what to update and return.
1168 HA_STATUS_NO_LOCK is supported only for:
1169 ha_statistics::delete_length
1170 it is not supported for others like:
1171 ha_statistics::records
1172 But it will not lock for the duration of stats
1173 calculation. Only during copy to make sure
1174 stats are consistent.
1175 @param[in] is_analyze True if called from "::analyze()".
1176 @return HA_ERR_* error code or 0. */
1177 int info_low(uint flag, bool is_analyze) override;
1178
1179 bool can_reuse_mysql_template() const override {
1181 }
1182 void info_low_table_stats(const dict_table_t *ib_table,
1183 ulint &stat_clustered_index_size,
1184 ulint &stat_sum_of_other_index_sizes,
1185 uint64_t &stat_n_rows) const;
1186 void info_low_rec_per_key(const dict_table_t *ib_table, uint64_t max_rows,
1187 uint biggest_partition);
1188};
1189#endif /* ha_innopart_h */
Class describing changes to be done by ALTER TABLE.
Definition: handler.h:3525
Helper class for encapsulating new/altered partitions during ADD(HASH/KEY)/COALESCE/REORGANIZE PARTIT...
Definition: handler0alter.cc:8072
A simple bitset wrapper class, which lets you access an existing range of bytes (not owned by it!...
Definition: ut0bitset.h:55
Definition: field.h:573
Wrapper for struct ft_hints.
Definition: handler.h:4307
InnoDB partition specific Handler_share.
Definition: ha_innopart.h:62
dict_table_t * get_table_part(uint part_id) const
Return innodb table for given partition.
Definition: ha_innopart.h:106
uint m_index_count
Number of indexes.
Definition: ha_innopart.h:75
uint get_num_parts() const
Get the number of partitions.
Definition: ha_innopart.h:171
uint m_ref_count
Reference count.
Definition: ha_innopart.h:78
void close_table_parts()
Close the table partitions.
Definition: ha_innopart.cc:453
~Ha_innopart_share() override
Definition: ha_innopart.cc:100
void increment_ref_counts()
Increment share and InnoDB tables reference counters.
Definition: ha_innopart.cc:236
dict_table_t ** m_table_parts
Array of all included table definitions (one per partition).
Definition: ha_innopart.h:65
uint m_tot_parts
Total number of partitions.
Definition: ha_innopart.h:72
void set_table_part(uint part_id, dict_table_t *table)
Set innodb table for given partition.
Definition: ha_innopart.h:91
Ha_innopart_share()=default
Disable default constructor.
const TABLE_SHARE * get_table_share() const
Definition: ha_innopart.h:167
dict_index_t * get_index(uint part_id, uint keynr)
Return innodb index for given partition and key number.
Definition: ha_innopart.cc:499
static dict_table_t ** open_table_parts(THD *thd, const TABLE *table, const dd::Table *dd_table, partition_info *part_info, const char *table_name)
Open InnoDB tables for partitions and return them as array.
Definition: ha_innopart.cc:266
bool set_table_parts_and_indexes(partition_info *part_info, dict_table_t **table_parts)
Initialize the share with table and indexes per partition.
Definition: ha_innopart.cc:317
static bool open_one_table_part(dd::cache::Dictionary_client *client, THD *thd, const TABLE *table, const dd::Partition *dd_part, const char *part_name, dict_table_t **part_dict_table)
Open one partition.
Definition: ha_innopart.cc:133
bool has_table_parts() const
Return whether share has opened InnoDB tables for partitions.
Definition: ha_innopart.h:133
dict_index_t ** m_index_mapping
Instead of INNOBASE_SHARE::idx_trans_tbl.
Definition: ha_innopart.h:69
uint get_mysql_key(uint part_id, const dict_index_t *index)
Get MySQL key number corresponding to InnoDB index.
Definition: ha_innopart.cc:528
void set_v_templ(TABLE *table, dict_table_t *ib_table, const char *name)
Set up the virtual column template for partition table, and points all m_table_parts[]->vc_templ to i...
Definition: ha_innopart.cc:211
TABLE_SHARE * m_table_share
Pointer back to owning TABLE_SHARE.
Definition: ha_innopart.h:81
dict_table_t ** get_table_part_ref(uint part_id)
Get table reference for given partition.
Definition: ha_innopart.h:99
Definition: key.h:57
Definition: key.h:113
Traverse an index in the leaf page block list order and send records to adapter.
Definition: row0pread-adapter.h:43
handler::Load_init_cbk Init_fn
Definition: row0pread-adapter.h:55
handler::Load_end_cbk End_fn
Definition: row0pread-adapter.h:53
handler::Load_cbk Load_fn
Definition: row0pread-adapter.h:51
Class for partitioning specific operations.
Definition: partition_handler.h:194
Partition_helper is a helper class that implements most generic partitioning functionality such as: t...
Definition: partition_handler.h:390
int ph_index_first(uchar *buf)
Start an index scan from leftmost record and return first record.
Definition: partition_handler.cc:1973
int ph_index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
Read one record in an index scan and start an index scan.
Definition: partition_handler.cc:1898
int ph_index_prev(uchar *buf)
Read next record when performing index scan backwards.
Definition: partition_handler.cc:2194
int ph_update_row(const uchar *old_data, uchar *new_data)
Update an existing row in the partitioned table.
Definition: partition_handler.cc:558
int ph_write_row(uchar *buf)
INSERT/UPDATE/DELETE functions.
Definition: partition_handler.cc:453
int ph_rnd_init(bool scan)
MODULE full table scan.
Definition: partition_handler.cc:1490
int ph_index_next_same(uchar *buf, uint keylen)
Read next same record.
Definition: partition_handler.cc:2172
int ph_index_last(uchar *buf)
Start an index scan from rightmost record and return first record.
Definition: partition_handler.cc:1996
int ph_rnd_next(uchar *buf)
Read next row during full table scan (scan in random row order).
Definition: partition_handler.cc:1598
int ph_read_range_next()
Read next record in read of a range with start and end key.
Definition: partition_handler.cc:2259
virtual void set_part_info_low(partition_info *part_info, bool early)
Set partition info.
Definition: partition_handler.cc:369
static uint32 ph_calculate_key_hash_value(Field **field_array)
Calculate key hash value from an null terminated array of fields.
Definition: partition_handler.cc:803
void ph_position(const uchar *record)
Save position of current row.
Definition: partition_handler.cc:1666
int ph_rnd_end()
End of a table scan.
Definition: partition_handler.cc:1551
int ph_index_read_idx_map(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag)
Read index by key and keymap.
Definition: partition_handler.cc:2080
int ph_index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map)
Read last using key.
Definition: partition_handler.cc:2048
void ph_release_auto_increment()
Release unused auto increment values.
Definition: partition_handler.cc:767
int ph_index_next(uchar *buf)
Read next record in a forward index scan.
Definition: partition_handler.cc:2141
int ph_read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range_arg, bool sorted)
Start a read of one range with start and end key.
Definition: partition_handler.cc:2221
int ph_delete_row(const uchar *buf)
Delete an existing row in the partitioned table.
Definition: partition_handler.cc:644
virtual void get_dynamic_partition_info_low(ha_statistics *stat_info, ha_checksum *check_sum, uint part_id)
Functions matching Partition_handler API.
Definition: partition_handler.cc:2929
Partition specific Handler_share.
Definition: partition_handler.h:104
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: partition.h:51
Definition: table.h:47
Definition: dictionary_client.h:166
The class defining a handle to an InnoDB table.
Definition: ha_innodb.h:94
Table_flags table_flags() const override
Get the table flags to use for the statement.
Definition: ha_innodb.cc:6610
void srv_concurrency_exit()
Leave Innodb, if no more tickets are left.
Definition: ha_innodb.cc:2968
row_prebuilt_t * m_prebuilt
Save CPU time with prebuilt/cached data structures.
Definition: ha_innodb.h:778
int srv_concurrency_enter()
Enter InnoDB engine after checking max allowed threads.
Definition: ha_innodb.cc:2961
int info(uint) override
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle...
Definition: ha_innodb.cc:17811
The class defining a partitioning aware handle to an InnoDB table.
Definition: ha_innopart.h:224
bool inplace_alter_partition(Alter_inplace_info *ha_alter_info)
Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_i...
Definition: handler0alter.cc:10778
void update_part_elem(partition_element *part_elem, dict_table_t *ib_table, bool display_tablespace)
Fill in data_dir_path and tablespace name from internal data dictionary.
Definition: ha_innopart.cc:2231
void set_range_key_part(KEY_PART_INFO *key_part) override
Definition: ha_innopart.h:1098
int rnd_next(uchar *record) override
Protected handler:: functions specific for native InnoDB partitioning.
Definition: ha_innopart.h:1117
Sql_stat_start_parts m_sql_stat_start_parts
sql_stat_start per partition.
Definition: ha_innopart.h:658
Altered_partitions * m_new_partitions
New partitions during ADD/REORG/... PARTITION.
Definition: ha_innopart.h:676
~ha_innopart() override=default
FT_INFO * ft_init_ext(uint flags, uint inx, String *key) override
Initialize FT index scan.
Definition: ha_innopart.h:509
bool m_reuse_mysql_template
Can reuse the template for the previous partition.
Definition: ha_innopart.h:679
bool can_reuse_mysql_template() const override
Can reuse the template.
Definition: ha_innopart.h:1179
void parallel_scan_end(void *parallel_scan_ctx) override
Run the parallel read of data.
Definition: handler0alter.cc:10121
int check(THD *thd, HA_CHECK_OPT *check_opt) override
Checks a partitioned table.
Definition: ha_innopart.cc:3894
int discard_or_import_tablespace(bool discard, dd::Table *table_def) override
Discards or imports an InnoDB tablespace.
Definition: ha_innopart.cc:2829
int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
Positions an index cursor to the index specified in the handle ('active_index').
Definition: ha_innopart.h:1150
int records(ha_rows *num_rows) override
Total number of rows in all used partitions.
Definition: ha_innopart.cc:3184
void info_low_rec_per_key(const dict_table_t *ib_table, uint64_t max_rows, uint biggest_partition)
Definition: ha_innopart.cc:3821
btr_pcur_t * m_clust_pcur
Original m_prebuilt->clust_pcur.
Definition: ha_innopart.h:673
int index_next_same(uchar *record, const uchar *, uint keylen) override
Reads the next row matching to the key value given as the parameter.
Definition: ha_innopart.h:1129
uint32_t calculate_key_hash_value(Field **field_array) override
Definition: ha_innopart.h:539
int enable_indexes(uint mode) override
Enable indexes.
Definition: ha_innopart.h:500
int innobase_initialize_autoinc()
Internally called for initializing auto increment value.
Definition: ha_innopart.cc:622
void get_dynamic_partition_info(ha_statistics *stat_info, ha_checksum *check_sum, uint part_id) override
Implementing Partition_handler interface.
Definition: ha_innopart.h:555
enum row_type get_partition_row_type(const dd::Table *partition_table, uint part_id) override
Get partition row type from SE.
Definition: ha_innopart.cc:2949
int index_last(uchar *record) override
Positions a cursor on the last record in an index and reads the corresponding row to buf.
Definition: ha_innopart.h:1141
int rename_table(const char *from, const char *to, const dd::Table *from_table, dd::Table *to_table) override
Rename a table.
Definition: ha_innopart.cc:2689
handler * get_handler() override
Return the table handler.
Definition: ha_innopart.h:578
btr_pcur_t * m_pcur_parts
persistent cursors per partition.
Definition: ha_innopart.h:661
void clear_blob_heaps()
Clear the blob heaps for all partitions.
Definition: ha_innopart.cc:4210
int index_read_last_map(uchar *record, const uchar *key, key_part_map keypart_map) override
The following functions works like index_read, but it find the last row with the current key value or...
Definition: ha_innopart.h:1145
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) override
Estimates the number of index records in a range.
Definition: ha_innopart.cc:3283
static int key_and_rowid_cmp(KEY **key_info, uchar *a, uchar *b)
Compare key and rowid.
Definition: ha_innopart.cc:2886
uint alter_flags(uint flags) const override
Alter flags.
Definition: ha_innopart.h:562
handler * clone(const char *name, MEM_ROOT *mem_root) override
Clone this handler, used when needing more than one cursor to the same table.
Definition: ha_innopart.cc:1155
int delete_table(const char *name, const dd::Table *dd_table) override
Drop a table.
Definition: ha_innopart.cc:2622
bool commit_inplace_alter_partition(TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_dd_tab, dd::Table *new_dd_tab)
Prepare to commit or roll back ALTER TABLE...ALGORITHM=INPLACE.
Definition: handler0alter.cc:10826
byte * m_bitset
byte array for sql_stat_start bitset
Definition: ha_innopart.h:655
ha_rows estimate_rows_upper_bound() override
Gives an UPPER BOUND to the number of rows in a table.
Definition: ha_innopart.cc:3402
void set_part_info(partition_info *part_info, bool early) override
Set the partition info object to be used by the handler.
Definition: ha_innopart.h:570
ha_innopart(handlerton *hton, TABLE_SHARE *table_arg)
Construct ha_innopart handler.
Definition: ha_innopart.cc:600
int change_active_index(uint part_id, uint keynr)
Changes the active index of a handle.
Definition: ha_innopart.cc:1720
TABLE * get_table() const override
Definition: ha_innopart.h:1092
int index_next(uchar *record) override
Reads the next row from a cursor, which must have previously been positioned using index_read.
Definition: ha_innopart.h:1125
bool get_foreign_dup_key(char *child_table_name, uint child_table_name_len, char *child_key_name, uint child_key_name_len) override
Retrieves the names of the table and the key for which there was a duplicate entry in the case of HA_...
Definition: ha_innopart.h:527
void update_partition(uint part_id)
Update active partition.
Definition: ha_innopart.cc:1321
int read_range_next() override
Read next row between two endpoints.
Definition: ha_innopart.h:535
void set_eq_range(bool eq_range_arg) override
Definition: ha_innopart.h:1096
int disable_indexes(uint mode) override
Disable indexes.
Definition: ha_innopart.h:496
int bulk_load_end(THD *thd, void *load_ctx, bool is_error) override
End bulk load operation.
Definition: ha_innopart.cc:4172
bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) override
Part of old, deprecated in-place ALTER API.
Definition: ha_innopart.h:487
void release_auto_increment() override
Do cleanup for auto increment calculation.
Definition: ha_innopart.h:547
Partition_handler * get_partition_handler() override
Definition: ha_innopart.h:566
int info_low(uint flag, bool is_analyze) override
Updates and return statistics.
Definition: ha_innopart.cc:3502
uint16_t * m_pcur_map
map from part_id to offset in above two arrays.
Definition: ha_innopart.h:667
Table_flags table_flags() const override
Get the table flags to use for the statement.
Definition: ha_innopart.h:543
int index_prev(uchar *record) override
Reads the previous row from a cursor, which must have previously been positioned using index_read.
Definition: ha_innopart.h:1133
btr_pcur_t * m_pcur
Original m_prebuilt->pcur.
Definition: ha_innopart.h:670
THD * get_thd() const override
Access methods to protected areas in handler to avoid adding friend class Partition_helper in class h...
Definition: ha_innopart.h:1090
ut::unique_ptr< saved_prebuilt_t[]> m_parts
Definition: ha_innopart.h:652
void clear_ins_upd_nodes()
Clear used ins_nodes and upd_nodes.
Definition: ha_innopart.cc:1172
int start_stmt(THD *thd, thr_lock_type lock_type) override
Start statement.
Definition: ha_innopart.cc:3992
int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range_arg, bool sorted) override
Read first row between two ranges.
Definition: ha_innopart.h:476
FT_INFO * ft_init_ext_with_hints(uint inx, String *key, Ft_hints *hints) override
Initialize FT index scan.
Definition: ha_innopart.h:515
dict_index_t * innopart_get_index(uint part_id, uint keynr)
Get the index for a handle.
Definition: ha_innopart.cc:1672
void initialize_partitioning(partition_info *part_info, bool early)
Definition: ha_innopart.h:574
int cmp_ref(const uchar *ref1, const uchar *ref2) const override
Compares two 'refs'.
Definition: ha_innopart.cc:4157
int index_read_idx_map(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
Positions an index cursor to the index specified in argument.
Definition: ha_innopart.h:1156
void set_partition(uint part_id)
Change active partition.
Definition: ha_innopart.cc:1272
void position(const uchar *record) override
Store a reference to the current row to 'ref' field of the handle.
Definition: ha_innopart.h:482
int optimize(THD *thd, HA_CHECK_OPT *check_opt) override
Optimize table.
Definition: ha_innopart.cc:3882
int parallel_scan(void *scan_ctx, void **thread_ctxs, Reader::Init_fn init_fn, Reader::Load_fn load_fn, Reader::End_fn end_fn) override
Start parallel read of data.
Definition: handler0alter.cc:10110
dict_index_t * innobase_get_index(uint keynr) override
Get the index for the current partition.
Definition: ha_innopart.cc:1657
int truncate_partition_low(dd::Table *dd_table) override
Delete all rows in the requested partitions.
Definition: ha_innopart.cc:3079
void print_error(int error, myf errflag) override
Print error information.
Definition: ha_innopart.cc:1635
void info_low_table_stats(const dict_table_t *ib_table, ulint &stat_clustered_index_size, ulint &stat_sum_of_other_index_sizes, uint64_t &stat_n_rows) const
Definition: ha_innopart.cc:3871
btr_pcur_t * m_clust_pcur_parts
persistent cluster cursors per partition.
Definition: ha_innopart.h:664
int ft_init() override
Initialize FT index scan.
Definition: ha_innopart.h:504
int parallel_scan_init(void *&scan_ctx, size_t *num_threads, bool use_reserved_threads, size_t max_desired_threads) override
Get number of threads that would be spawned for parallel read.
Definition: handler0alter.cc:10034
int exchange_partition_low(uint part_id, dd::Table *part_table, dd::Table *swap_table) override
Exchange partition.
Definition: handler0alter.cc:10931
int reset() override
Reset state of file to after 'open'.
Definition: ha_innopart.cc:4232
int ft_read(uchar *buf) override
Fetch next result from the FT result set.
Definition: ha_innopart.h:522
uint alter_table_flags(uint flags)
int extra(enum ha_extra_function operation) override
Extra hints from MySQL.
Definition: ha_innopart.cc:2901
int delete_all_rows() override
Delete all rows from the table.
Definition: ha_innopart.h:494
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, dd::Table *table_def) override
Creates a new table to an InnoDB database.
Definition: ha_innopart.cc:2404
Ha_innopart_share * m_part_share
Pointer to Ha_innopart_share on the TABLE_SHARE.
Definition: ha_innopart.h:623
bool is_ignorable_error(int error) override
Can error be ignored.
Definition: ha_innopart.cc:1645
int truncate_impl(const char *name, TABLE *form, dd::Table *table_def)
TRUNCATE an InnoDB partitioned table.
Definition: ha_innopart.cc:2986
int next_partition_index()
Move to next partition and set its index.
bool prepare_inplace_alter_partition(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab)
Allows InnoDB to update internal structures with concurrent writes blocked (given that check_if_suppo...
Definition: handler0alter.cc:10747
void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values) override
Get the current auto_increment value.
Definition: ha_innopart.cc:4133
int set_dd_discard_attribute(dd::Table *table_def, bool discard)
Set DD discard attribute for tablespace.
Definition: ha_innopart.cc:2774
int rnd_pos(uchar *record, uchar *pos) override
Get a row from a position.
Definition: ha_innopart.cc:2168
int repair(THD *thd, HA_CHECK_OPT *repair_opt) override
Repair a partitioned table.
Definition: ha_innopart.cc:3939
bool get_eq_range() const override
Definition: ha_innopart.h:1094
void update_create_info(HA_CREATE_INFO *create_info) override
Update create_info.
Definition: ha_innopart.cc:2284
int index_first(uchar *record) override
Positions a cursor on the first record in an index and reads the corresponding row to buf.
Definition: ha_innopart.h:1137
Definition: handler.h:4211
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4753
KEY_PART_INFO * range_key_part
Definition: handler.h:4813
bool eq_range
Definition: handler.h:4814
ulonglong Table_flags
Definition: handler.h:4757
THD * ha_thd() const
Definition: handler.cc:2842
TABLE * table
Definition: handler.h:4762
virtual int delete_all_rows()
Delete all rows in a table.
Definition: handler.h:7215
Definition: partition_element.h:108
Definition: partition_info.h:209
A table definition from the master.
Definition: rpl_utility.h:250
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
bool commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_table_def, dd::Table *new_table_def) override
Commit or rollback.
Definition: handler0alter.cc:10537
bool prepare_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_table_def, dd::Table *new_table_def) override
Prepare in-place ALTER for table.
Definition: handler0alter.cc:10334
bool inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_table_def, dd::Table *new_table_def) override
Alter the table structure in-place.
Definition: handler0alter.cc:10471
enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_info *ha_alter_info) override
Check if InnoDB supports a particular alter table in-place.
Definition: handler0alter.cc:10137
int rnd_next_in_part(uint part_id, uchar *buf) override
Get next row during scan of a specific partition.
Definition: ha_innopart.cc:2139
int update_row_in_part(uint part_id, const uchar *old_row, uchar *new_row) override
Update a row in partition.
Definition: ha_innopart.cc:1450
int rnd_end_in_part(uint part_id, bool scan) override
End random read/scan of a specific partition.
Definition: ha_innopart.cc:2132
void destroy_record_priority_queue_for_parts() override
Destroy the ordered record buffer and the priority queue.
Definition: ha_innopart.cc:1608
void copy_cached_row(uchar *buf, const uchar *cached_row) override
Copy a cached MySQL row.
Definition: ha_innopart.cc:116
int index_last_in_part(uint part, uchar *record) override
Return last record in index from a partition.
Definition: ha_innopart.cc:1844
void position_in_last_part(uchar *ref_arg, const uchar *record) override
Return position for cursor in last used partition.
Definition: ha_innopart.cc:2208
void save_auto_increment(ulonglong nr) override
Save currently highest auto increment value.
Definition: ha_innopart.cc:1364
int sample_init(void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method, const bool tablesample) override
Initialize sampling.
Definition: ha_innopart.cc:2006
int write_row_in_part(uint part_id, uchar *record) override
Write a row in specific partition.
Definition: ha_innopart.cc:1423
int init_record_priority_queue_for_parts(uint used_parts) override
Setup the ordered record buffer and the priority queue.
Definition: ha_innopart.cc:1549
int index_read_map_in_part(uint part, uchar *record, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
Start index scan and return first record from a partition.
Definition: ha_innopart.cc:1880
int sample_next(void *scan_ctx, uchar *buf) override
Get the next record for sampling.
Definition: ha_innopart.cc:2086
int initialize_auto_increment(bool no_lock) override
Set the autoinc column max value.
Definition: ha_innopart.cc:627
int write_row_in_new_part(uint new_part) override
write row to new partition.
Definition: handler0alter.cc:10715
int index_next_same_in_part(uint part, uchar *record, const uchar *key, uint length) override
Return next same record in index from a partition.
Definition: ha_innopart.cc:1830
int index_first_in_part(uint part, uchar *record) override
Return first record in index from a partition.
Definition: ha_innopart.cc:1791
int read_range_next_in_part(uint part, uchar *record) override
Return next record in index range scan from a partition.
Definition: ha_innopart.cc:1972
int delete_row_in_part(uint part_id, const uchar *record) override
Deletes a row in partition.
Definition: ha_innopart.cc:1465
int sample_end(void *scan_ctx) override
End sampling.
Definition: ha_innopart.cc:2103
int rnd_pos_by_record(uchar *record) override
Read row using position using given record to find.
Definition: ha_innopart.cc:4248
bool prepare_for_copy_partitions(Alter_inplace_info *ha_alter_info)
Create the Altered_partitoins object.
Definition: handler0alter.cc:10686
int index_read_idx_map_in_part(uint part, uchar *record, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) override
Start index scan and return first record from a partition.
Definition: ha_innopart.cc:1902
int rnd_init_in_part(uint part_id, bool scan) override
Initialize random read/scan of a specific partition.
Definition: ha_innopart.cc:2114
int read_range_first_in_part(uint part, uchar *record, const key_range *start_key, const key_range *end_key, bool sorted) override
Start index scan and return first record from a partition.
Definition: ha_innopart.cc:1931
int index_prev_in_part(uint part, uchar *record) override
Return previous record in index from a partition.
Definition: ha_innopart.cc:1857
int index_next_in_part(uint part, uchar *record) override
Return next record in index from a partition.
Definition: ha_innopart.cc:1806
int index_read_last_map_in_part(uint part, uchar *record, const uchar *key, key_part_map keypart_map) override
Return last matching record in index from a partition.
Definition: ha_innopart.cc:1921
int close() override
Closes a handle to an InnoDB table.
Definition: ha_innopart.cc:1222
int rnd_init(bool scan) override
Initialize a table scan.
Definition: ha_innopart.h:1015
double scan_time() override
Time estimate for full table scan.
Definition: ha_innopart.cc:3448
int index_end() override
End index cursor.
Definition: ha_innopart.cc:1526
bool was_semi_consistent_read() override
Was the last returned row semi consistent read.
Definition: ha_innopart.cc:1387
int write_row(uchar *record) override
Stores a row in an InnoDB database, to the table specified in this handle.
Definition: ha_innopart.h:1026
int open(const char *name, int mode, uint test_if_locked, const dd::Table *table_def) override
Open an InnoDB table.
Definition: ha_innopart.cc:784
void unlock_row() override
Removes a lock on a row.
Definition: ha_innopart.cc:1410
int index_init(uint index, bool sorted) override
Initializes a handle to use an index.
Definition: ha_innopart.cc:1481
void try_semi_consistent_read(bool yes) override
Try semi consistent read.
Definition: ha_innopart.cc:1398
int update_row(const uchar *old_record, uchar *new_record) override
Updates a row given as a parameter to a new value.
Definition: ha_innopart.h:1057
THR_LOCK_DATA ** store_lock(THD *thd, THR_LOCK_DATA **to, thr_lock_type lock_type) override
Function to store lock for all partitions in native partitioned table.
Definition: ha_innopart.cc:4018
int rnd_end() override
Ends a table scan.
Definition: ha_innopart.h:1019
int external_lock(THD *thd, int lock_type) override
Lock/prepare to lock table.
Definition: ha_innopart.cc:4048
int delete_row(const uchar *record) override
Deletes a row given as the parameter.
Definition: ha_innopart.h:1061
Bitset Sql_stat_start_parts
Definition: ha_innopart.h:59
const handler::Table_flags HA_INNOPART_DISABLED_TABLE_FLAGS
HA_DUPLICATE_POS and HA_READ_BEFORE_WRITE_REMOVAL is not set from ha_innobase, but cannot yet be supp...
Definition: ha_innopart.h:55
static constexpr auto PARTITION_IN_SHARED_TABLESPACE
Definition: ha_innopart.h:48
const char * partition_get_tablespace(const char *tablespace, const partition_element *part, const partition_element *sub_part)
Get explicit specified tablespace for one (sub)partition, checking from lowest level.
Definition: ha_innopart.cc:569
static int flags[50]
Definition: hp_test1.cc:40
static int flag
Definition: hp_test1.cc:40
ha_rkey_function
Definition: my_base.h:78
ulong key_part_map
Definition: my_base.h:1095
my_off_t ha_rows
Definition: my_base.h:1228
ha_extra_function
Definition: my_base.h:185
#define HA_ERR_WRONG_COMMAND
Command not supported.
Definition: my_base.h:928
std::uint32_t ha_checksum
Definition: my_checksum.h:106
Header for compiler-dependent features.
Some integer typedefs for easier portability.
int myf
Definition: my_inttypes.h:94
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
static int record
Definition: mysqltest.cc:195
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:943
const char * table_name
Definition: rules_table_service.cc:56
mode
Definition: file_handle.h:61
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2284
#define HA_INPLACE_CHANGE_PARTITION
Definition: partition_handler.h:77
#define HA_PARTITION_FUNCTION_SUPPORTED
bits in Partition_handler::alter_flags():
Definition: partition_handler.h:76
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Interface between Innobase row operations and MySQL.
#define COMPATIBLE_DATA_NO
Definition: handler.h:854
#define HA_READ_BEFORE_WRITE_REMOVAL
The handler supports read before write removal optimization.
Definition: handler.h:426
#define HA_CAN_REPAIR
Definition: handler.h:384
enum_alter_inplace_result
Return values for check_if_supported_inplace_alter().
Definition: handler.h:207
#define HA_CAN_GEOMETRY
Definition: handler.h:243
#define HA_CAN_FULLTEXT
Definition: handler.h:320
row_type
Definition: handler.h:692
#define HA_DUPLICATE_POS
Definition: handler.h:266
#define HA_CAN_FULLTEXT_EXT
Definition: handler.h:431
enum_sampling_method
Definition: handler.h:723
static bool commit(THD *thd)
Commit the current statement and transaction.
Definition: sql_cmd_srs.cc:152
case opt name
Definition: sslopt-case.h:29
Definition: ft_global.h:72
Definition: handler.h:3966
Struct to hold information about the table that should be created.
Definition: handler.h:3356
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
This structure is shared between different table objects.
Definition: table.h:731
Definition: table.h:1456
Definition: thr_lock.h:124
Definition: btr0pcur.h:99
Data structure for an index.
Definition: dict0mem.h:1069
Data structure for a database table.
Definition: dict0mem.h:1927
Definition: ha_innopart.h:625
ins_node_t * m_ins_node
saved m_prebuilt->ins_node
Definition: ha_innopart.h:627
mem_heap_t * m_blob_heap
saved m_prebuilt->blob_heap
Definition: ha_innopart.h:633
decltype(row_prebuilt_t::new_rec_lock) m_new_rec_lock
save m_prebuilt->new_rec_lock[] values
Definition: ha_innopart.h:642
ulint m_row_read_type
saved m_prebuilt->row_read_type
Definition: ha_innopart.h:639
upd_node_t * m_upd_node
saved m_prebuilt->upd_node
Definition: ha_innopart.h:630
trx_id_t m_trx_id
saved m_prebuilt->trx_id (which in turn reflects table->def_trx_id)
Definition: ha_innopart.h:636
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2852
Definition: row0ins.h:162
Definition: my_base.h:1212
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:295
std::bitset< LOCK_COUNT > new_rec_lock
normally false; if session is using READ COMMITTED or READ UNCOMMITTED isolation level,...
Definition: row0mysql.h:743
trx_t * trx
current transaction handle
Definition: row0mysql.h:525
Definition: row0upd.h:724
thr_lock_type
Definition: thr_lock.h:51
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
unsigned long int ulint
Definition: univ.i:403
Utilities for bitset operations.
#define ut_error
Abort execution.
Definition: ut0dbg.h:105
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109
#define ut_o(EXPR)
Opposite of ut_d().
Definition: ut0dbg.h:113
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:111