MySQL  8.0.19
Source Code Documentation
ha_innopart.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 *****************************************************************************/
26 
27 /* The InnoDB Partition handler: the interface between MySQL and InnoDB. */
28 
29 #ifndef ha_innopart_h
30 #define ha_innopart_h
31 
32 #include <stddef.h>
33 #include <sys/types.h>
34 
35 #include "ha_innodb.h"
37 #include "row0mysql.h"
38 #include "ut0bitset.h"
39 
40 /* Forward declarations */
41 class Altered_partitions;
42 class partition_info;
43 
44 /* Error Text */
45 static constexpr auto PARTITION_IN_SHARED_TABLESPACE =
46  "InnoDB : A partitioned table"
47  " is not allowed in a shared tablespace.";
48 
49 /** HA_DUPLICATE_POS and HA_READ_BEFORE_WRITE_REMOVAL is not
50 set from ha_innobase, but cannot yet be supported in ha_innopart.
51 Full text and geometry is not yet supported. */
55 
57 
58 /** InnoDB partition specific Handler_share. */
60  private:
61  /** Array of all included table definitions (one per partition). */
63 
64  /** Instead of INNOBASE_SHARE::idx_trans_tbl. Maps MySQL index number
65  to InnoDB index per partition. */
67 
68  /** Total number of partitions. */
70 
71  /** Number of indexes. */
73 
74  /** Reference count. */
76 
77  /** Pointer back to owning TABLE_SHARE. */
79 
80  public:
81  Ha_innopart_share(TABLE_SHARE *table_share);
82 
84 
85  /** Set innodb table for given partition.
86  @param[in] part_id Partition number.
87  @param[in] table Table. */
88  inline void set_table_part(uint part_id, dict_table_t *table) {
90  ut_ad(part_id < m_tot_parts);
91  m_table_parts[part_id] = table;
92  }
93  /** Get table reference for given partition.
94  @param[in] part_id Partition number
95  @return InnoDB table reference. */
96  inline dict_table_t **get_table_part_ref(uint part_id) {
97  return (&m_table_parts[part_id]);
98  }
99 
100  /** Return innodb table for given partition.
101  @param[in] part_id Partition number.
102  @return InnoDB table. */
103  inline dict_table_t *get_table_part(uint part_id) const {
105  ut_ad(part_id < m_tot_parts);
106  return (m_table_parts[part_id]);
107  }
108 
109  /** Return innodb index for given partition and key number.
110  @param[in] part_id Partition number.
111  @param[in] keynr Key number.
112  @return InnoDB index. */
113  dict_index_t *get_index(uint part_id, uint keynr);
114 
115  /** Get MySQL key number corresponding to InnoDB index.
116  @param[in] part_id Partition number.
117  @param[in] index InnoDB index.
118  @return MySQL key number or MAX_KEY if non-existent. */
119  uint get_mysql_key(uint part_id, const dict_index_t *index);
120 
121  /** Return whether share has opened InnoDB tables for partitions. */
122  bool has_table_parts() const { return (m_table_parts != nullptr); }
123 
124  /** Increment share and InnoDB tables reference counters. */
125  void increment_ref_counts();
126 
127  /** Open InnoDB tables for partitions and return them as array.
128  @param[in,out] thd Thread context
129  @param[in] table MySQL table definition
130  @param[in] dd_table Global DD table object
131  @param[in] part_info Partition info (partition names to use)
132  @param[in] table_name Table name (db/table_name)
133  @return Array on InnoDB tables on success else nullptr. */
134  static dict_table_t **open_table_parts(THD *thd, const TABLE *table,
135  const dd::Table *dd_table,
136  partition_info *part_info,
137  const char *table_name);
138 
139  /** Initialize the share with table and indexes per partition.
140  @param[in] table MySQL table definition
141  @param[in] part_info Partition info (partition names to use)
142  @param[in] table_parts Array of InnoDB tables for partitions.
143  @return false on success else true. */
144  bool set_table_parts_and_indexes(const TABLE *table,
145  partition_info *part_info,
146  dict_table_t **table_parts);
147 
148  /** Close the table partitions.
149  If all instances are closed, also release the resources.*/
150  void close_table_parts();
151 
152  /** Close InnoDB tables for partitions.
153  @param[in] table_parts Array of InnoDB tables for partitions.
154  @param[in] tot_parts Number of partitions. */
155  static void close_table_parts(dict_table_t **table_parts, uint tot_parts);
156 
157  /** @return the TABLE SHARE object */
158  const TABLE_SHARE *get_table_share() const { return (m_table_share); }
159 
160  /** Get the number of partitions
161  @return number of partitions */
162  uint get_num_parts() const {
163  ut_ad(m_tot_parts != 0);
164  return (m_tot_parts);
165  }
166 
167  /** Set up the virtual column template for partition table, and points
168  all m_table_parts[]->vc_templ to it.
169  @param[in] table MySQL TABLE object
170  @param[in] ib_table InnoDB dict_table_t
171  @param[in] name Table name (db/table_name) */
172  void set_v_templ(TABLE *table, dict_table_t *ib_table, const char *name);
173 
174  private:
175  /** Disable default constructor. */
177 
178  /** Open one partition
179  @param[in,out] client Data dictionary client
180  @param[in] thd Thread THD
181  @param[in] table MySQL table definition
182  @param[in] dd_part dd::Partition
183  @param[in] part_name Table name of this partition
184  @param[out] part_dict_table InnoDB table for partition
185  @retval False On success
186  @retval True On failure */
188  THD *thd, const TABLE *table,
189  const dd::Partition *dd_part,
190  const char *part_name,
191  dict_table_t **part_dict_table);
192 };
193 
194 /** Get explicit specified tablespace for one (sub)partition, checking
195 from lowest level
196 @param[in] tablespace table-level tablespace if specified
197 @param[in] part Partition to check
198 @param[in] sub_part Sub-partition to check, if no, just NULL
199 @return Tablespace name, if nullptr or [0] = '\0' then nothing specified */
200 const char *partition_get_tablespace(const char *tablespace,
201  const partition_element *part,
202  const partition_element *sub_part);
203 
204 /** The class defining a partitioning aware handle to an InnoDB table.
205 Based on ha_innobase and extended with
206 - Partition_helper for re-using common partitioning functionality
207 - Partition_handler for providing partitioning specific api calls.
208 Generic partitioning functions are implemented in Partition_helper.
209 Lower level storage functions are implemented in ha_innobase.
210 Partition_handler is inherited for implementing the handler level interface
211 for partitioning specific functions, like truncate_partition.
212 InnoDB specific functions related to partitioning is implemented here. */
213 class ha_innopart : public ha_innobase,
214  public Partition_helper,
215  public Partition_handler {
216  public:
217  ha_innopart(handlerton *hton, TABLE_SHARE *table_arg);
218 
219  ~ha_innopart() override;
220 
221  /** Clone this handler, used when needing more than one cursor
222  to the same table.
223  @param[in] name Table name.
224  @param[in] mem_root mem_root to allocate from.
225  @retval Pointer to clone or NULL if error. */
226  handler *clone(const char *name, MEM_ROOT *mem_root) override;
227 
228  /** On-line ALTER TABLE interface @see handler0alter.cc @{ */
229 
230  /** Check if InnoDB supports a particular alter table in-place.
231  @param[in] altered_table TABLE object for new version of table.
232  @param[in,out] ha_alter_info Structure describing changes to be done
233  by ALTER TABLE and holding data used during in-place alter.
234  @retval HA_ALTER_INPLACE_NOT_SUPPORTED Not supported
235  @retval HA_ALTER_INPLACE_NO_LOCK Supported
236  @retval HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE Supported, but
237  requires lock during main phase and exclusive lock during prepare
238  phase.
239  @retval HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE Supported, prepare
240  phase requires exclusive lock. */
242  TABLE *altered_table, Alter_inplace_info *ha_alter_info) override;
243 
244  /** Prepare in-place ALTER for table.
245  Allows InnoDB to update internal structures with concurrent
246  writes blocked (provided that check_if_supported_inplace_alter()
247  did not return HA_ALTER_INPLACE_NO_LOCK).
248  This will be invoked before inplace_alter_table().
249  @param[in] altered_table TABLE object for new version of table.
250  @param[in,out] ha_alter_info Structure describing changes to be done
251  by ALTER TABLE and holding data used during in-place alter.
252  @param[in] old_table_def dd::Table object describing old
253  version of the table.
254  @param[in,out] new_table_def dd::Table object for the new version
255  of the table. Can be adjusted by this call. Changes to the table
256  definition will be persisted in the data-dictionary at statement
257  commit time.
258  @retval true Failure.
259  @retval false Success. */
260  bool prepare_inplace_alter_table(TABLE *altered_table,
261  Alter_inplace_info *ha_alter_info,
262  const dd::Table *old_table_def,
263  dd::Table *new_table_def) override;
264 
265  /** Alter the table structure in-place.
266  Alter the table structure in-place with operations
267  specified using HA_ALTER_FLAGS and Alter_inplace_information.
268  The level of concurrency allowed during this operation depends
269  on the return value from check_if_supported_inplace_alter().
270  @param[in] altered_table TABLE object for new version of table.
271  @param[in,out] ha_alter_info Structure describing changes to be done
272  by ALTER TABLE and holding data used during in-place alter.
273  @param[in] old_table_def dd::Table object describing old
274  version of the table.
275  @param[in,out] new_table_def dd::Table object for the new version
276  of the table. Can be adjusted by this call. Changes to the table
277  definition will be persisted in the data-dictionary at statement
278  commit time.
279  @retval true Failure.
280  @retval false Success. */
281  bool inplace_alter_table(TABLE *altered_table,
282  Alter_inplace_info *ha_alter_info,
283  const dd::Table *old_table_def,
284  dd::Table *new_table_def) override;
285 
286  /** Commit or rollback.
287  Commit or rollback the changes made during
288  prepare_inplace_alter_table() and inplace_alter_table() inside
289  the storage engine. Note that the allowed level of concurrency
290  during this operation will be the same as for
291  inplace_alter_table() and thus might be higher than during
292  prepare_inplace_alter_table(). (E.g concurrent writes were
293  blocked during prepare, but might not be during commit).
294  @param[in] altered_table TABLE object for new version of table.
295  @param[in,out] ha_alter_info Structure describing changes to be done
296  by ALTER TABLE and holding data used
297  during in-place alter.
298  @param[in] commit true => Commit, false => Rollback.
299  @param[in] old_table_def dd::Table object describing old
300  version of the table.
301  @param[in,out] new_table_def dd::Table object for the new version
302  of the table. Can be adjusted by this call. Changes to the table
303  definition will be persisted in the data-dictionary at statement
304  commit time.
305  @retval true Failure.
306  @retval false Success. */
307  bool commit_inplace_alter_table(TABLE *altered_table,
308  Alter_inplace_info *ha_alter_info,
309  bool commit, const dd::Table *old_table_def,
310  dd::Table *new_table_def) override;
311  /** @} */
312 
313  /** Allows InnoDB to update internal structures with concurrent
314  writes blocked (given that check_if_supported_inplace_alter()
315  did not return HA_ALTER_INPLACE_NO_LOCK).
316  This is for 'ALTER TABLE ... PARTITION' and a corresponding function
317  to prepare_inplace_alter_table().
318  This will be invoked before inplace_alter_partition().
319 
320  @param[in,out] altered_table TABLE object for new version of table
321  @param[in,out] ha_alter_info Structure describing changes to be done
322  by ALTER TABLE and holding data used
323  during in-place alter.
324  @param[in] old_dd_tab Table definition before the ALTER
325  @param[in,out] new_dd_tab Table definition after the ALTER
326  @retval true Failure
327  @retval false Success */
328  bool prepare_inplace_alter_partition(TABLE *altered_table,
329  Alter_inplace_info *ha_alter_info,
330  const dd::Table *old_dd_tab,
331  dd::Table *new_dd_tab);
332 
333  /** Alter the table structure in-place with operations
334  specified using HA_ALTER_FLAGS and Alter_inplace_information.
335  This is for 'ALTER TABLE ... PARTITION' and a corresponding function
336  to inplace_alter_table().
337  The level of concurrency allowed during this operation depends
338  on the return value from check_if_supported_inplace_alter().
339 
340  @param[in,out] altered_table TABLE object for new version of table
341  @param[in,out] ha_alter_info Structure describing changes to be done
342  by ALTER TABLE and holding data used
343  during in-place alter.
344  @param[in] old_dd_tab Table definition before the ALTER
345  @param[in,out] new_dd_tab Table definition after the ALTER
346  @retval true Failure
347  @retval false Success */
348  bool inplace_alter_partition(TABLE *altered_table,
349  Alter_inplace_info *ha_alter_info,
350  const dd::Table *old_dd_tab,
351  dd::Table *new_dd_tab);
352 
353  /** Prepare to commit or roll back ALTER TABLE...ALGORITHM=INPLACE.
354  This is for 'ALTER TABLE ... PARTITION' and a corresponding function
355  to commit_inplace_alter_table().
356  @param[in,out] altered_table TABLE object for new version of table.
357  @param[in,out] ha_alter_info ALGORITHM=INPLACE metadata
358  @param[in] commit true=Commit, false=Rollback.
359  @param[in] old_dd_tab old table
360  @param[in,out] new_dd_tab new table
361  @retval true on failure (my_error() will have been called)
362  @retval false on success */
363  bool commit_inplace_alter_partition(TABLE *altered_table,
364  Alter_inplace_info *ha_alter_info,
365  bool commit, const dd::Table *old_dd_tab,
366  dd::Table *new_dd_tab);
367 
368  // TODO: should we implement init_table_handle_for_HANDLER() ?
369  // (or is sql_stat_start handled correctly anyway?)
370  int optimize(THD *thd, HA_CHECK_OPT *check_opt) override;
371 
372  /** Set DD discard attribute for tablespace.
373  @param[in] table_def dd table
374  @param[in] discard True if this table is discarded
375  @return 0 or error number. */
376  int set_dd_discard_attribute(dd::Table *table_def, bool discard);
377 
378  int discard_or_import_tablespace(bool discard, dd::Table *table_def) override;
379 
380  /** Compare key and rowid.
381  Helper function for sorting records in the priority queue.
382  a/b points to table->record[0] rows which must have the
383  key fields set. The bytes before a and b store the rowid.
384  This is used for comparing/sorting rows first according to
385  KEY and if same KEY, by rowid (ref).
386 
387  @param[in] key_info Null terminated array of index
388  information.
389  @param[in] a Pointer to record+ref in first record.
390  @param[in] b Pointer to record+ref in second record.
391  @return Return value is SIGN(first_rec - second_rec)
392  @retval 0 Keys are equal.
393  @retval -1 second_rec is greater than first_rec.
394  @retval +1 first_rec is greater than second_rec. */
395  static int key_and_rowid_cmp(KEY **key_info, uchar *a, uchar *b);
396 
397  int extra(enum ha_extra_function operation) override;
398 
399  void print_error(int error, myf errflag) override;
400 
401  bool is_ignorable_error(int error) override;
402 
403  int start_stmt(THD *thd, thr_lock_type lock_type) override;
404 
405  ha_rows records_in_range(uint inx, key_range *min_key,
406  key_range *max_key) override;
407 
409 
411 
412  void update_create_info(HA_CREATE_INFO *create_info) override;
413 
414  int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info,
415  dd::Table *table_def) override;
416 
417  /** Drop a table.
418  @param[in] name table name
419  @param[in,out] dd_table data dictionary table
420  @return error number
421  @retval 0 on success */
422  int delete_table(const char *name, const dd::Table *dd_table) override;
423 
424  /** Rename a table.
425  @param[in] from table name before rename
426  @param[in] to table name after rename
427  @param[in] from_table data dictionary table before rename
428  @param[in,out] to_table data dictionary table after rename
429  @return error number
430  @retval 0 on success */
431  int rename_table(const char *from, const char *to,
432  const dd::Table *from_table, dd::Table *to_table) override;
433 
434  int check(THD *thd, HA_CHECK_OPT *check_opt) override;
435 
436  /** Repair table.
437  Will only handle records in wrong partition, not repairing
438  corrupt innodb indexes.
439  @param[in] thd Thread context.
440  @param[in] repair_opt Repair options.
441  @return 0 or error code. */
442  int repair(THD *thd, HA_CHECK_OPT *repair_opt) override;
443 
444  void get_auto_increment(ulonglong offset, ulonglong increment,
445  ulonglong nb_desired_values, ulonglong *first_value,
446  ulonglong *nb_reserved_values) override;
447 
448  /* Get partition row type
449  @param[in] partition_table partition table
450  @param[in] part_id Id of partition for which row type to be retrieved
451  @return Partition row type. */
452  enum row_type get_partition_row_type(const dd::Table *partition_table,
453  uint part_id) override;
454 
455  int cmp_ref(const uchar *ref1, const uchar *ref2) const override;
456 
457  int read_range_first(const key_range *start_key, const key_range *end_key,
458  bool eq_range_arg, bool sorted) override {
459  return (Partition_helper::ph_read_range_first(start_key, end_key,
460  eq_range_arg, sorted));
461  }
462 
463  void position(const uchar *record) override {
465  }
466 
467  /* TODO: Implement these! */
469  uint table_changes) override {
470  ut_ad(0);
471  return (COMPATIBLE_DATA_NO);
472  }
473 
474  int delete_all_rows() override { return (handler::delete_all_rows()); }
475 
476  int disable_indexes(uint mode) override { return (HA_ERR_WRONG_COMMAND); }
477 
478  int enable_indexes(uint mode) override { return (HA_ERR_WRONG_COMMAND); }
479 
480  int ft_init() override {
481  ut_ad(0);
482  return (HA_ERR_WRONG_COMMAND);
483  }
484 
486  ut_ad(0);
487  return (NULL);
488  }
489 
491  Ft_hints *hints) override {
492  ut_ad(0);
493  return (NULL);
494  }
495 
496  int ft_read(uchar *buf) override {
497  ut_ad(0);
498  return (HA_ERR_WRONG_COMMAND);
499  }
500 
501  bool get_foreign_dup_key(char *child_table_name, uint child_table_name_len,
502  char *child_key_name,
503  uint child_key_name_len) override {
504  ut_ad(0);
505  return (false);
506  }
507 
508  int read_range_next() override {
510  }
511 
512  uint32 calculate_key_hash_value(Field **field_array) override {
513  return (Partition_helper::ph_calculate_key_hash_value(field_array));
514  }
515 
516  Table_flags table_flags() const override {
518  }
519 
520  void release_auto_increment() override {
522  }
523 
524  /** Implementing Partition_handler interface @see partition_handler.h
525  @{ */
526 
527  /** See Partition_handler. */
529  ha_checksum *check_sum,
530  uint part_id) override {
532  part_id);
533  }
534 
535  uint alter_flags(uint flags MY_ATTRIBUTE((unused))) const override {
537  }
538 
540  return (static_cast<Partition_handler *>(this));
541  }
542 
543  void set_part_info(partition_info *part_info, bool early) override {
544  Partition_helper::set_part_info_low(part_info, early);
545  }
546 
547  void initialize_partitioning(partition_info *part_info, bool early) {
548  Partition_helper::set_part_info_low(part_info, early);
549  }
550 
551  handler *get_handler() override { return (static_cast<handler *>(this)); }
552  /** @} */
553 
554  /** Get number of threads that would be spawned for parallel read.
555  @param[out] scan_ctx a scan context created by this method that is
556  used in parallel_scan
557  @param[out] num_threads number of threads to be spawned
558  @return error code
559  @return 0 on success */
560  int parallel_scan_init(void *&scan_ctx, size_t &num_threads) override;
561 
563 
564  /** Start parallel read of data.
565  @param[in] scan_ctx Scan context created by parallel_scan_init
566  @param[in] thread_ctxs context for each of the spawned threads
567  @param[in] init_fn callback called by each parallel load
568  thread at the beginning of the parallel load.
569  @param[in] load_fn callback called by each parallel load
570  thread when processing of rows is required.
571  @param[in] end_fn callback called by each parallel load
572  thread when processing of rows has ended.
573  @return error code
574  @return 0 on success */
575  int parallel_scan(void *scan_ctx, void **thread_ctxs, Reader::Init_fn init_fn,
576  Reader::Load_fn load_fn, Reader::End_fn end_fn) override;
577  /** Run the parallel read of data.
578  @param[in] parallel_scan_ctx a scan context created by
579  parallel_scan_init
580  @return error code
581  @retval 0 on success
582  */
583  int parallel_scan_end(void *parallel_scan_ctx) override;
584 
585  private:
586  /** Pointer to Ha_innopart_share on the TABLE_SHARE. */
588 
589  /** ins_node per partition. Synchronized with prebuilt->ins_node
590  when changing partitions. */
592 
593  /** upd_node per partition. Synchronized with prebuilt->upd_node
594  when changing partitions. */
596 
597  /** blob_heap per partition. Synchronized with prebuilt->blob_heap
598  when changing partitions. */
600 
601  /** trx_id from the partitions table->def_trx_id. Keep in sync
602  with prebuilt->trx_id when changing partitions.
603  prebuilt only reflects the current partition! */
605 
606  /** row_read_type per partition. */
608 
609  /** byte array for sql_stat_start bitset */
610  byte *m_bitset;
611 
612  /** sql_stat_start per partition. */
614 
615  /** persistent cursors per partition. */
617 
618  /** persistent cluster cursors per partition. */
620 
621  /** map from part_id to offset in above two arrays. */
622  uint16_t *m_pcur_map;
623 
624  /** Original m_prebuilt->pcur. */
626 
627  /** Original m_prebuilt->clust_pcur. */
629 
630  /** New partitions during ADD/REORG/... PARTITION. */
632 
633  /** Clear used ins_nodes and upd_nodes. */
634  void clear_ins_upd_nodes();
635 
636  /** Clear the blob heaps for all partitions */
637  void clear_blob_heaps();
638 
639  /** Reset state of file to after 'open'. This function is called
640  after every statement for all tables used by that statement. */
641  int reset() override;
642 
643  /** Allocate the array to hold blob heaps for all partitions */
645 
646  /** Free the array that holds blob heaps for all partitions */
647  void free_blob_heap_array();
648 
649  /** Changes the active index of a handle.
650  @param[in] part_id Use this partition.
651  @param[in] keynr Use this index; MAX_KEY means always
652  clustered index, even if it was internally generated by InnoDB.
653  @return 0 or error code. */
654  int change_active_index(uint part_id, uint keynr);
655 
656  /** Move to next partition and set its index.
657  @return 0 for success else error number. */
658  int next_partition_index();
659 
660  /** Internally called for initializing auto increment value.
661  Should never be called, but defined to catch such errors.
662  @return 0 on success else error code. */
664 
665  /** Get the index for the current partition
666  @param[in] keynr MySQL index number.
667  @return InnoDB index or NULL. */
668  dict_index_t *innobase_get_index(uint keynr) override;
669 
670  /** Get the index for a handle.
671  Does not change active index.
672  @param[in] keynr use this index; MAX_KEY means always clustered
673  index, even if it was internally generated by InnoDB.
674  @param[in] part_id From this partition.
675  @return NULL or index instance. */
676  dict_index_t *innopart_get_index(uint part_id, uint keynr);
677 
678  /** Change active partition.
679  Copies needed info into m_prebuilt from the partition specific memory.
680  @param[in] part_id Partition to set as active. */
681  void set_partition(uint part_id);
682 
683  /** Update active partition.
684  Copies needed info from m_prebuilt into the partition specific memory.
685  @param[in] part_id Partition to set as active. */
686  void update_partition(uint part_id);
687 
688  /** TRUNCATE an InnoDB partitioned table.
689  @param[in] name table name
690  @param[in] form table definition
691  @param[in,out] table_def dd::Table describing table to be
692  truncated. Can be adjusted by SE, the changes will be saved into
693  the data-dictionary at statement commit time.
694  @return error number
695  @retval 0 on success */
696  int truncate_impl(const char *name, TABLE *form, dd::Table *table_def);
697 
698  /** Helpers needed by Partition_helper, @see partition_handler.h @{ */
699 
700  /** Set the autoinc column max value.
701  This should only be called once from ha_innobase::open().
702  Therefore there's no need for a covering lock.
703  @param[in] - If locking should be skipped. Not used!
704  @return 0 on success else error code. */
705  int initialize_auto_increment(bool /* no_lock */) override;
706 
707  /** Save currently highest auto increment value.
708  @param[in] nr Auto increment value to save. */
709  void save_auto_increment(ulonglong nr) override;
710 
711  /** Setup the ordered record buffer and the priority queue.
712  @param[in] used_parts Number of used partitions in query.
713  @return false for success, else true. */
714  int init_record_priority_queue_for_parts(uint used_parts) override;
715 
716  /** Destroy the ordered record buffer and the priority queue. */
718 
719  /** Create the Altered_partitoins object
720  @param[in] ha_alter_info thd DDL operation
721  @retval true On failure
722  @retval false On success */
723  bool prepare_for_copy_partitions(Alter_inplace_info *ha_alter_info);
724 
725  /** write row to new partition.
726  @param[in] new_part New partition to write to.
727  @return 0 for success else error code. */
728  int write_row_in_new_part(uint new_part) override;
729 
730  /** Write a row in specific partition.
731  Stores a row in an InnoDB database, to the table specified in this
732  handle.
733  @param[in] part_id Partition to write to.
734  @param[in] record A row in MySQL format.
735  @return error code. */
736  int write_row_in_part(uint part_id, uchar *record) override;
737 
738  /** Update a row in partition.
739  Updates a row given as a parameter to a new value.
740  @param[in] part_id Partition to update row in.
741  @param[in] old_row Old row in MySQL format.
742  @param[in] new_row New row in MySQL format.
743  @return error number or 0. */
744  int update_row_in_part(uint part_id, const uchar *old_row,
745  uchar *new_row) override;
746 
747  /** Deletes a row in partition.
748  @param[in] part_id Partition to delete from.
749  @param[in] record Row to delete in MySQL format.
750  @return error number or 0. */
751  int delete_row_in_part(uint part_id, const uchar *record) override;
752 
753  /** Return first record in index from a partition.
754  @param[in] part Partition to read from.
755  @param[out] record First record in index in the partition.
756  @return error number or 0. */
757  int index_first_in_part(uint part, uchar *record) override;
758 
759  /** Return last record in index from a partition.
760  @param[in] part Partition to read from.
761  @param[out] record Last record in index in the partition.
762  @return error number or 0. */
763  int index_last_in_part(uint part, uchar *record) override;
764 
765  /** Return previous record in index from a partition.
766  @param[in] part Partition to read from.
767  @param[out] record Last record in index in the partition.
768  @return error number or 0. */
769  int index_prev_in_part(uint part, uchar *record) override;
770 
771  /** Return next record in index from a partition.
772  @param[in] part Partition to read from.
773  @param[out] record Last record in index in the partition.
774  @return error number or 0. */
775  int index_next_in_part(uint part, uchar *record) override;
776 
777  /** Return next same record in index from a partition.
778  This routine is used to read the next record, but only if the key is
779  the same as supplied in the call.
780  @param[in] part Partition to read from.
781  @param[out] record Last record in index in the partition.
782  @param[in] key Key to match.
783  @param[in] length Length of key.
784  @return error number or 0. */
785  int index_next_same_in_part(uint part, uchar *record, const uchar *key,
786  uint length) override;
787 
788  /** Start index scan and return first record from a partition.
789  This routine starts an index scan using a start key. The calling
790  function will check the end key on its own.
791  @param[in] part Partition to read from.
792  @param[out] record First matching record in index in the partition.
793  @param[in] key Key to match.
794  @param[in] keypart_map Which part of the key to use.
795  @param[in] find_flag Key condition/direction to use.
796  @return error number or 0. */
797  int index_read_map_in_part(uint part, uchar *record, const uchar *key,
798  key_part_map keypart_map,
799  enum ha_rkey_function find_flag) override;
800 
801  /** Return last matching record in index from a partition.
802  @param[in] part Partition to read from.
803  @param[out] record Last matching record in index in the partition.
804  @param[in] key Key to match.
805  @param[in] keypart_map Which part of the key to use.
806  @return error number or 0. */
808  key_part_map keypart_map) override;
809 
810  /** Start index scan and return first record from a partition.
811  This routine starts an index scan using a start and end key.
812  @param[in] part Partition to read from.
813  @param[out] record First matching record in index in the partition.
814  if NULL use table->record[0] as return buffer.
815  @param[in] start_key Start key to match.
816  @param[in] end_key End key to match.
817  @param[in] sorted Return rows in sorted order.
818  @return error number or 0. */
820  const key_range *start_key,
821  const key_range *end_key, bool sorted) override;
822 
823  /** Return next record in index range scan from a partition.
824  @param[in] part Partition to read from.
825  @param[out] record First matching record in index in the partition.
826  if NULL use table->record[0] as return buffer.
827  @return error number or 0. */
828  int read_range_next_in_part(uint part, uchar *record) override;
829 
830  /** Start index scan and return first record from a partition.
831  This routine starts an index scan using a start key. The calling
832  function will check the end key on its own.
833  @param[in] part Partition to read from.
834  @param[out] record First matching record in index in the partition.
835  @param[in] index Index to read from.
836  @param[in] key Key to match.
837  @param[in] keypart_map Which part of the key to use.
838  @param[in] find_flag Key condition/direction to use.
839  @return error number or 0. */
841  const uchar *key, key_part_map keypart_map,
842  enum ha_rkey_function find_flag) override;
843 
844  /** Initialize sampling.
845  @param[out] scan_ctx A scan context created by this method that has to be
846  used in sample_next
847  @param[in] sampling_percentage percentage of records that need to be
848  sampled
849  @param[in] sampling_seed random seed that the random generator will
850  use
851  @param[in] sampling_method sampling method to be used; currently only
852  SYSTEM sampling is supported
853  @return 0 for success, else one of the HA_xxx values in case of error. */
854  int sample_init(void *&scan_ctx, double sampling_percentage,
855  int sampling_seed,
856  enum_sampling_method sampling_method) override;
857 
858  /** Get the next record for sampling.
859  @param[in] scan_ctx Scan context of the sampling
860  @param[in] buf buffer to place the read record
861  @return 0 for success, else one of the HA_xxx values in case of error. */
862  int sample_next(void *scan_ctx, uchar *buf) override;
863 
864  /** End sampling.
865  @param[in] scan_ctx Scan context of the sampling
866  @return 0 for success, else one of the HA_xxx values in case of error. */
867  int sample_end(void *scan_ctx) override;
868 
869  /** Initialize random read/scan of a specific partition.
870  @param[in] part_id Partition to initialize.
871  @param[in] scan True for scan else random access.
872  @return error number or 0. */
873  int rnd_init_in_part(uint part_id, bool scan) override;
874 
875  /** Get next row during scan of a specific partition.
876  @param[in] part_id Partition to read from.
877  @param[out] buf Next row.
878  @return error number or 0. */
879  int rnd_next_in_part(uint part_id, uchar *buf) override;
880 
881  /** End random read/scan of a specific partition.
882  @param[in] part_id Partition to end random read/scan.
883  @param[in] scan True for scan else random access.
884  @return error number or 0. */
885  int rnd_end_in_part(uint part_id, bool scan) override;
886 
887  /** Get a reference to the current cursor position in the last used
888  partition.
889  @param[out] ref_arg Reference (PK if exists else row_id).
890  @param[in] record Record to position. */
891  void position_in_last_part(uchar *ref_arg, const uchar *record) override;
892 
893  /** Read row using position using given record to find.
894  Only useful when position is based on primary key
895  @param[in] record Current record in MySQL Row Format.
896  @return error number or 0. */
897  int rnd_pos_by_record(uchar *record) override;
898 
899  /** Copy a cached MySQL record.
900  @param[out] buf Where to copy the MySQL record.
901  @param[in] cached_row Which record to copy. */
902  void copy_cached_row(uchar *buf, const uchar *cached_row) override;
903  /** @} */
904 
905  /* Private handler:: functions specific for native InnoDB partitioning.
906  @see handler.h @{ */
907 
908  /** Open an InnoDB table.
909  @param[in] name table name
910  @param[in] mode access mode
911  @param[in] test_if_locked test if the file to be opened is locked
912  @param[in] table_def dd::Table describing table to be opened
913  @retval 1 if error
914  @retval 0 if success */
915  int open(const char *name, int mode, uint test_if_locked,
916  const dd::Table *table_def) override;
917 
918  int close() override;
919 
920  double scan_time() override;
921 
922  /** Was the last returned row semi consistent read.
923  In an UPDATE or DELETE, if the row under the cursor was locked by
924  another transaction, and the engine used an optimistic read of the last
925  committed row value under the cursor, then the engine returns 1 from
926  this function. MySQL must NOT try to update this optimistic value. If
927  the optimistic value does not match the WHERE condition, MySQL can
928  decide to skip over this row. This can be used to avoid unnecessary
929  lock waits.
930 
931  If this method returns true, it will also signal the storage
932  engine that the next read will be a locking re-read of the row.
933  @see handler.h and row0mysql.h
934  @return true if last read was semi consistent else false. */
935  bool was_semi_consistent_read() override;
936 
937  /** Try semi consistent read.
938  Tell the engine whether it should avoid unnecessary lock waits.
939  If yes, in an UPDATE or DELETE, if the row under the cursor was locked
940  by another transaction, the engine may try an optimistic read of
941  the last committed row value under the cursor.
942  @see handler.h and row0mysql.h
943  @param[in] yes Should semi-consistent read be used. */
944  void try_semi_consistent_read(bool yes) override;
945 
946  /** Removes a lock on a row.
947  Removes a new lock set on a row, if it was not read optimistically.
948  This can be called after a row has been read in the processing of
949  an UPDATE or a DELETE query. @see ha_innobase::unlock_row(). */
950  void unlock_row() override;
951 
952  int index_init(uint index, bool sorted) override;
953 
954  int index_end() override;
955 
956  int rnd_init(bool scan) override {
957  return (Partition_helper::ph_rnd_init(scan));
958  }
959 
960  int rnd_end() override { return (Partition_helper::ph_rnd_end()); }
961 
962  int external_lock(THD *thd, int lock_type) override;
963 
965  thr_lock_type lock_type) override;
966 
967  int write_row(uchar *record) override {
968  bool entered = false;
969  auto trx = m_prebuilt->trx;
970 
971  /* Enter innodb to order Auto INC partition lock after Innodb. No need to
972  enter if there are tickets left. Currently we cannot handle re-enter
973  without exit if no more tickets left.
974 
975  1. We avoid consuming the last ticket as there could be another enter
976  call from innobase.
977 
978  2. If we enter innodb here, there is at least one more ticket left as
979  the minimum value for "innodb_concurrency_tickets" is 1 */
980 
981  if (!trx->declared_to_be_inside_innodb) {
983  entered = true;
984  }
985 
987 
988  if (entered) {
990  }
991 
992  return (err);
993  }
994 
995  int update_row(const uchar *old_record, uchar *new_record) override {
996  return (Partition_helper::ph_update_row(old_record, new_record));
997  }
998 
999  int delete_row(const uchar *record) override {
1001  }
1002  /** @} */
1003 
1004  /** Truncate partition.
1005  Called from Partition_handler::trunctate_partition() or truncate().
1006  @param[in,out] dd_table data dictionary table
1007  @retval error number
1008  @retval 0 on success */
1009  int truncate_partition_low(dd::Table *dd_table) override;
1010 
1011  /** Exchange partition.
1012  Low-level primitive which implementation is provided here.
1013  @param[in] part_id The id of the partition to
1014  be exchanged
1015  @param[in,out] part_table partitioned table to be
1016  exchanged
1017  @param[in,out] swap_table table to be exchanged
1018  @return error number
1019  @retval 0 on success */
1020  int exchange_partition_low(uint part_id, dd::Table *part_table,
1021  dd::Table *swap_table) override;
1022 
1023  /** Access methods to protected areas in handler to avoid adding
1024  friend class Partition_helper in class handler.
1025  @see partition_handler.h @{ */
1026 
1027  THD *get_thd() const override { return ha_thd(); }
1028 
1029  TABLE *get_table() const override { return table; }
1030 
1031  bool get_eq_range() const override { return eq_range; }
1032 
1033  void set_eq_range(bool eq_range_arg) override { eq_range = eq_range_arg; }
1034 
1035  void set_range_key_part(KEY_PART_INFO *key_part) override {
1036  range_key_part = key_part;
1037  }
1038  /** @} */
1039 
1040  /** Fill in data_dir_path and tablespace name from internal data
1041  dictionary.
1042  @param[in,out] part_elem Partition element to fill.
1043  @param[in] ib_table InnoDB table to copy from.
1044  @param[in] display_tablespace Display tablespace name if
1045  set. */
1046  void update_part_elem(partition_element *part_elem, dict_table_t *ib_table,
1047  bool display_tablespace);
1048 
1049  protected:
1050  /* Protected handler:: functions specific for native InnoDB partitioning.
1051  @see handler.h @{ */
1052 
1053  int rnd_next(uchar *record) override {
1055  }
1056 
1057  int rnd_pos(uchar *record, uchar *pos) override;
1058 
1059  int records(ha_rows *num_rows) override;
1060 
1061  int records_from_index(ha_rows *num_rows, uint) override {
1062  /* Force use of cluster index until we implement sec index parallel scan. */
1063  return ha_innopart::records(num_rows);
1064  }
1065 
1066  int index_next(uchar *record) override {
1068  }
1069 
1070  int index_next_same(uchar *record, const uchar *, uint keylen) override {
1071  return (Partition_helper::ph_index_next_same(record, keylen));
1072  }
1073 
1074  int index_prev(uchar *record) override {
1076  }
1077 
1078  int index_first(uchar *record) override {
1080  }
1081 
1082  int index_last(uchar *record) override {
1084  }
1085 
1087  key_part_map keypart_map) override {
1088  return (Partition_helper::ph_index_read_last_map(record, key, keypart_map));
1089  }
1090 
1091  int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
1092  enum ha_rkey_function find_flag) override {
1093  return (
1094  Partition_helper::ph_index_read_map(buf, key, keypart_map, find_flag));
1095  }
1096 
1098  key_part_map keypart_map,
1099  enum ha_rkey_function find_flag) override {
1101  keypart_map, find_flag));
1102  }
1103  /** @} */
1104 
1105  /** Updates and return statistics.
1106  Returns statistics information of the table to the MySQL interpreter,
1107  in various fields of the handle object.
1108  @param[in] flag Flags for what to update and return.
1109  @param[in] is_analyze True if called from "::analyze()".
1110  @return HA_ERR_* error code or 0. */
1111  int info_low(uint flag, bool is_analyze) override;
1112 };
1113 #endif /* ha_innopart_h */
Partition_helper::ph_index_next
int ph_index_next(uchar *buf)
Read next record in a forward index scan.
Definition: partition_handler.cc:2153
Ha_innopart_share::m_table_parts
dict_table_t ** m_table_parts
Array of all included table definitions (one per partition).
Definition: ha_innopart.h:62
ha_innopart::write_row_in_part
int write_row_in_part(uint part_id, uchar *record) override
Write a row in specific partition.
Definition: ha_innopart.cc:1424
ha_innopart::rnd_end_in_part
int rnd_end_in_part(uint part_id, bool scan) override
End random read/scan of a specific partition.
Definition: ha_innopart.cc:2131
ha_innopart::index_last
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:1082
ha_innopart::optimize
int optimize(THD *thd, HA_CHECK_OPT *check_opt) override
Optimize table.
Definition: ha_innopart.cc:3828
ha_innopart::init_record_priority_queue_for_parts
int init_record_priority_queue_for_parts(uint used_parts) override
Setup the ordered record buffer and the priority queue.
Definition: ha_innopart.cc:1553
ha_innopart::index_read_last_map
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:1086
THD
Definition: sql_class.h:764
Alter_inplace_info
Class describing changes to be done by ALTER TABLE.
Definition: handler.h:2761
ha_innopart::index_next_same_in_part
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
ha_innopart::m_row_read_type_parts
ulint * m_row_read_type_parts
row_read_type per partition.
Definition: ha_innopart.h:607
Partition_helper::ph_position
void ph_position(const uchar *record)
Save position of current row.
Definition: partition_handler.cc:1654
ha_innopart::read_range_first_in_part
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:1940
HA_CHECK_OPT
Definition: handler.h:3194
btr_pcur_t
Definition: btr0pcur.h:177
ha_innopart::ha_innopart
ha_innopart(handlerton *hton, TABLE_SHARE *table_arg)
Construct ha_innopart handler.
Definition: ha_innopart.cc:597
Ha_innopart_share::Ha_innopart_share
Ha_innopart_share()
Disable default constructor.
Definition: ha_innopart.h:176
ha_innopart::get_handler
handler * get_handler() override
Return the table handler.
Definition: ha_innopart.h:551
ha_innopart::innopart_get_index
dict_index_t * innopart_get_index(uint part_id, uint keynr)
Get the index for a handle.
Definition: ha_innopart.cc:1674
Partition_helper::get_dynamic_partition_info_low
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:2947
ha_innopart::close
int close() override
Closes a handle to an InnoDB table.
Definition: ha_innopart.cc:1227
Partition_helper::ph_calculate_key_hash_value
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:854
Ha_innopart_share::increment_ref_counts
void increment_ref_counts()
Increment share and InnoDB tables reference counters.
Definition: ha_innopart.cc:226
ha_innopart::repair
int repair(THD *thd, HA_CHECK_OPT *repair_opt) override
Repair table.
Definition: ha_innopart.cc:3885
ha_innopart::delete_row_in_part
int delete_row_in_part(uint part_id, const uchar *record) override
Deletes a row in partition.
Definition: ha_innopart.cc:1466
ha_innopart::index_first_in_part
int index_first_in_part(uint part, uchar *record) override
Return first record in index from a partition.
Definition: ha_innopart.cc:1791
rules_table_service::table_name
const char * table_name
Definition: rules_table_service.cc:55
ha_innopart::parallel_scan_end
int parallel_scan_end(void *parallel_scan_ctx) override
Run the parallel read of data.
Definition: handler0alter.cc:9805
ha_innopart::inplace_alter_table
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:10110
ha_innopart::m_blob_heap_parts
mem_heap_t ** m_blob_heap_parts
blob_heap per partition.
Definition: ha_innopart.h:599
ha_innopart::m_part_share
Ha_innopart_share * m_part_share
Pointer to Ha_innopart_share on the TABLE_SHARE.
Definition: ha_innopart.h:587
ha_innodb.h
ha_innopart::update_create_info
void update_create_info(HA_CREATE_INFO *create_info) override
Update create_info.
Definition: ha_innopart.cc:2286
ha_innopart::m_pcur
btr_pcur_t * m_pcur
Original m_prebuilt->pcur.
Definition: ha_innopart.h:625
HA_CAN_GEOMETRY
#define HA_CAN_GEOMETRY
Definition: handler.h:224
ha_innopart::free_blob_heap_array
void free_blob_heap_array()
Free the array that holds blob heaps for all partitions.
Definition: ha_innopart.cc:4136
NULL
#define NULL
Definition: types.h:55
ha_innopart::records_from_index
int records_from_index(ha_rows *num_rows, uint) override
Number of rows in table counted using the secondary index chosen by optimizer.
Definition: ha_innopart.h:1061
row_prebuilt_t::trx
trx_t * trx
current transaction handle
Definition: row0mysql.h:547
Partition_helper::ph_index_read_idx_map
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:2092
ha_innopart::calculate_key_hash_value
uint32 calculate_key_hash_value(Field **field_array) override
Definition: ha_innopart.h:512
ha_innopart::index_read_map
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:1091
trx_id_t
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:148
HA_DUPLICATE_POS
#define HA_DUPLICATE_POS
Definition: handler.h:247
ha_innopart::set_range_key_part
void set_range_key_part(KEY_PART_INFO *key_part) override
Definition: ha_innopart.h:1035
Ha_innopart_share::set_table_part
void set_table_part(uint part_id, dict_table_t *table)
Set innodb table for given partition.
Definition: ha_innopart.h:88
Partition_helper::ph_rnd_init
int ph_rnd_init(bool scan)
MODULE full table scan.
Definition: partition_handler.cc:1478
ha_innopart::alter_flags
uint alter_flags(uint flags) const override
Alter flags.
Definition: ha_innopart.h:535
ha_innopart::prepare_for_copy_partitions
bool prepare_for_copy_partitions(Alter_inplace_info *ha_alter_info)
Create the Altered_partitoins object.
Definition: handler0alter.cc:10319
record
Definition: mi_test3.cc:54
ut_ad
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:65
dict_index_t
Data structure for an index.
Definition: dict0mem.h:869
ha_innopart::get_auto_increment
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:4082
ha_innopart::rnd_next_in_part
int rnd_next_in_part(uint part_id, uchar *buf) override
Get next row during scan of a specific partition.
Definition: ha_innopart.cc:2141
Ha_innopart_share::has_table_parts
bool has_table_parts() const
Return whether share has opened InnoDB tables for partitions.
Definition: ha_innopart.h:122
ha_innopart::try_semi_consistent_read
void try_semi_consistent_read(bool yes) override
Try semi consistent read.
Definition: ha_innopart.cc:1399
ha_innopart::get_foreign_dup_key
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:501
HA_CAN_REPAIR
#define HA_CAN_REPAIR
Definition: handler.h:365
handler::delete_all_rows
virtual int delete_all_rows()
Delete all rows in a table.
Definition: handler.h:6231
handlerton
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2271
ins_node_t
Definition: row0ins.h:170
pos
char * pos
Definition: do_ctype.cc:76
ha_innopart::prepare_inplace_alter_table
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:9956
Altered_partitions
Helper class for encapsulating new/altered partitions during ADD(HASH/KEY)/COALESCE/REORGANIZE PARTIT...
Definition: handler0alter.cc:7801
Ha_innopart_share::~Ha_innopart_share
~Ha_innopart_share()
Definition: ha_innopart.cc:94
Ha_innopart_share::open_table_parts
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:256
ha_innobase::table_flags
Table_flags table_flags() const override
Get the table flags to use for the statement.
Definition: ha_innodb.cc:5777
String
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:164
TABLE
Definition: table.h:1305
ha_innopart::index_prev
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:1074
Parallel_reader_adapter::End_fn
handler::Load_end_cbk End_fn
Definition: row0pread-adapter.h:49
ha_innobase::info
int info(uint) override
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle...
Definition: ha_innodb.cc:16493
HA_INPLACE_CHANGE_PARTITION
#define HA_INPLACE_CHANGE_PARTITION
Definition: partition_handler.h:75
Parallel_reader_adapter::Init_fn
handler::Load_init_cbk Init_fn
Definition: row0pread-adapter.h:51
partition_get_tablespace
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:565
ha_innopart::rnd_init
int rnd_init(bool scan) override
Initialize a table scan.
Definition: ha_innopart.h:956
ha_innopart::m_clust_pcur
btr_pcur_t * m_clust_pcur
Original m_prebuilt->clust_pcur.
Definition: ha_innopart.h:628
Partition_helper::ph_update_row
int ph_update_row(const uchar *old_data, uchar *new_data)
Update an existing row in the partitioned table.
Definition: partition_handler.cc:571
handler::Table_flags
ulonglong Table_flags
Definition: handler.h:3995
ha_innopart::info_low
int info_low(uint flag, bool is_analyze) override
Updates and return statistics.
Definition: ha_innopart.cc:3458
key_part_map
ulong key_part_map
Definition: my_base.h:1000
commit
static bool commit(THD *thd)
Commit the current statement and transaction.
Definition: sql_cmd_srs.cc:151
mem_root
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
ha_innopart::m_upd_node_parts
upd_node_t ** m_upd_node_parts
upd_node per partition.
Definition: ha_innopart.h:595
ha_innopart::rename_table
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:2671
Ha_innopart_share::m_table_share
TABLE_SHARE * m_table_share
Pointer back to owning TABLE_SHARE.
Definition: ha_innopart.h:78
dict_table_t
Data structure for a database table.
Definition: dict0mem.h:1510
ha_innopart::unlock_row
void unlock_row() override
Removes a lock on a row.
Definition: ha_innopart.cc:1411
HA_READ_BEFORE_WRITE_REMOVAL
#define HA_READ_BEFORE_WRITE_REMOVAL
The handler supports read before write removal optimization.
Definition: handler.h:407
ha_innopart::commit_inplace_alter_table
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:10182
handler::eq_range
bool eq_range
Definition: handler.h:4051
ha_innopart::start_stmt
int start_stmt(THD *thd, thr_lock_type lock_type) override
Start statement.
Definition: ha_innopart.cc:3938
ha_checksum
uint32 ha_checksum
Definition: my_sys.h:538
ha_innopart::ft_init
int ft_init() override
Initialize FT index scan.
Definition: ha_innopart.h:480
Ha_innopart_share::close_table_parts
void close_table_parts()
Close the table partitions.
Definition: ha_innopart.cc:448
Ha_innopart_share::get_table_part
dict_table_t * get_table_part(uint part_id) const
Return innodb table for given partition.
Definition: ha_innopart.h:103
ha_innopart::parallel_scan_init
int parallel_scan_init(void *&scan_ctx, size_t &num_threads) override
Get number of threads that would be spawned for parallel read.
Definition: handler0alter.cc:9726
ha_innopart::set_dd_discard_attribute
int set_dd_discard_attribute(dd::Table *table_def, bool discard)
Set DD discard attribute for tablespace.
Definition: ha_innopart.cc:2742
table_def
A table definition from the master.
Definition: rpl_utility.h:246
Ha_innopart_share
InnoDB partition specific Handler_share.
Definition: ha_innopart.h:59
key
static const char * key
Definition: suite_stubs.c:14
Partition_helper::set_part_info_low
virtual void set_part_info_low(partition_info *part_info, bool early)
Set partition info.
Definition: partition_handler.cc:382
ha_innopart::update_row_in_part
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:1451
ha_innopart::release_auto_increment
void release_auto_increment() override
Definition: ha_innopart.h:520
ha_innopart::index_next_in_part
int index_next_in_part(uint part, uchar *record) override
Return next record in index from a partition.
Definition: ha_innopart.cc:1806
json_binary::err
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
ha_innopart::innobase_get_index
dict_index_t * innobase_get_index(uint keynr) override
Get the index for the current partition.
Definition: ha_innopart.cc:1659
ha_innopart::rnd_pos
int rnd_pos(uchar *record, uchar *pos) override
Get a row from a position.
Definition: ha_innopart.cc:2170
ha_innopart::next_partition_index
int next_partition_index()
Move to next partition and set its index.
mem_block_info_t
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:337
ha_innopart::index_init
int index_init(uint index, bool sorted) override
Initializes a handle to use an index.
Definition: ha_innopart.cc:1482
row_type
row_type
Definition: handler.h:665
ha_innopart::delete_table
int delete_table(const char *name, const dd::Table *dd_table) override
Drop a table.
Definition: ha_innopart.cc:2620
Ha_innopart_share::get_table_part_ref
dict_table_t ** get_table_part_ref(uint part_id)
Get table reference for given partition.
Definition: ha_innopart.h:96
ha_innopart::ft_init_ext
FT_INFO * ft_init_ext(uint flags, uint inx, String *key) override
Initialize FT index scan.
Definition: ha_innopart.h:485
ha_innopart::m_pcur_parts
btr_pcur_t * m_pcur_parts
persistent cursors per partition.
Definition: ha_innopart.h:616
ha_innopart::scan_time
double scan_time() override
Time estimate for full table scan.
Definition: ha_innopart.cc:3411
Ha_innopart_share::m_index_count
uint m_index_count
Number of indexes.
Definition: ha_innopart.h:72
ha_innopart::print_error
void print_error(int error, myf errflag) override
Print error information.
Definition: ha_innopart.cc:1637
ha_innopart::sample_init
int sample_init(void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method) override
Initialize sampling.
Definition: ha_innopart.cc:2016
Ha_innopart_share::m_tot_parts
uint m_tot_parts
Total number of partitions.
Definition: ha_innopart.h:69
Ha_innopart_share::get_mysql_key
uint get_mysql_key(uint part_id, const dict_index_t *index)
Get MySQL key number corresponding to InnoDB index.
Definition: ha_innopart.cc:524
ha_innopart::ft_read
int ft_read(uchar *buf) override
Fetch next result from the FT result set.
Definition: ha_innopart.h:496
handler
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:3991
Partition_helper::ph_index_prev
int ph_index_prev(uchar *buf)
Read next record when performing index scan backwards.
Definition: partition_handler.cc:2207
ha_innopart::m_sql_stat_start_parts
Sql_stat_start_parts m_sql_stat_start_parts
sql_stat_start per partition.
Definition: ha_innopart.h:613
ha_innopart::get_thd
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:1027
ha_innopart::parallel_scan
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:9794
Partition_helper::ph_index_first
int ph_index_first(uchar *buf)
Start an index scan from leftmost record and return first record.
Definition: partition_handler.cc:1985
ha_innopart::delete_row
int delete_row(const uchar *record) override
Deletes a row given as the parameter.
Definition: ha_innopart.h:999
KEY_PART_INFO
Definition: key.h:55
Ha_innopart_share::get_num_parts
uint get_num_parts() const
Get the number of partitions.
Definition: ha_innopart.h:162
HA_CAN_FULLTEXT
#define HA_CAN_FULLTEXT
Definition: handler.h:301
ha_innopart::get_dynamic_partition_info
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:528
handler::table
TABLE * table
Definition: handler.h:3999
Partition_helper::ph_index_read_map
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:1880
yes
static int yes(xcom_port port)
Definition: xcom_base.c:981
ha_innopart::clear_blob_heaps
void clear_blob_heaps()
Clear the blob heaps for all partitions.
Definition: ha_innopart.cc:4146
ha_statistics
Definition: handler.h:3454
Ha_innopart_share::set_table_parts_and_indexes
bool set_table_parts_and_indexes(const TABLE *table, partition_info *part_info, dict_table_t **table_parts)
Initialize the share with table and indexes per partition.
Definition: ha_innopart.cc:312
Partition_helper::ph_read_range_next
int ph_read_range_next()
Read next record in read of a range with start and end key.
Definition: partition_handler.cc:2270
TABLE_SHARE
This structure is shared between different table objects.
Definition: table.h:653
MEM_ROOT
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
ha_innopart::destroy_record_priority_queue_for_parts
void destroy_record_priority_queue_for_parts() override
Destroy the ordered record buffer and the priority queue.
Definition: ha_innopart.cc:1610
ha_innopart::read_range_next_in_part
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:1982
ha_innopart::get_table
TABLE * get_table() const override
Definition: ha_innopart.h:1029
ha_innopart::write_row
int write_row(uchar *record) override
Stores a row in an InnoDB database, to the table specified in this handle.
Definition: ha_innopart.h:967
ha_innopart::discard_or_import_tablespace
int discard_or_import_tablespace(bool discard, dd::Table *table_def) override
Discards or imports an InnoDB tablespace.
Definition: ha_innopart.cc:2831
ha_innopart::initialize_partitioning
void initialize_partitioning(partition_info *part_info, bool early)
Definition: ha_innopart.h:547
ha_innopart::index_read_idx_map_in_part
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
Partition_helper::ph_read_range_first
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:2234
Sql_stat_start_parts
Bitset Sql_stat_start_parts
Definition: ha_innopart.h:56
Ha_innopart_share::get_index
dict_index_t * get_index(uint part_id, uint keynr)
Return innodb index for given partition and key number.
Definition: ha_innopart.cc:495
ha_innopart::truncate_impl
int truncate_impl(const char *name, TABLE *form, dd::Table *table_def)
TRUNCATE an InnoDB partitioned table.
Definition: ha_innopart.cc:2983
ha_extra_function
ha_extra_function
Definition: my_base.h:183
ha_innopart::rnd_init_in_part
int rnd_init_in_part(uint part_id, bool scan) override
Initialize random read/scan of a specific partition.
Definition: ha_innopart.cc:2109
ha_innopart::external_lock
int external_lock(THD *thd, int lock_type) override
Lock/prepare to lock table.
Definition: ha_innopart.cc:3993
ha_innopart::m_clust_pcur_parts
btr_pcur_t * m_clust_pcur_parts
persistent cluster cursors per partition.
Definition: ha_innopart.h:619
uint
unsigned int uint
Definition: uca-dump.cc:29
ha_innopart::index_next
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:1066
Ha_innopart_share::get_table_share
const TABLE_SHARE * get_table_share() const
Definition: ha_innopart.h:158
Partition_helper::ph_index_read_last_map
int ph_index_read_last_map(uchar *buf, const uchar *key, key_part_map keypart_map)
Read last using key.
Definition: partition_handler.cc:2060
ha_innopart::index_read_idx_map
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:1097
handler::range_key_part
KEY_PART_INFO * range_key_part
Definition: handler.h:4050
ha_innopart::update_row
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:995
ha_innopart::ft_init_ext_with_hints
FT_INFO * ft_init_ext_with_hints(uint inx, String *key, Ft_hints *hints) override
Initialize FT index scan.
Definition: ha_innopart.h:490
PARTITION_IN_SHARED_TABLESPACE
static constexpr auto PARTITION_IN_SHARED_TABLESPACE
Definition: ha_innopart.h:45
ha_innopart::position_in_last_part
void position_in_last_part(uchar *ref_arg, const uchar *record) override
Get a reference to the current cursor position in the last used partition.
Definition: ha_innopart.cc:2210
ha_innopart::rnd_end
int rnd_end() override
Ends a table scan.
Definition: ha_innopart.h:960
ha_innopart::m_pcur_map
uint16_t * m_pcur_map
map from part_id to offset in above two arrays.
Definition: ha_innopart.h:622
ha_innopart::exchange_partition_low
int exchange_partition_low(uint part_id, dd::Table *part_table, dd::Table *swap_table) override
Exchange partition.
Definition: handler0alter.cc:10582
dd::cache::Dictionary_client
Definition: dictionary_client.h:145
ha_innobase::m_prebuilt
row_prebuilt_t * m_prebuilt
Save CPU time with prebuilt/cached data structures.
Definition: ha_innodb.h:657
ha_innopart::commit_inplace_alter_partition
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:10477
uchar
unsigned char uchar
Definition: my_inttypes.h:51
ha_innopart::get_partition_row_type
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:2946
ha_innopart::index_read_last_map_in_part
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
ha_innopart::create
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::is_ignorable_error
bool is_ignorable_error(int error) override
Can error be ignored.
Definition: ha_innopart.cc:1647
Ha_innopart_share::set_v_templ
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:202
Bitset
A simple bitset wrapper class, whose size can be specified after the object has been defined.
Definition: ut0bitset.h:38
ha_innopart::store_lock
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:3963
ha_innopart::rnd_next
int rnd_next(uchar *record) override
Reads the next row in a table scan (also used to read the FIRST row in a table scan).
Definition: ha_innopart.h:1053
ha_innopart::index_prev_in_part
int index_prev_in_part(uint part, uchar *record) override
Return previous record in index from a partition.
Definition: ha_innopart.cc:1857
ha_innopart::index_next_same
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:1070
uint32
uint32_t uint32
Definition: my_inttypes.h:66
dd::Table
Definition: table.h:45
ha_innopart::save_auto_increment
void save_auto_increment(ulonglong nr) override
Save currently highest auto increment value.
Definition: ha_innopart.cc:1365
ha_innopart::records_in_range
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:3248
ha_innopart::alter_table_flags
uint alter_table_flags(uint flags)
Returned supported alter table flags.
Definition: ha_innopart.cc:625
ha_innopart::index_first
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:1078
ha_innopart::check
int check(THD *thd, HA_CHECK_OPT *check_opt) override
Checks a partitioned table.
Definition: ha_innopart.cc:3840
row0mysql.h
ha_innopart::reset
int reset() override
Reset state of file to after 'open'.
Definition: ha_innopart.cc:4169
ha_innopart::extra
int extra(enum ha_extra_function operation) override
Extra hints from MySQL.
Definition: ha_innopart.cc:2903
ha_innopart::get_eq_range
bool get_eq_range() const override
Definition: ha_innopart.h:1031
ha_innopart::disable_indexes
int disable_indexes(uint mode) override
Disable indexes.
Definition: ha_innopart.h:476
ha_innopart::enable_indexes
int enable_indexes(uint mode) override
Enable indexes.
Definition: ha_innopart.h:478
Partition_helper
Partition_helper is a helper class that implements most generic partitioning functionality such as: t...
Definition: partition_handler.h:390
thr_lock_type
thr_lock_type
Definition: thr_lock.h:50
ha_innopart::read_range_first
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:457
ha_innopart::table_flags
Table_flags table_flags() const override
Get the table flags to use for the statement.
Definition: ha_innopart.h:516
name
const string name("\"Name\"")
ut0bitset.h
ha_innobase::srv_concurrency_enter
void srv_concurrency_enter()
Enter InnoDB engine after checking max allowed threads.
Definition: ha_innodb.cc:2654
ha_innopart::update_part_elem
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:2233
ha_innopart::open
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:798
ha_innopart::inplace_alter_partition
bool inplace_alter_partition(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab)
Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_i...
Definition: handler0alter.cc:10426
partition_element
Definition: partition_element.h:107
ha_innopart::sample_end
int sample_end(void *scan_ctx) override
End sampling.
Definition: ha_innopart.cc:2098
Ha_innopart_share::open_one_table_part
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:127
ha_innopart::clone
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:1160
Partition_helper::ph_index_next_same
int ph_index_next_same(uchar *buf, uint keylen)
Read next same record.
Definition: partition_handler.cc:2185
ha_innopart::set_partition
void set_partition(uint part_id)
Change active partition.
Definition: ha_innopart.cc:1292
KEY
Definition: key.h:111
ha_innopart::cmp_ref
int cmp_ref(const uchar *ref1, const uchar *ref2) const override
Compares two 'refs'.
Definition: ha_innopart.cc:4106
Partition_helper::ph_release_auto_increment
void ph_release_auto_increment()
Release unused auto increment values.
Definition: partition_handler.cc:819
ha_innopart::check_if_incompatible_data
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:468
Partition_helper::ph_index_last
int ph_index_last(uchar *buf)
Start an index scan from rightmost record and return first record.
Definition: partition_handler.cc:2008
Parallel_reader_adapter::Load_fn
handler::Load_cbk Load_fn
Definition: row0pread-adapter.h:47
ha_innopart::change_active_index
int change_active_index(uint part_id, uint keynr)
Changes the active index of a handle.
Definition: ha_innopart.cc:1720
ha_innopart::check_if_supported_inplace_alter
enum_alter_inplace_result check_if_supported_inplace_alter(TABLE *altered_table, Alter_inplace_info *ha_alter_info) override
On-line ALTER TABLE interface.
Definition: handler0alter.cc:9815
ha_innopart::key_and_rowid_cmp
static int key_and_rowid_cmp(KEY **key_info, uchar *a, uchar *b)
Compare key and rowid.
Definition: ha_innopart.cc:2888
ha_innopart::records
int records(ha_rows *num_rows) override
Total number of rows in all used partitions.
Definition: ha_innopart.cc:3166
ha_innopart::write_row_in_new_part
int write_row_in_new_part(uint new_part) override
write row to new partition.
Definition: handler0alter.cc:10348
ha_innopart::alloc_blob_heap_array
mem_heap_t ** alloc_blob_heap_array()
Allocate the array to hold blob heaps for all partitions.
Definition: ha_innopart.cc:4122
ha_innopart::innobase_initialize_autoinc
int innobase_initialize_autoinc()
Internally called for initializing auto increment value.
Definition: ha_innopart.cc:633
handler::ha_thd
THD * ha_thd(void) const
Definition: handler.cc:2688
HA_PARTITION_FUNCTION_SUPPORTED
#define HA_PARTITION_FUNCTION_SUPPORTED
bits in Partition_handler::alter_flags():
Definition: partition_handler.h:74
enum_alter_inplace_result
enum_alter_inplace_result
Return values for check_if_supported_inplace_alter().
Definition: handler.h:193
ha_rkey_function
ha_rkey_function
Definition: my_base.h:77
Ft_hints
Wrapper for struct ft_hints.
Definition: handler.h:3543
ha_innobase
The class defining a handle to an InnoDB table.
Definition: ha_innodb.h:79
ha_innopart::truncate_partition_low
int truncate_partition_low(dd::Table *dd_table) override
Truncate partition.
Definition: ha_innopart.cc:3072
THR_LOCK_DATA
Definition: thr_lock.h:123
ha_innobase::srv_concurrency_exit
void srv_concurrency_exit()
Leave Innodb, if no more tickets are left.
Definition: ha_innodb.cc:2658
ha_innopart::estimate_rows_upper_bound
ha_rows estimate_rows_upper_bound() override
Gives an UPPER BOUND to the number of rows in a table.
Definition: ha_innopart.cc:3365
gis::length
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:75
Parallel_reader_adapter
Traverse an index in the leaf page block list order and send records to adapter.
Definition: row0pread-adapter.h:42
ha_innopart::get_partition_handler
Partition_handler * get_partition_handler() override
Definition: ha_innopart.h:539
upd_node_t
Definition: row0upd.h:668
ha_innopart::initialize_auto_increment
int initialize_auto_increment(bool) override
Helpers needed by Partition_helper,.
Definition: ha_innopart.cc:643
myf
int myf
Definition: my_inttypes.h:93
ha_innopart::read_range_next
int read_range_next() override
Read next row between two endpoints.
Definition: ha_innopart.h:508
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Partition_handler
Class for partitioning specific operations.
Definition: partition_handler.h:192
ha_innopart::~ha_innopart
~ha_innopart() override
Destruct ha_innopart handler.
Definition: ha_innopart.cc:620
enum_sampling_method
enum_sampling_method
Definition: handler.h:695
ha_innopart::position
void position(const uchar *record) override
Store a reference to the current row to 'ref' field of the handle.
Definition: ha_innopart.h:463
ha_rows
my_off_t ha_rows
Definition: my_base.h:1132
COMPATIBLE_DATA_NO
#define COMPATIBLE_DATA_NO
Definition: handler.h:787
partition_handler.h
privilege_status::error
@ error
ha_innopart::copy_cached_row
void copy_cached_row(uchar *buf, const uchar *cached_row) override
Copy a cached MySQL record.
Definition: ha_innopart.cc:110
Field
Definition: field.h:695
HA_CAN_FULLTEXT_EXT
#define HA_CAN_FULLTEXT_EXT
Definition: handler.h:412
ha_innopart::prepare_inplace_alter_partition
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:10380
ha_innopart::clear_ins_upd_nodes
void clear_ins_upd_nodes()
Clear used ins_nodes and upd_nodes.
Definition: ha_innopart.cc:1177
ha_innopart::m_ins_node_parts
ins_node_t ** m_ins_node_parts
ins_node per partition.
Definition: ha_innopart.h:591
Partition_helper::ph_rnd_end
int ph_rnd_end()
End of a table scan.
Definition: partition_handler.cc:1539
dd::Partition
Definition: partition.h:50
ha_innopart::rnd_pos_by_record
int rnd_pos_by_record(uchar *record) override
Read row using position using given record to find.
Definition: ha_innopart.cc:4187
Partition_helper::ph_write_row
int ph_write_row(uchar *buf)
INSERT/UPDATE/DELETE functions.
Definition: partition_handler.cc:466
ha_innopart::m_new_partitions
Altered_partitions * m_new_partitions
New partitions during ADD/REORG/...
Definition: ha_innopart.h:631
ha_innopart::index_read_map_in_part
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
partition_info
Definition: partition_info.h:208
key_range
Definition: my_base.h:1116
ha_innopart::delete_all_rows
int delete_all_rows() override
Delete all rows from the table.
Definition: ha_innopart.h:474
ha_innopart::index_last_in_part
int index_last_in_part(uint part, uchar *record) override
Return last record in index from a partition.
Definition: ha_innopart.cc:1844
ha_innopart::index_end
int index_end() override
End index cursor.
Definition: ha_innopart.cc:1530
Partition_helper::ph_rnd_next
int ph_rnd_next(uchar *buf)
Read next row during full table scan (scan in random row order).
Definition: partition_handler.cc:1586
ha_innopart
The class defining a partitioning aware handle to an InnoDB table.
Definition: ha_innopart.h:213
Ha_innopart_share::m_index_mapping
dict_index_t ** m_index_mapping
Instead of INNOBASE_SHARE::idx_trans_tbl.
Definition: ha_innopart.h:66
ha_innopart::set_part_info
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:543
index
char * index(const char *, int c)
Definition: mysql.cc:2875
ha_innopart::sample_next
int sample_next(void *scan_ctx, uchar *buf) override
Get the next record for sampling.
Definition: ha_innopart.cc:2081
HA_CREATE_INFO
Definition: handler.h:2628
ha_innopart::was_semi_consistent_read
bool was_semi_consistent_read() override
Was the last returned row semi consistent read.
Definition: ha_innopart.cc:1388
HA_INNOPART_DISABLED_TABLE_FLAGS
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:52
Partition_helper::ph_delete_row
int ph_delete_row(const uchar *buf)
Delete an existing row in the partitioned table.
Definition: partition_handler.cc:677
ha_innopart::m_trx_id_parts
trx_id_t * m_trx_id_parts
trx_id from the partitions table->def_trx_id.
Definition: ha_innopart.h:604
flag
static int flag
Definition: hp_test1.cc:39
Partition_share
Partition specific Handler_share.
Definition: partition_handler.h:102
Ha_innopart_share::m_ref_count
uint m_ref_count
Reference count.
Definition: ha_innopart.h:75
flags
static int flags[50]
Definition: hp_test1.cc:39
FT_INFO
Definition: ft_global.h:71
ha_innopart::update_partition
void update_partition(uint part_id)
Update active partition.
Definition: ha_innopart.cc:1332
ha_innopart::set_eq_range
void set_eq_range(bool eq_range_arg) override
Definition: ha_innopart.h:1033
HA_ERR_WRONG_COMMAND
#define HA_ERR_WRONG_COMMAND
Command not supported.
Definition: my_base.h:835
ha_innopart::m_bitset
byte * m_bitset
byte array for sql_stat_start bitset
Definition: ha_innopart.h:610