MySQL  8.0.19
Source Code Documentation
ha_innodb.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2000, 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 #ifndef ha_innodb_h
28 #define ha_innodb_h
29 
30 /* The InnoDB handler: the interface between MySQL and InnoDB. */
31 
32 #include <sys/types.h>
33 #include "handler.h"
34 #include "my_dbug.h"
35 #include "row0pread-adapter.h"
36 #include "row0pread-histogram.h"
37 #include "trx0trx.h"
38 
39 /** "GEN_CLUST_INDEX" is the name reserved for InnoDB default
40 system clustered index when there is no primary key. */
41 extern const char innobase_index_reserve_name[];
42 
43 /* Structure defines translation table between mysql index and InnoDB
44 index structures */
46  ulint index_count; /*!< number of valid index entries
47  in the index_mapping array */
48 
49  ulint array_size; /*!< array size of index_mapping */
50 
51  dict_index_t **index_mapping; /*!< index pointer array directly
52  maps to index in InnoDB from MySQL
53  array index */
54 };
55 
56 /** InnoDB table share */
58  const char *table_name; /*!< InnoDB table name */
59  uint use_count; /*!< reference count,
60  incremented in get_share()
61  and decremented in
62  free_share() */
64  /*!< hash table chain node */
65  innodb_idx_translate_t idx_trans_tbl; /*!< index translation table between
66  MySQL and InnoDB */
67 };
68 
69 /** Prebuilt structures in an InnoDB table handle used within MySQL */
70 struct row_prebuilt_t;
71 
72 namespace dd {
73 namespace cache {
74 class Dictionary_client;
75 }
76 } // namespace dd
77 
78 /** The class defining a handle to an InnoDB table */
79 class ha_innobase : public handler {
80  public:
81  ha_innobase(handlerton *hton, TABLE_SHARE *table_arg);
82  ~ha_innobase() override;
83 
84  row_type get_real_row_type(const HA_CREATE_INFO *create_info) const override;
85 
86  const char *table_type() const override;
87 
88  enum ha_key_alg get_default_index_algorithm() const override {
89  return HA_KEY_ALG_BTREE;
90  }
91 
92  /** Check if SE supports specific key algorithm. */
93  bool is_index_algorithm_supported(enum ha_key_alg key_alg) const override {
94  /* This method is never used for FULLTEXT or SPATIAL keys.
95  We rely on handler::ha_table_flags() to check if such keys
96  are supported. */
97  DBUG_ASSERT(key_alg != HA_KEY_ALG_FULLTEXT && key_alg != HA_KEY_ALG_RTREE);
98  return key_alg == HA_KEY_ALG_BTREE;
99  }
100 
101  Table_flags table_flags() const override;
102 
103  ulong index_flags(uint idx, uint part, bool all_parts) const override;
104 
105  uint max_supported_keys() const override;
106 
107  uint max_supported_key_length() const override;
108 
110  HA_CREATE_INFO *create_info) const override;
111 
112  int open(const char *name, int, uint open_flags,
113  const dd::Table *table_def) override;
114 
115  handler *clone(const char *name, MEM_ROOT *mem_root) override;
116 
117  int close(void) override;
118 
119  double scan_time() override;
120 
121  double read_time(uint index, uint ranges, ha_rows rows) override;
122 
123  longlong get_memory_buffer_size() const override;
124 
125  int write_row(uchar *buf) override;
126 
127  int update_row(const uchar *old_data, uchar *new_data) override;
128 
129  int delete_row(const uchar *buf) override;
130 
131  /** Delete all rows from the table.
132  @retval HA_ERR_WRONG_COMMAND if the table is transactional
133  @retval 0 on success */
134  int delete_all_rows() override;
135 
136  bool was_semi_consistent_read() override;
137 
138  void try_semi_consistent_read(bool yes) override;
139 
140  void unlock_row() override;
141 
142  int index_init(uint index, bool sorted) override;
143 
144  int index_end() override;
145 
146  int index_read(uchar *buf, const uchar *key, uint key_len,
147  ha_rkey_function find_flag) override;
148 
149  int index_read_last(uchar *buf, const uchar *key, uint key_len) override;
150 
151  int index_next(uchar *buf) override;
152 
153  int index_next_same(uchar *buf, const uchar *key, uint keylen) override;
154 
155  int index_prev(uchar *buf) override;
156 
157  int index_first(uchar *buf) override;
158 
159  int index_last(uchar *buf) override;
160 
161  int read_range_first(const key_range *start_key, const key_range *end_key,
162  bool eq_range_arg, bool sorted) override;
163 
164  int read_range_next() override;
165 
166  int rnd_init(bool scan) override;
167 
168  int rnd_end() override;
169 
170  int rnd_next(uchar *buf) override;
171 
172  int rnd_pos(uchar *buf, uchar *pos) override;
173 
174  int ft_init() override;
175 
176  void ft_end();
177 
178  FT_INFO *ft_init_ext(uint flags, uint inx, String *key) override;
179 
181  Ft_hints *hints) override;
182 
183  int ft_read(uchar *buf) override;
184 
185  void position(const uchar *record) override;
186 
187  int info(uint) override;
188 
189  int enable_indexes(uint mode) override;
190 
191  int disable_indexes(uint mode) override;
192 
193  int analyze(THD *thd, HA_CHECK_OPT *check_opt) override;
194 
195  int optimize(THD *thd, HA_CHECK_OPT *check_opt) override;
196 
197  int discard_or_import_tablespace(bool discard, dd::Table *table_def) override;
198 
199  int extra(ha_extra_function operation) override;
200 
201  int reset() override;
202 
203  int external_lock(THD *thd, int lock_type) override;
204 
205  /** Initialize sampling.
206  @param[out] scan_ctx A scan context created by this method that has to be
207  used in sample_next
208  @param[in] sampling_percentage percentage of records that need to be sampled
209  @param[in] sampling_seed random seed that the random generator will use
210  @param[in] sampling_method sampling method to be used; currently only
211  SYSTEM sampling is supported
212  @return 0 for success, else one of the HA_xxx values in case of error. */
213  int sample_init(void *&scan_ctx, double sampling_percentage,
214  int sampling_seed,
215  enum_sampling_method sampling_method) override;
216 
217  /** Get the next record for sampling.
218  @param[in] scan_ctx Scan context of the sampling
219  @param[in] buf buffer to place the read record
220  @return 0 for success, else one of the HA_xxx values in case of error. */
221  int sample_next(void *scan_ctx, uchar *buf) override;
222 
223  /** End sampling.
224  @param[in] scan_ctx Scan context of the sampling
225  @return 0 for success, else one of the HA_xxx values in case of error. */
226  int sample_end(void *scan_ctx) override;
227 
228  /** MySQL calls this function at the start of each SQL statement
229  inside LOCK TABLES. Inside LOCK TABLES the "::external_lock" method
230  does not work to mark SQL statement borders. Note also a special case:
231  if a temporary table is created inside LOCK TABLES, MySQL has not
232  called external_lock() at all on that table.
233  MySQL-5.0 also calls this before each statement in an execution of a
234  stored procedure. To make the execution more deterministic for
235  binlogging, MySQL-5.0 locks all tables involved in a stored procedure
236  with full explicit table locks (thd_in_lock_tables(thd) holds in
237  store_lock()) before executing the procedure.
238  @param[in] thd handle to the user thread
239  @param[in] lock_type lock type
240  @return 0 or error code */
241  int start_stmt(THD *thd, thr_lock_type lock_type) override;
242 
243  void position(uchar *record);
244 
245  int records(ha_rows *num_rows) override;
246 
247  int records_from_index(ha_rows *num_rows, uint) override {
248  /* Force use of cluster index until we implement sec index parallel scan. */
249  return ha_innobase::records(num_rows);
250  }
251 
252  ha_rows records_in_range(uint inx, key_range *min_key,
253  key_range *max_key) override;
254 
256 
257  void update_create_info(HA_CREATE_INFO *create_info) override;
258 
259  /** Get storage-engine private data for a data dictionary table.
260  @param[in,out] dd_table data dictionary table definition
261  @param reset reset counters
262  @retval true an error occurred
263  @retval false success */
264  bool get_se_private_data(dd::Table *dd_table, bool reset) override;
265 
266  /** Add hidden columns and indexes to an InnoDB table definition.
267  @param[in,out] dd_table data dictionary cache object
268  @return error number
269  @retval 0 on success */
271  const List<Create_field> *, const KEY *, uint,
272  dd::Table *dd_table) override;
273 
274  /** Set Engine specific data to dd::Table object for upgrade.
275  @param[in,out] thd thread handle
276  @param[in] db_name database name
277  @param[in] table_name table name
278  @param[in,out] dd_table data dictionary cache object
279  @return 0 on success, non-zero on failure */
280  bool upgrade_table(THD *thd, const char *db_name, const char *table_name,
281  dd::Table *dd_table) override;
282 
283  /** Create an InnoDB table.
284  @param[in] name table name in filename-safe encoding
285  @param[in] form table structure
286  @param[in] create_info more information
287  @param[in,out] table_def dd::Table describing table to be
288  created. Can be adjusted by SE, the changes will be saved into data-dictionary
289  at statement commit time.
290  @return error number
291  @retval 0 on success */
292  int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info,
293  dd::Table *table_def) override;
294 
295  /** Drop a table.
296  @param[in] name table name
297  @param[in] table_def dd::Table describing table to
298  be dropped
299  @return error number
300  @retval 0 on success */
301  int delete_table(const char *name, const dd::Table *table_def) override;
302 
303  protected:
304  /** Drop a table.
305  @param[in] name table name
306  @param[in] table_def dd::Table describing table to
307  be dropped
308  @param[in] sqlcom type of operation that the DROP is part of
309  @return error number
310  @retval 0 on success */
311  int delete_table(const char *name, const dd::Table *table_def,
312  enum enum_sql_command sqlcom);
313 
314  public:
315  int rename_table(const char *from, const char *to,
316  const dd::Table *from_table, dd::Table *to_table) override;
317 
318  int check(THD *thd, HA_CHECK_OPT *check_opt) override;
319 
320  uint lock_count(void) const override;
321 
323  thr_lock_type lock_type) override;
324 
325  void init_table_handle_for_HANDLER() override;
326 
327  virtual void get_auto_increment(ulonglong offset, ulonglong increment,
328  ulonglong nb_desired_values,
329  ulonglong *first_value,
330  ulonglong *nb_reserved_values) override;
331 
332  virtual bool get_error_message(int error, String *buf) override;
333 
334  virtual bool get_foreign_dup_key(char *, uint, char *, uint) override;
335 
336  bool primary_key_is_clustered() const override;
337 
338  int cmp_ref(const uchar *ref1, const uchar *ref2) const override;
339 
340  /** On-line ALTER TABLE interface @see handler0alter.cc @{ */
341 
342  /** Check if InnoDB supports a particular alter table in-place
343  @param altered_table TABLE object for new version of table.
344  @param ha_alter_info Structure describing changes to be done
345  by ALTER TABLE and holding data used during in-place alter.
346 
347  @retval HA_ALTER_INPLACE_NOT_SUPPORTED Not supported
348  @retval HA_ALTER_INPLACE_NO_LOCK Supported
349  @retval HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE
350  Supported, but requires lock during main phase and
351  exclusive lock during prepare phase.
352  @retval HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE
353  Supported, prepare phase requires exclusive lock. */
355  TABLE *altered_table, Alter_inplace_info *ha_alter_info) override;
356 
357  /** Allows InnoDB to update internal structures with concurrent
358  writes blocked (provided that check_if_supported_inplace_alter()
359  did not return HA_ALTER_INPLACE_NO_LOCK).
360  This will be invoked before inplace_alter_table().
361 
362  @param[in] altered_table TABLE object for new version of table.
363  @param[in,out] ha_alter_info Structure describing changes to be done
364  by ALTER TABLE and holding data used during in-place alter.
365  @param[in] old_dd_tab dd::Table object describing old version
366  of the table.
367  @param[in,out] new_dd_tab dd::Table object for the new version of
368  the table. Can be adjusted by this call. Changes to the table definition will
369  be persisted in the data-dictionary at statement commit time.
370 
371  @retval true Failure
372  @retval false Success
373  */
374  bool prepare_inplace_alter_table(TABLE *altered_table,
375  Alter_inplace_info *ha_alter_info,
376  const dd::Table *old_dd_tab,
377  dd::Table *new_dd_tab) override;
378 
379  /** Alter the table structure in-place with operations
380  specified using HA_ALTER_FLAGS and Alter_inplace_information.
381  The level of concurrency allowed during this operation depends
382  on the return value from check_if_supported_inplace_alter().
383 
384  @param[in] altered_table TABLE object for new version of table.
385  @param[in,out] ha_alter_info Structure describing changes to be done
386  by ALTER TABLE and holding data used during in-place alter.
387  @param[in] old_dd_tab dd::Table object describing old version
388  of the table.
389  @param[in,out] new_dd_tab dd::Table object for the new version of
390  the table. Can be adjusted by this call. Changes to the table definition will
391  be persisted in the data-dictionary at statement commit time.
392 
393  @retval true Failure
394  @retval false Success
395  */
396  bool inplace_alter_table(TABLE *altered_table,
397  Alter_inplace_info *ha_alter_info,
398  const dd::Table *old_dd_tab,
399  dd::Table *new_dd_tab) override;
400 
401  /** Commit or rollback the changes made during
402  prepare_inplace_alter_table() and inplace_alter_table() inside
403  the storage engine. Note that the allowed level of concurrency
404  during this operation will be the same as for
405  inplace_alter_table() and thus might be higher than during
406  prepare_inplace_alter_table(). (E.g concurrent writes were
407  blocked during prepare, but might not be during commit).
408 
409  @param[in] altered_table TABLE object for new version of table.
410  @param[in,out] ha_alter_info Structure describing changes to be done
411  by ALTER TABLE and holding data used during in-place alter.
412  @param commit true => Commit, false => Rollback.
413  @param old_dd_tab dd::Table object describing old version
414  of the table.
415  @param new_dd_tab dd::Table object for the new version of the
416  table. Can be adjusted by this call. Changes to the table
417  definition will be persisted in the data-dictionary at statement
418  commit time.
419  @retval true Failure
420  @retval false Success
421  */
422  bool commit_inplace_alter_table(TABLE *altered_table,
423  Alter_inplace_info *ha_alter_info,
424  bool commit, const dd::Table *old_dd_tab,
425  dd::Table *new_dd_tab) override;
426  /** @} */
427 
429 
430  /** Initializes a parallel scan. It creates a scan_ctx that has to
431  be used across all parallel_scan methods. Also, gets the number of threads
432  that would be spawned for parallel scan.
433  @param[out] scan_ctx A scan context created by this method
434  that has to be used in
435  parallel_scan
436  @param[out] num_threads Number of threads to be spawned
437  @return error code
438  @retval 0 on success */
439  int parallel_scan_init(void *&scan_ctx, size_t &num_threads) override;
440 
441  /** Start parallel read of InnoDB records.
442  @param[in] scan_ctx A scan context created by parallel_scan_init
443  @param[in] thread_ctxs Context for each of the spawned threads
444  @param[in] init_fn Callback called by each parallel load
445  thread at the beginning of the parallel load.
446  @param[in] load_fn Callback called by each parallel load
447  thread when processing of rows is required.
448  @param[in] end_fn Callback called by each parallel load
449  thread when processing of rows has ended.
450  @return error code
451  @retval 0 on success */
452  int parallel_scan(void *scan_ctx, void **thread_ctxs, Reader::Init_fn init_fn,
453  Reader::Load_fn load_fn, Reader::End_fn end_fn) override;
454 
455  /** End of the parallel scan.
456  @param[in] scan_ctx A scan context created by parallel_scan_init.
457  @return error code
458  @retval 0 on success */
459  int parallel_scan_end(void *scan_ctx) override;
460 
462  uint table_changes) override;
463 
464  private:
465  /** @name Multi Range Read interface @{ */
466 
467  /** Initialize multi range read @see DsMrr_impl::dsmrr_init
468  @param seq
469  @param seq_init_param
470  @param n_ranges
471  @param mode
472  @param buf */
473  int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
474  uint n_ranges, uint mode,
475  HANDLER_BUFFER *buf) override;
476 
477  /** Process next multi range read @see DsMrr_impl::dsmrr_next
478  @param range_info */
479  int multi_range_read_next(char **range_info) override;
480 
481  /** Initialize multi range read and get information.
482  @see ha_myisam::multi_range_read_info_const
483  @see DsMrr_impl::dsmrr_info_const
484  @param keyno
485  @param seq
486  @param seq_init_param
487  @param n_ranges
488  @param bufsz
489  @param flags
490  @param cost */
492  void *seq_init_param, uint n_ranges,
493  uint *bufsz, uint *flags,
494  Cost_estimate *cost) override;
495 
496  /** Initialize multi range read and get information.
497  @see DsMrr_impl::dsmrr_info
498  @param keyno
499  @param n_ranges
500  @param keys
501  @param bufsz
502  @param flags
503  @param cost */
504  ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
505  uint *bufsz, uint *flags,
506  Cost_estimate *cost) override;
507 
508  /** Attempt to push down an index condition.
509  @param[in] keyno MySQL key number
510  @param[in] idx_cond Index condition to be checked
511  @return idx_cond if pushed; NULL if not pushed */
512  Item *idx_cond_push(uint keyno, Item *idx_cond) override;
513  /* @} */
514 
515  private:
516  void update_thd();
517 
518  int change_active_index(uint keynr);
519 
521 
523 
525 
527 
528  /** Resets a query execution 'template'.
529  @see build_template() */
530  void reset_template();
531 
532  /** Write Row Interface optimized for Intrinsic table. */
534 
535  /** Find out if a Record_buffer is wanted by this handler, and what is
536  the maximum buffer size the handler wants.
537 
538  @param[out] max_rows gets set to the maximum number of records to
539  allocate space for in the buffer
540  @retval true if the handler wants a buffer
541  @retval false if the handler does not want a buffer */
542  bool is_record_buffer_wanted(ha_rows *const max_rows) const override;
543 
544  /** TRUNCATE an InnoDB table.
545  @param[in] name table name
546  @param[in] form table definition
547  @param[in,out] table_def dd::Table describing table to be
548  truncated. Can be adjusted by SE, the changes will be saved into
549  the data-dictionary at statement commit time.
550  @return error number
551  @retval 0 on success */
552  int truncate_impl(const char *name, TABLE *form, dd::Table *table_def);
553 
554  protected:
555  /** Enter InnoDB engine after checking max allowed threads */
556  void srv_concurrency_enter();
557 
558  /** Leave Innodb, if no more tickets are left */
559  void srv_concurrency_exit();
560 
561  void update_thd(THD *thd);
562 
563  int general_fetch(uchar *buf, uint direction, uint match_mode);
564 
565  virtual dict_index_t *innobase_get_index(uint keynr);
566 
567  /** Builds a 'template' to the prebuilt struct.
568 
569  The template is used in fast retrieval of just those column
570  values MySQL needs in its processing.
571  @param whole_row true if access is needed to a whole row,
572  false if accessing individual fields is enough */
573  void build_template(bool whole_row);
574 
575  /** Returns statistics information of the table to the MySQL
576  interpreter, in various fields of the handle object.
577  @param[in] flag what information is requested
578  @param[in] is_analyze True if called from "::analyze()"
579  @return HA_ERR_* error code or 0 */
580  virtual int info_low(uint flag, bool is_analyze);
581 
582  /**
583  MySQL calls this method at the end of each statement. This method
584  exists for readability only, called from reset(). The name reset()
585  doesn't give any clue that it is called at the end of a statement. */
586  int end_stmt();
587 
588  /** Implementation of prepare_inplace_alter_table()
589  @tparam Table dd::Table or dd::Partition
590  @param[in] altered_table TABLE object for new version of table.
591  @param[in,out] ha_alter_info Structure describing changes to be done
592  by ALTER TABLE and holding data used
593  during in-place alter.
594  @param[in] old_dd_tab dd::Table object representing old
595  version of the table
596  @param[in,out] new_dd_tab dd::Table object representing new
597  version of the table
598  @retval true Failure
599  @retval false Success */
600  template <typename Table>
601  bool prepare_inplace_alter_table_impl(TABLE *altered_table,
602  Alter_inplace_info *ha_alter_info,
603  const Table *old_dd_tab,
604  Table *new_dd_tab);
605 
606  /** Implementation of inplace_alter_table()
607  @tparam Table dd::Table or dd::Partition
608  @param[in] altered_table TABLE object for new version of table.
609  @param[in,out] ha_alter_info Structure describing changes to be done
610  by ALTER TABLE and holding data used
611  during in-place alter.
612  @param[in] old_dd_tab dd::Table object representing old
613  version of the table
614  @param[in,out] new_dd_tab dd::Table object representing new
615  version of the table
616  @retval true Failure
617  @retval false Success */
618  template <typename Table>
619  bool inplace_alter_table_impl(TABLE *altered_table,
620  Alter_inplace_info *ha_alter_info,
621  const Table *old_dd_tab, Table *new_dd_tab);
622 
623  /** Implementation of commit_inplace_alter_table()
624  @tparam Table dd::Table or dd::Partition
625  @param[in] altered_table TABLE object for new version of table.
626  @param[in,out] ha_alter_info Structure describing changes to be done
627  by ALTER TABLE and holding data used
628  during in-place alter.
629  @param[in] commit True to commit or false to rollback.
630  @param[in] old_dd_tab Table object describing old version
631  of the table.
632  @param[in,out] new_dd_tab Table object for the new version of the
633  table. Can be adjusted by this call.
634  Changes to the table definition
635  will be persisted in the data-dictionary
636  at statement version of it.
637  @retval true Failure
638  @retval false Success */
639  template <typename Table>
640  bool commit_inplace_alter_table_impl(TABLE *altered_table,
641  Alter_inplace_info *ha_alter_info,
642  bool commit, const Table *old_dd_tab,
643  Table *new_dd_tab);
644 
645  /**
646  Return max limits for a single set of multi-valued keys
647 
648  @param[out] num_keys number of keys to store
649  @param[out] keys_length total length of keys, bytes
650  */
651  void mv_key_capacity(uint *num_keys, size_t *keys_length) const override;
652 
653  /** The multi range read session object */
655 
656  /** Save CPU time with prebuilt/cached data structures */
658 
659  /** Thread handle of the user currently using the handler;
660  this is set in external_lock function */
662 
663  /** information for MySQL table locking */
665 
666  /** buffer used in updates */
668 
669  /** the size of upd_buf in bytes */
671 
672  /** Flags that specificy the handler instance (table) capability. */
674 
675  /** this is set to 1 when we are starting a table scan but have
676  not yet fetched any row, else false */
678 
679  /*!< match mode of the latest search: ROW_SEL_EXACT,
680  ROW_SEL_EXACT_PREFIX, or undefined */
682 
683  /** this field is used to remember the original select_lock_type that
684  was decided in ha_innodb.cc,":: store_lock()", "::external_lock()",
685  etc. */
687 
688  /** If mysql has locked with external_lock() */
690 };
691 
692 struct trx_t;
693 
694 extern const struct _ft_vft ft_vft_result;
695 
696 /** Return the number of read threads for this session.
697 @param[in] thd Session instance, or nullptr to query the global
698  innodb_parallel_read_threads value. */
700 
701 /** Structure Returned by ha_innobase::ft_init_ext() */
702 typedef struct new_ft_info {
703  struct _ft_vft *please;
707 } NEW_FT_INFO;
708 
709 /** Allocates an InnoDB transaction for a MySQL handler object for DML.
710 @param[in] hton Innobase handlerton.
711 @param[in] thd MySQL thd (connection) object.
712 @param[in] trx transaction to register. */
713 void innobase_register_trx(handlerton *hton, THD *thd, trx_t *trx);
714 
715 /**
716 Allocates an InnoDB transaction for a MySQL handler object.
717 @return InnoDB transaction handle */
718 trx_t *innobase_trx_allocate(THD *thd); /*!< in: user thread handle */
719 
720 /** Match index columns between MySQL and InnoDB.
721 This function checks whether the index column information
722 is consistent between KEY info from mysql and that from innodb index.
723 @param[in] key_info Index info from mysql
724 @param[in] index_info Index info from InnoDB
725 @return true if all column types match. */
726 bool innobase_match_index_columns(const KEY *key_info,
727  const dict_index_t *index_info);
728 
729 /** This function checks each index name for a table against reserved
730  system default primary index name 'GEN_CLUST_INDEX'. If a name
731  matches, this function pushes an warning message to the client,
732  and returns true.
733  @return true if the index name matches the reserved name */
735  THD *thd, /*!< in/out: MySQL connection */
736  const KEY *key_info, /*!< in: Indexes to be
737  created */
738  ulint num_of_keys) /*!< in: Number of indexes to
739  be created. */
740  MY_ATTRIBUTE((warn_unused_result));
741 
742 /** Check if the explicit tablespace targeted is file_per_table.
743 @param[in] create_info Metadata for the table to create.
744 @return true if the table is intended to use a file_per_table tablespace. */
745 UNIV_INLINE
747  return (create_info->tablespace != NULL &&
748  (0 ==
749  strcmp(create_info->tablespace, dict_sys_t::s_file_per_table_name)));
750 }
751 
752 /** Check if table will be explicitly put in an existing shared general
753 or system tablespace.
754 @param[in] create_info Metadata for the table to create.
755 @return true if the table will use a shared general or system tablespace. */
756 UNIV_INLINE
757 bool tablespace_is_shared_space(const HA_CREATE_INFO *create_info) {
758  return (create_info->tablespace != NULL &&
759  create_info->tablespace[0] != '\0' &&
760  (0 !=
761  strcmp(create_info->tablespace, dict_sys_t::s_file_per_table_name)));
762 }
763 
764 /** Check if table will be explicitly put in a general tablespace.
765 @param[in] create_info Metadata for the table to create.
766 @return true if the table will use a general tablespace. */
767 UNIV_INLINE
768 bool tablespace_is_general_space(const HA_CREATE_INFO *create_info) {
769  return (
770  create_info->tablespace != NULL && create_info->tablespace[0] != '\0' &&
771  (0 !=
772  strcmp(create_info->tablespace, dict_sys_t::s_file_per_table_name)) &&
773  (0 != strcmp(create_info->tablespace, dict_sys_t::s_temp_space_name)) &&
774  (0 != strcmp(create_info->tablespace, dict_sys_t::s_sys_space_name)));
775 }
776 
777 /** Check if tablespace is shared tablespace.
778 @param[in] tablespace_name Name of the tablespace
779 @return true if tablespace is a shared tablespace. */
780 UNIV_INLINE
781 bool is_shared_tablespace(const char *tablespace_name) {
782  if (tablespace_name != NULL && tablespace_name[0] != '\0' &&
783  (strcmp(tablespace_name, dict_sys_t::s_file_per_table_name) != 0)) {
784  return true;
785  }
786  return false;
787 }
788 
789 /** Parse hint for table and its indexes, and update the information
790 in dictionary.
791 @param[in] thd Connection thread
792 @param[in,out] table Target table
793 @param[in] table_share Table definition */
795  const TABLE_SHARE *table_share);
796 
797 /** Obtain the InnoDB transaction of a MySQL thread.
798 @param[in,out] thd MySQL thread handler.
799 @return reference to transaction pointer */
800 trx_t *&thd_to_trx(THD *thd);
801 
802 /** Class for handling create table information. */
804  public:
805  /** Constructor.
806  Used in two ways:
807  - all but file_per_table is used, when creating the table.
808  - all but name/path is used, when validating options and using flags. */
810  char *table_name, char *remote_path, char *tablespace,
811  bool file_per_table, bool skip_strict, uint32_t old_flags,
812  uint32_t old_flags2)
813  : m_thd(thd),
814  m_trx(thd_to_trx(thd)),
815  m_form(form),
816  m_create_info(create_info),
818  m_remote_path(remote_path),
819  m_tablespace(tablespace),
820  m_innodb_file_per_table(file_per_table),
821  m_flags(old_flags),
822  m_flags2(old_flags2),
824 
825  /** Initialize the object. */
826  int initialize();
827 
828  /** Set m_tablespace_type. */
829  void set_tablespace_type(bool table_being_altered_is_file_per_table);
830 
831  /** Create the internal innodb table.
832  @param[in] dd_table dd::Table or nullptr for intrinsic table
833  @return 0 or error number */
834  int create_table(const dd::Table *dd_table);
835 
836  /** Update the internal data dictionary. */
838 
839  /** Update the global data dictionary.
840  @param[in] dd_table table object
841  @return 0 On success
842  @retval error number On failure*/
843  template <typename Table>
844  int create_table_update_global_dd(Table *dd_table);
845 
846  /** Validates the create options. Checks that the options
847  KEY_BLOCK_SIZE, ROW_FORMAT, DATA DIRECTORY, TEMPORARY & TABLESPACE
848  are compatible with each other and other settings.
849  These CREATE OPTIONS are not validated here unless innodb_strict_mode
850  is on. With strict mode, this function will report each problem it
851  finds using a custom message with error code
852  ER_ILLEGAL_HA_CREATE_OPTION, not its built-in message.
853  @return NULL if valid, string name of bad option if not. */
854  const char *create_options_are_invalid();
855 
856  /** Validate DATA DIRECTORY option. */
858  /** Validate TABLESPACE option. */
860 
861  /** Validate COMPRESSION option. */
863 
864  /** Prepare to create a table. */
865  int prepare_create_table(const char *name);
866 
867  /** Determines InnoDB table flags.
868  If strict_mode=OFF, this will adjust the flags to what should be assumed.
869  @retval true if successful, false if error */
870  bool innobase_table_flags();
871 
872  /** Set flags and append '/' to remote path if necessary. */
873  void set_remote_path_flags();
874 
875  /** Get table flags. */
876  uint32_t flags() const { return (m_flags); }
877 
878  /** Get table flags2. */
879  uint32_t flags2() const { return (m_flags2); }
880 
881  /** Reset table flags. */
882  void flags_reset() { m_flags = 0; }
883 
884  /** Reset table flags2. */
885  void flags2_reset() { m_flags2 = 0; }
886 
887  /** whether to skip strict check. */
888  bool skip_strict() const { return (m_skip_strict); }
889 
890  /** Return table name. */
891  const char *table_name() const { return (m_table_name); }
892 
893  THD *thd() const { return (m_thd); }
894 
895  inline bool is_intrinsic_temp_table() const {
896  /* DICT_TF2_INTRINSIC implies DICT_TF2_TEMPORARY */
898  return ((m_flags2 & DICT_TF2_INTRINSIC) != 0);
899  }
900 
901  /** @return true only if table is temporary and not intrinsic */
902  inline bool is_temp_table() const {
903  return (((m_flags2 & DICT_TF2_TEMPORARY) != 0) &&
904  ((m_flags2 & DICT_TF2_INTRINSIC) == 0));
905  }
906 
907  /** Detach the just created table and its auxiliary tables if exist. */
908  void detach();
909 
910  /** Normalizes a table name string.
911  A normalized name consists of the database name catenated to '/' and
912  table name. An example: test/mytable. On case insensitive file system
913  normalization converts name to lower case.
914  @param[in,out] norm_name Buffer to return the normalized name in.
915  @param[in] name Table name string.
916  @return true if successful. */
917  static bool normalize_table_name(char *norm_name, const char *name);
918 
919  private:
920  /** Parses the table name into normal name and either temp path or
921  remote path if needed.*/
922  int parse_table_name(const char *name);
923 
924  /** Create the internal innodb table definition.
925  @param[in] dd_table dd::Table or nullptr for intrinsic table
926  @return ER_* level error */
927  int create_table_def(const dd::Table *dd_table);
928 
929  /** Initialize the autoinc of this table if necessary, which should
930  be called before we flush logs, so autoinc counter can be persisted. */
931  void initialize_autoinc();
932 
933  /** Connection thread handle. */
935 
936  /** InnoDB transaction handle. */
938 
939  /** Information on table columns and indexes. */
940  const TABLE *m_form;
941 
942  /** Create options. */
944 
945  /** Table name */
947  /** Remote path (DATA DIRECTORY) or zero length-string */
949  /** Tablespace name or zero length-string. */
951 
952  /** The newly created InnoDB table object. This is currently only
953  used in this class, since the new table is not evictable until
954  final success/failure, it can be accessed directly. */
956 
957  /** Local copy of srv_file_per_table. */
959 
960  /** Allow file_per_table for this table either because:
961  1) the setting innodb_file_per_table=on,
962  2) it was explicitly requested by tablespace=innodb_file_per_table.
963  3) the table being altered is currently file_per_table */
965 
966  /** After all considerations, this shows whether we will actually
967  create a table and tablespace using file-per-table. */
969 
970  /** Using DATA DIRECTORY */
972 
973  /** Using a Shared General Tablespace */
975 
976  /** Table flags */
977  uint32_t m_flags;
978 
979  /** Table flags2 */
980  uint32_t m_flags2;
981 
982  /** Skip strict check */
984 };
985 
986 /** Class of basic DDL implementation, for CREATE/DROP/RENAME TABLE */
988  public:
989  /** Create an InnoDB table.
990  @tparam Table dd::Table or dd::Partition
991  @param[in,out] thd THD object
992  @param[in] name Table name, format: "db/table_name"
993  @param[in] form Table format; columns and index
994  information
995  @param[in] create_info Create info(including create statement
996  string)
997  @param[in,out] dd_tab dd::Table describing table to be created
998  @param[in] file_per_table whether to create a tablespace too
999  @param[in] evictable whether the caller wants the
1000  dict_table_t to be kept in memory
1001  @param[in] skip_strict whether to skip strict check for create
1002  option
1003  @param[in] old_flags old Table flags
1004  @param[in] old_flags2 old Table flags2
1005  @return error number
1006  @retval 0 on success */
1007  template <typename Table>
1008  static int create_impl(THD *thd, const char *name, TABLE *form,
1009  HA_CREATE_INFO *create_info, Table *dd_tab,
1010  bool file_per_table, bool evictable, bool skip_strict,
1011  ulint old_flags, ulint old_flags2);
1012 
1013  /** Drop an InnoDB table.
1014  @tparam Table dd::Table or dd::Partition
1015  @param[in,out] thd THD object
1016  @param[in] name table name
1017  @param[in] dd_tab dd::Table describing table to be dropped
1018  @return error number
1019  @retval 0 on success */
1020  template <typename Table>
1021  static int delete_impl(THD *thd, const char *name, const Table *dd_tab);
1022 
1023  /** Renames an InnoDB table.
1024  @tparam Table dd::Table or dd::Partition
1025  @param[in,out] thd THD object
1026  @param[in] from old name of the table
1027  @param[in] to new name of the table
1028  @param[in] from_table dd::Table or dd::Partition of the table
1029  with old name
1030  @param[in] to_table dd::Table or dd::Partition of the table
1031  with new name
1032  @return error number
1033  @retval 0 on success */
1034  template <typename Table>
1035  static int rename_impl(THD *thd, const char *from, const char *to,
1036  const Table *from_table, const Table *to_table);
1037 };
1038 
1039 /** Class to handle TRUNCATE for one InnoDB table or one partition */
1040 template <typename Table>
1042  public:
1043  /** Constructor
1044  @param[in] thd THD object
1045  @param[in] name normalized table name
1046  @param[in] form Table format; columns and index information
1047  @param[in] dd_table dd::Table or dd::Partition
1048  @param[in] keep_autoinc true to remember original autoinc counter */
1049  innobase_truncate(THD *thd, const char *name, TABLE *form, Table *dd_table,
1050  bool keep_autoinc)
1051  : m_thd(thd),
1052  m_name(name),
1053  m_dd_table(dd_table),
1054  m_trx(nullptr),
1055  m_table(nullptr),
1056  m_form(form),
1057  m_create_info(),
1059  m_keep_autoinc(keep_autoinc),
1060  m_flags(0),
1061  m_flags2(0) {}
1062 
1063  /** Destructor */
1065 
1066  /** Open the table/partition to be truncated
1067  @param[out] innodb_table InnoDB table object opened
1068  @return error number or 0 on success */
1069  int open_table(dict_table_t *&innodb_table);
1070 
1071  /** Do the truncate of the table/partition
1072  @return error number or 0 on success */
1073  int exec();
1074 
1075  private:
1076  /** Prepare for truncate
1077  @return error number or 0 on success */
1078  int prepare();
1079 
1080  /** Do the real truncation
1081  @return error number or 0 on success */
1082  int truncate();
1083 
1084  /** Rename tablespace file name
1085  @return error number or 0 on success */
1086  int rename_tablespace();
1087 
1088  /** Cleanup */
1089  void cleanup();
1090 
1091  /** Reload the FK related information
1092  @return error number or 0 on success */
1093  int load_fk();
1094 
1095  private:
1096  /** THD object */
1098 
1099  /** Normalized table name */
1100  const char *m_name;
1101 
1102  /** dd::Table or dd::Partition */
1104 
1105  /** Transaction attached to current thd */
1107 
1108  /** InnoDB table object for the table/partition */
1110 
1111  /** Table format */
1113 
1114  /** Create information */
1116 
1117  /** True if this table/partition is file per table */
1119 
1120  /** True if the original autoinc counter should be kept. It's
1121  specified by caller, however if the table has no AUTOINC column,
1122  it would be reset to false internally */
1124 
1125  /** flags of the table to be truncated, which should not change */
1126  uint64_t m_flags;
1127 
1128  /** flags2 of the table to be truncated, which should not change */
1129  uint64_t m_flags2;
1130 };
1131 
1132 /**
1133 Initialize the table FTS stopword list
1134 @return true if success */
1136  dict_table_t *table, /*!< in: Table has the FTS */
1137  trx_t *trx, /*!< in: transaction */
1138  THD *thd) /*!< in: current thread */
1139  MY_ATTRIBUTE((warn_unused_result));
1140 
1141 /** Some defines for innobase_fts_check_doc_id_index() return value */
1146 };
1147 
1148 /**
1149 Check whether the table has a unique index with FTS_DOC_ID_INDEX_NAME
1150 on the Doc ID column.
1151 @return the status of the FTS_DOC_ID index */
1153  const dict_table_t *table, /*!< in: table definition */
1154  const TABLE *altered_table, /*!< in: MySQL table
1155  that is being altered */
1156  ulint *fts_doc_col_no) /*!< out: The column number for
1157  Doc ID */
1158  MY_ATTRIBUTE((warn_unused_result));
1159 
1160 /**
1161 Check whether the table has a unique index with FTS_DOC_ID_INDEX_NAME
1162 on the Doc ID column in MySQL create index definition.
1163 @return FTS_EXIST_DOC_ID_INDEX if there exists the FTS_DOC_ID index,
1164 FTS_INCORRECT_DOC_ID_INDEX if the FTS_DOC_ID index is of wrong format */
1166  ulint n_key, /*!< in: Number of keys */
1167  const KEY *key_info) /*!< in: Key definitions */
1168  MY_ATTRIBUTE((warn_unused_result));
1169 
1170 /**
1171 Copy table flags from MySQL's TABLE_SHARE into an InnoDB table object.
1172 Those flags are stored in .frm file and end up in the MySQL table object,
1173 but are frequently used inside InnoDB so we keep their copies into the
1174 InnoDB table object. */
1176  dict_table_t *innodb_table, /*!< in/out: InnoDB table */
1177  const TABLE_SHARE *table_share); /*!< in: table share */
1178 
1179 /** Set up base columns for virtual column
1180 @param[in] table the InnoDB table
1181 @param[in] field MySQL field
1182 @param[in,out] v_col virtual column to be set up */
1183 void innodb_base_col_setup(dict_table_t *table, const Field *field,
1184  dict_v_col_t *v_col);
1185 
1186 /** Set up base columns for stored column
1187 @param[in] table InnoDB table
1188 @param[in] field MySQL field
1189 @param[in,out] s_col stored column */
1191  const Field *field, dict_s_col_t *s_col);
1192 
1193 /** whether this is a stored column */
1194 #define innobase_is_s_fld(field) ((field)->gcol_info && (field)->stored_in_db)
1195 
1196 /** whether this is a computed virtual column */
1197 #define innobase_is_v_fld(field) ((field)->gcol_info && !(field)->stored_in_db)
1198 
1199 /** Whether this is a computed multi-value virtual column.
1200 This condition check should be equal to the following one:
1201 (innobase_is_v_fld(field) && (field)->gcol_info->expr_item &&
1202  field->gcol_info->expr_item->returns_array())
1203 */
1204 #define innobase_is_multi_value_fld(field) (field->is_array())
1205 
1206 #define normalize_table_name(norm_name, name) \
1207  create_table_info_t::normalize_table_name(norm_name, name)
1208 
1209 /** Note that a transaction has been registered with MySQL.
1210 @param[in] trx Transaction.
1211 @return true if transaction is registered with MySQL 2PC coordinator */
1212 inline bool trx_is_registered_for_2pc(const trx_t *trx) {
1213  return (trx->is_registered == 1);
1214 }
1215 
1216 /** Converts an InnoDB error code to a MySQL error code.
1217 Also tells to MySQL about a possible transaction rollback inside InnoDB caused
1218 by a lock wait timeout or a deadlock.
1219 @param[in] error InnoDB error code.
1220 @param[in] flags InnoDB table flags or 0.
1221 @param[in] thd MySQL thread or NULL.
1222 @return MySQL error code */
1223 int convert_error_code_to_mysql(dberr_t error, uint32_t flags, THD *thd);
1224 
1225 /** Converts a search mode flag understood by MySQL to a flag understood
1226 by InnoDB.
1227 @param[in] find_flag MySQL search mode flag.
1228 @return InnoDB search mode flag. */
1230  enum ha_rkey_function find_flag);
1231 
1232 extern bool innobase_stats_on_metadata;
1233 
1234 /** Calculate Record Per Key value.
1235 Need to exclude the NULL value if innodb_stats_method is set to "nulls_ignored"
1236 @param[in] index InnoDB index.
1237 @param[in] i The column we are calculating rec per key.
1238 @param[in] records Estimated total records.
1239 @return estimated record per key value */
1241  ha_rows records);
1242 
1243 /** Build template for the virtual columns and their base columns
1244 @param[in] table MySQL TABLE
1245 @param[in] ib_table InnoDB dict_table_t
1246 @param[in,out] s_templ InnoDB template structure
1247 @param[in] add_v new virtual columns added along with
1248  add index call
1249 @param[in] locked true if innobase_share_mutex is held
1250 @param[in] share_tbl_name original MySQL table name */
1251 void innobase_build_v_templ(const TABLE *table, const dict_table_t *ib_table,
1252  dict_vcol_templ_t *s_templ,
1253  const dict_add_v_col_t *add_v, bool locked,
1254  const char *share_tbl_name);
1255 
1256 /** callback used by MySQL server layer to initialized
1257 the table virtual columns' template
1258 @param[in] table MySQL TABLE
1259 @param[in,out] ib_table InnoDB dict_table_t */
1260 void innobase_build_v_templ_callback(const TABLE *table, void *ib_table);
1261 
1262 /** Callback function definition, used by MySQL server layer to initialized
1263 the table virtual columns' template */
1264 typedef void (*my_gcolumn_templatecallback_t)(const TABLE *, void *);
1265 
1266 #endif /* ha_innodb_h */
tablespace_is_shared_space
UNIV_INLINE bool tablespace_is_shared_space(const HA_CREATE_INFO *create_info)
Check if table will be explicitly put in an existing shared general or system tablespace.
Definition: ha_innodb.h:757
innobase_fts_check_doc_id_index
fts_doc_id_index_enum innobase_fts_check_doc_id_index(const dict_table_t *table, const TABLE *altered_table, ulint *fts_doc_col_no)
Check whether the table has a unique index with FTS_DOC_ID_INDEX_NAME on the Doc ID column.
Definition: handler0alter.cc:2538
create_table_info_t::prepare_create_table
int prepare_create_table(const char *name)
Prepare to create a table.
Definition: ha_innodb.cc:12778
ha_innobase::open
int open(const char *name, int, uint open_flags, const dd::Table *table_def) override
Open an InnoDB table.
Definition: ha_innodb.cc:6621
create_table_info_t::m_remote_path
char * m_remote_path
Remote path (DATA DIRECTORY) or zero length-string.
Definition: ha_innodb.h:948
ha_innobase::m_start_of_scan
bool m_start_of_scan
this is set to 1 when we are starting a table scan but have not yet fetched any row,...
Definition: ha_innodb.h:677
Item
Definition: item.h:665
THD
Definition: sql_class.h:764
ha_innobase::m_int_table_flags
Table_flags m_int_table_flags
Flags that specificy the handler instance (table) capability.
Definition: ha_innodb.h:673
innobase_truncate
Class to handle TRUNCATE for one InnoDB table or one partition.
Definition: ha_innodb.h:1041
Alter_inplace_info
Class describing changes to be done by ALTER TABLE.
Definition: handler.h:2761
ha_innobase::try_semi_consistent_read
void try_semi_consistent_read(bool yes) override
Tell the engine whether it should avoid unnecessary lock waits.
Definition: ha_innodb.cc:9444
fts_doc_id_index_enum
fts_doc_id_index_enum
Some defines for innobase_fts_check_doc_id_index() return value.
Definition: ha_innodb.h:1142
HA_CHECK_OPT
Definition: handler.h:3194
ha_innobase::index_read_last
int index_read_last(uchar *buf, const uchar *key, uint key_len) override
The following functions works like index_read, but it find the last row with the current key value or...
Definition: ha_innodb.cc:9750
create_table_info_t::is_intrinsic_temp_table
bool is_intrinsic_temp_table() const
Definition: ha_innodb.h:895
ha_innobase::rename_table
int rename_table(const char *from, const char *to, const dd::Table *from_table, dd::Table *to_table) override
Renames an InnoDB table.
Definition: ha_innodb.cc:15541
ha_innobase::max_supported_key_part_length
uint max_supported_key_part_length(HA_CREATE_INFO *create_info) const override
Definition: ha_innodb.cc:7102
new_ft_info::ft_prebuilt
row_prebuilt_t * ft_prebuilt
Definition: ha_innodb.h:705
rules_table_service::table_name
const char * table_name
Definition: rules_table_service.cc:55
ha_innobase::sample_next
int sample_next(void *scan_ctx, uchar *buf) override
Get the next record for sampling.
Definition: ha_innodb.cc:10125
ha_innobase::max_supported_key_length
uint max_supported_key_length() const override
Returns the maximum key length.
Definition: ha_innodb.cc:5860
ha_innobase::m_stored_select_lock_type
ulint m_stored_select_lock_type
this field is used to remember the original select_lock_type that was decided in ha_innodb....
Definition: ha_innodb.h:686
is_shared_tablespace
UNIV_INLINE bool is_shared_tablespace(const char *tablespace_name)
Check if tablespace is shared tablespace.
Definition: ha_innodb.h:781
innobase_truncate::m_form
TABLE * m_form
Table format.
Definition: ha_innodb.h:1112
NULL
#define NULL
Definition: types.h:55
ha_innobase::cmp_ref
int cmp_ref(const uchar *ref1, const uchar *ref2) const override
Compares two 'refs'.
Definition: ha_innodb.cc:18756
thd_to_trx
trx_t *& thd_to_trx(THD *thd)
Obtain the InnoDB transaction of a MySQL thread.
Definition: ha_innodb.cc:1766
new_ft_info::could_you
struct _ft_vft_ext * could_you
Definition: ha_innodb.h:704
ha_innobase::is_index_algorithm_supported
bool is_index_algorithm_supported(enum ha_key_alg key_alg) const override
Check if SE supports specific key algorithm.
Definition: ha_innodb.h:93
innobase_parse_hint_from_comment
void innobase_parse_hint_from_comment(THD *thd, dict_table_t *table, const TABLE_SHARE *table_share)
Parse hint for table and its indexes, and update the information in dictionary.
Definition: ha_innodb.cc:12581
create_table_info_t::create_option_data_directory_is_valid
bool create_option_data_directory_is_valid()
Validate DATA DIRECTORY option.
Definition: ha_innodb.cc:11447
innobase_truncate::m_trx
trx_t * m_trx
Transaction attached to current thd.
Definition: ha_innodb.h:1106
innodb_base_col_setup_for_stored
void innodb_base_col_setup_for_stored(const dict_table_t *table, const Field *field, dict_s_col_t *s_col)
Set up base columns for stored column.
Definition: ha_innodb.cc:10673
my_gcolumn_templatecallback_t
void(* my_gcolumn_templatecallback_t)(const TABLE *, void *)
Callback function definition, used by MySQL server layer to initialized the table virtual columns' te...
Definition: ha_innodb.h:1264
create_table_info_t::is_temp_table
bool is_temp_table() const
Definition: ha_innodb.h:902
ha_innobase::lock_count
uint lock_count(void) const override
Returns number of THR_LOCK locks used for one instance of InnoDB table.
Definition: ha_innodb.cc:18335
create_table_info_t::create_table_info_t
create_table_info_t(THD *thd, TABLE *form, HA_CREATE_INFO *create_info, char *table_name, char *remote_path, char *tablespace, bool file_per_table, bool skip_strict, uint32_t old_flags, uint32_t old_flags2)
Constructor.
Definition: ha_innodb.h:809
ha_innobase::build_template
void build_template(bool whole_row)
Builds a 'template' to the prebuilt struct.
Definition: ha_innodb.cc:7797
record
Definition: mi_test3.cc:54
ha_innobase::disable_indexes
int disable_indexes(uint mode) override
Disable indexes.
Definition: ha_innodb.cc:17021
ut_ad
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:65
page_cur_mode_t
page_cur_mode_t
Definition: page0types.h:158
create_table_info_t::m_skip_strict
bool m_skip_strict
Skip strict check.
Definition: ha_innodb.h:983
ha_innobase::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_innodb.cc:19033
innobase_truncate::m_thd
THD * m_thd
THD object.
Definition: ha_innodb.h:1097
create_table_info_t::m_innodb_file_per_table
bool m_innodb_file_per_table
Local copy of srv_file_per_table.
Definition: ha_innodb.h:958
dict_index_t
Data structure for an index.
Definition: dict0mem.h:869
ha_innobase::enable_indexes
int enable_indexes(uint mode) override
Enable indexes.
Definition: ha_innodb.cc:16994
innobase_truncate::prepare
int prepare()
Prepare for truncate.
Definition: ha_innodb.cc:13648
innobase_register_trx
void innobase_register_trx(handlerton *hton, THD *thd, trx_t *trx)
Allocates an InnoDB transaction for a MySQL handler object for DML.
Definition: ha_innodb.cc:2731
ha_innobase::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_innodb.cc:10399
innobase_copy_frm_flags_from_table_share
void innobase_copy_frm_flags_from_table_share(dict_table_t *innodb_table, const TABLE_SHARE *table_share)
Copy table flags from MySQL's TABLE_SHARE into an InnoDB table object.
Definition: ha_innodb.cc:2629
fts_result_t
Query result.
Definition: fts0fts.h:312
create_table_info_t::initialize
int initialize()
Initialize the object.
Definition: ha_innodb.cc:12687
handlerton
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2271
pos
char * pos
Definition: do_ctype.cc:76
create_table_info_t::create_options_are_invalid
const char * create_options_are_invalid()
Validates the create options.
Definition: ha_innodb.cc:11847
ha_innobase::innobase_get_autoinc
dberr_t innobase_get_autoinc(ulonglong *value)
Read the next autoinc value.
Definition: ha_innodb.cc:18527
innobase_truncate::m_table
dict_table_t * m_table
InnoDB table object for the table/partition.
Definition: ha_innodb.h:1109
my_dbug.h
create_table_info_t::create_option_tablespace_is_valid
bool create_option_tablespace_is_valid()
Validate TABLESPACE option.
Definition: ha_innodb.cc:11585
create_table_info_t::m_trx
trx_t * m_trx
InnoDB transaction handle.
Definition: ha_innodb.h:937
innobase_truncate::exec
int exec()
Do the truncate of the table/partition.
Definition: ha_innodb.cc:13883
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
convert_error_code_to_mysql
int convert_error_code_to_mysql(dberr_t error, uint32_t flags, THD *thd)
Converts an InnoDB error code to a MySQL error code.
Definition: ha_innodb.cc:1832
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_innobase::m_mysql_has_locked
bool m_mysql_has_locked
If mysql has locked with external_lock()
Definition: ha_innodb.h:689
ha_innobase::close
int close(void) override
Closes a handle to an InnoDB table.
Definition: ha_innodb.cc:7119
ha_innobase::ft_init
int ft_init() override
Initialize FT index scan.
Definition: ha_innodb.cc:10251
longlong
long long int longlong
Definition: my_inttypes.h:54
create_table_info_t::parse_table_name
int parse_table_name(const char *name)
Parses the table name into normal name and either temp path or remote path if needed.
Definition: ha_innodb.cc:12212
Parallel_reader_adapter::Init_fn
handler::Load_init_cbk Init_fn
Definition: row0pread-adapter.h:51
ha_innobase::read_range_next
int read_range_next() override
Read next row between two endpoints.
Definition: ha_innodb.cc:10157
ha_innobase::general_fetch
int general_fetch(uchar *buf, uint direction, uint match_mode)
Reads the next or previous row from a cursor, which must have previously been positioned using index_...
Definition: ha_innodb.cc:9907
handler::Table_flags
ulonglong Table_flags
Definition: handler.h:3995
ha_innobase::intrinsic_table_write_row
int intrinsic_table_write_row(uchar *record)
Write Row Interface optimized for Intrinsic table.
Definition: ha_innodb.cc:8196
innobase_index_reserve_name
const char innobase_index_reserve_name[]
"GEN_CLUST_INDEX" is the name reserved for InnoDB default system clustered index when there is no pri...
Definition: dict0mem.h:861
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
dict_v_col_t
Data structure for a virtual column in a table.
Definition: dict0mem.h:632
dict_s_col_t
Data structure for a stored column in a table.
Definition: dict0mem.h:664
dberr_t
dberr_t
Definition: db0err.h:38
value
const string value("\"Value\"")
innobase_truncate::m_keep_autoinc
bool m_keep_autoinc
True if the original autoinc counter should be kept.
Definition: ha_innodb.h:1123
dict_table_t
Data structure for a database table.
Definition: dict0mem.h:1510
DsMrr_impl
Definition: handler.h:6544
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
innodb_idx_translate_t::array_size
ulint array_size
array size of index_mapping
Definition: ha_innodb.h:49
innobase_truncate::cleanup
void cleanup()
Cleanup.
Definition: ha_innodb.cc:13835
innodb_base_col_setup
void innodb_base_col_setup(dict_table_t *table, const Field *field, dict_v_col_t *v_col)
Set up base columns for virtual column.
Definition: ha_innodb.cc:10642
create_table_info_t::m_table_name
char * m_table_name
Table name.
Definition: ha_innodb.h:946
create_table_info_t::detach
void detach()
Detach the just created table and its auxiliary tables if exist.
Definition: ha_innodb.cc:12525
ha_innobase::index_next_same
int index_next_same(uchar *buf, const uchar *key, uint keylen) override
Reads the next row matching to the key value given as the parameter.
Definition: ha_innodb.cc:10000
create_table_info_t::create_table_def
int create_table_def(const dd::Table *dd_table)
Create the internal innodb table definition.
Definition: ha_innodb.cc:10706
ha_innobase::get_memory_buffer_size
longlong get_memory_buffer_size() const override
Return the size of the InnoDB memory buffer.
Definition: ha_innodb.cc:15900
innobase_build_v_templ
void innobase_build_v_templ(const TABLE *table, const dict_table_t *ib_table, dict_vcol_templ_t *s_templ, const dict_add_v_col_t *add_v, bool locked, const char *share_tbl_name)
Build template for the virtual columns and their base columns.
Definition: ha_innodb.cc:6235
table_def
A table definition from the master.
Definition: rpl_utility.h:246
_ft_vft_ext
Definition: ft_global.h:56
key
static const char * key
Definition: suite_stubs.c:14
ha_innobase::delete_row
int delete_row(const uchar *buf) override
Deletes a row given as the parameter.
Definition: ha_innodb.cc:9323
ha_innobase::table_type
const char * table_type() const override
Returns the table type (storage engine name).
Definition: ha_innodb.cc:5811
ha_innobase::m_share
INNOBASE_SHARE * m_share
information for MySQL table locking
Definition: ha_innodb.h:664
ha_innobase::innobase_set_max_autoinc
dberr_t innobase_set_max_autoinc(ulonglong auto_inc)
Store the autoinc value in the table.
Definition: ha_innodb.cc:8177
dict_add_v_col_t
Data structure for newly added virtual column in a table.
Definition: dict0mem.h:652
ha_innobase::m_last_match_mode
uint m_last_match_mode
Definition: ha_innodb.h:681
ha_innobase::ft_init_ext
FT_INFO * ft_init_ext(uint flags, uint inx, String *key) override
Initialize FT index scan.
Definition: ha_innodb.cc:10271
ha_innobase::sample_end
int sample_end(void *scan_ctx) override
End sampling.
Definition: ha_innodb.cc:10142
handler.h
innobase_truncate::m_name
const char * m_name
Normalized table name.
Definition: ha_innodb.h:1100
Table
Definition: test_sql_stmt.cc:150
ha_innobase::clone
handler * clone(const char *name, MEM_ROOT *mem_root) override
Definition: ha_innodb.cc:7085
ha_innobase::get_se_private_data
bool get_se_private_data(dd::Table *dd_table, bool reset) override
Get storage-engine private data for a data dictionary table.
Definition: ha_innodb.cc:14156
row_type
row_type
Definition: handler.h:665
ha_innobase::index_prev
int index_prev(uchar *buf) override
Reads the previous row from a cursor, which must have previously been positioned using index_read.
Definition: ha_innodb.cc:10013
innobase_basic_ddl::create_impl
static int create_impl(THD *thd, const char *name, TABLE *form, HA_CREATE_INFO *create_info, Table *dd_tab, bool file_per_table, bool evictable, bool skip_strict, ulint old_flags, ulint old_flags2)
Create an InnoDB table.
Definition: ha_innodb.cc:13252
FTS_INCORRECT_DOC_ID_INDEX
@ FTS_INCORRECT_DOC_ID_INDEX
Definition: ha_innodb.h:1143
ha_innobase::is_record_buffer_wanted
bool is_record_buffer_wanted(ha_rows *const max_rows) const override
Find out if a Record_buffer is wanted by this handler, and what is the maximum buffer size the handle...
Definition: ha_innodb.cc:22520
innodb_rec_per_key
rec_per_key_t innodb_rec_per_key(const dict_index_t *index, ulint i, ha_rows records)
Calculate Record Per Key value.
Definition: ha_innodb.cc:16001
ha_innobase::position
void position(const uchar *record) override
Store a reference to the current row to 'ref' field of the handle.
Definition: ha_innodb.cc:10605
ha_innobase::rnd_next
int rnd_next(uchar *buf) override
Reads the next row in a table scan (also used to read the FIRST row in a table scan).
Definition: ha_innodb.cc:10193
ha_innobase::multi_range_read_info_const
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, uint *flags, Cost_estimate *cost) override
Initialize multi range read and get information.
Definition: ha_innodb.cc:22156
rec_per_key_t
float rec_per_key_t
Data type for records per key estimates that are stored in the KEY::rec_per_key_float[] array.
Definition: key.h:94
ha_innobase::rnd_init
int rnd_init(bool scan) override
Initialize a table scan.
Definition: ha_innodb.cc:10166
ha_innobase::commit_inplace_alter_table_impl
bool commit_inplace_alter_table_impl(TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const Table *old_dd_tab, Table *new_dd_tab)
Implementation of commit_inplace_alter_table()
Definition: handler0alter.cc:7178
NEW_FT_INFO
struct new_ft_info NEW_FT_INFO
Structure Returned by ha_innobase::ft_init_ext()
create_table_info_t::normalize_table_name
static bool normalize_table_name(char *norm_name, const char *name)
Normalizes a table name string.
Definition: ha_innodb.cc:5888
ha_innobase::start_stmt
int start_stmt(THD *thd, thr_lock_type lock_type) override
MySQL calls this function at the start of each SQL statement inside LOCK TABLES.
Definition: ha_innodb.cc:17426
handler
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:3991
dict_vcol_templ_t
Structure defines template related to virtual columns and their base columns.
Definition: dict0mem.h:1452
innodb_idx_translate_t::index_count
ulint index_count
number of valid index entries in the index_mapping array
Definition: ha_innodb.h:46
innobase_stats_on_metadata
bool innobase_stats_on_metadata
Definition: ha_innodb.cc:274
HA_KEY_ALG_BTREE
@ HA_KEY_ALG_BTREE
Definition: my_base.h:106
ha_innobase::analyze
int analyze(THD *thd, HA_CHECK_OPT *check_opt) override
Updates index cardinalities of the table, based on random dives into each index tree.
Definition: ha_innodb.cc:17050
ha_innobase::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_innodb.cc:10150
ha_innobase::reset
int reset() override
MySQL calls this method at the end of each statement.
Definition: ha_innodb.cc:17412
innobase_truncate::m_file_per_table
bool m_file_per_table
True if this table/partition is file per table.
Definition: ha_innodb.h:1118
ha_innobase::was_semi_consistent_read
bool was_semi_consistent_read() override
Definition: ha_innodb.cc:9438
ha_innobase::~ha_innobase
~ha_innobase() override
Destruct ha_innobase handler.
Definition: ha_innodb.cc:2686
ha_innobase::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 InnoDB records.
Definition: handler0alter.cc:1219
ha_innobase::delete_table
int delete_table(const char *name, const dd::Table *table_def) override
Drop a table.
Definition: ha_innodb.cc:14450
yes
static int yes(xcom_port port)
Definition: xcom_base.c:981
create_table_info_t::flags
uint32_t flags() const
Get table flags.
Definition: ha_innodb.h:876
TABLE_SHARE
This structure is shared between different table objects.
Definition: table.h:653
create_table_info_t::create_option_compression_is_valid
bool create_option_compression_is_valid()
Validate COMPRESSION option.
Definition: ha_innodb.cc:11783
MEM_ROOT
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
enum_sql_command
enum_sql_command
Definition: my_sqlcommand.h:45
ha_innobase::ha_innobase
ha_innobase(handlerton *hton, TABLE_SHARE *table_arg)
Construct ha_innobase handler.
Definition: ha_innodb.cc:2664
dict_sys_t::s_temp_space_name
static const char * s_temp_space_name
The name of the predefined temporary tablespace.
Definition: dict0dict.h:1175
FTS_EXIST_DOC_ID_INDEX
@ FTS_EXIST_DOC_ID_INDEX
Definition: ha_innodb.h:1144
create_table_info_t::m_use_shared_space
bool m_use_shared_space
Using a Shared General Tablespace.
Definition: ha_innodb.h:974
innobase_basic_ddl::rename_impl
static int rename_impl(THD *thd, const char *from, const char *to, const Table *from_table, const Table *to_table)
Renames an InnoDB table.
Definition: ha_innodb.cc:13487
create_table_info_t::m_use_file_per_table
bool m_use_file_per_table
After all considerations, this shows whether we will actually create a table and tablespace using fil...
Definition: ha_innodb.h:968
ha_innobase::innobase_lock_autoinc
dberr_t innobase_lock_autoinc()
This special handling is really to overcome the limitations of MySQL's binlogging.
Definition: ha_innodb.cc:8112
ha_innobase::scan_time
double scan_time() override
How many seeks it will take to read through the table.
Definition: ha_innodb.cc:15836
ha_innobase::innobase_initialize_autoinc
void innobase_initialize_autoinc()
Set the autoinc column max value.
Definition: ha_innodb.cc:6500
ha_extra_function
ha_extra_function
Definition: my_base.h:183
ha_innobase::sample_init
int sample_init(void *&scan_ctx, double sampling_percentage, int sampling_seed, enum_sampling_method sampling_method) override
Initialize sampling.
Definition: ha_innodb.cc:10063
uint
unsigned int uint
Definition: uca-dump.cc:29
ha_innobase::rnd_end
int rnd_end() override
Ends a table scan.
Definition: ha_innodb.cc:10187
innobase_fts_check_doc_id_index_in_def
fts_doc_id_index_enum innobase_fts_check_doc_id_index_in_def(ulint n_key, const KEY *key_info)
Check whether the table has a unique index with FTS_DOC_ID_INDEX_NAME on the Doc ID column in MySQL c...
Definition: handler0alter.cc:2624
create_table_info_t::m_flags
uint32_t m_flags
Table flags.
Definition: ha_innodb.h:977
ha_innobase::extra
int extra(ha_extra_function operation) override
Tells something additional to the handler about how to do things.
Definition: ha_innodb.cc:17296
HANDLER_BUFFER
Definition: handler.h:3209
ft_vft_result
const struct _ft_vft ft_vft_result
Definition: ha_innodb.cc:516
innobase_fts_load_stopword
ibool innobase_fts_load_stopword(dict_table_t *table, trx_t *trx, THD *thd)
Initialize the table FTS stopword list.
Definition: ha_innodb.cc:12048
innobase_truncate::m_flags2
uint64_t m_flags2
flags2 of the table to be truncated, which should not change
Definition: ha_innodb.h:1129
trx_is_registered_for_2pc
bool trx_is_registered_for_2pc(const trx_t *trx)
Note that a transaction has been registered with MySQL.
Definition: ha_innodb.h:1212
innodb_idx_translate_t::index_mapping
dict_index_t ** index_mapping
index pointer array directly maps to index in InnoDB from MySQL array index
Definition: ha_innodb.h:51
ha_innobase::rnd_pos
int rnd_pos(uchar *buf, uchar *pos) override
Fetches a row from the table based on a row reference.
Definition: ha_innodb.cc:10220
create_table_info_t::m_use_data_dir
bool m_use_data_dir
Using DATA DIRECTORY.
Definition: ha_innodb.h:971
ha_innobase::m_prebuilt
row_prebuilt_t * m_prebuilt
Save CPU time with prebuilt/cached data structures.
Definition: ha_innodb.h:657
trx_t::is_registered
bool is_registered
Definition: trx0trx.h:958
ha_innobase::optimize
int optimize(THD *thd, HA_CHECK_OPT *check_opt) override
This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds the table in MySQL.
Definition: ha_innodb.cc:17068
ha_innobase::records
int records(ha_rows *num_rows) override
Returns the exact number of records that this client can see using this handler object.
Definition: ha_innodb.cc:15579
ha_innobase::primary_key_is_clustered
bool primary_key_is_clustered() const override
Determines if the primary key is clustered index.
Definition: ha_innodb.cc:5886
ha_innobase::get_auto_increment
virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, ulonglong *nb_reserved_values) override
Returns the value of the auto-inc counter in *first_value and ~0 on failure.
Definition: ha_innodb.cc:18551
ha_innobase::get_default_index_algorithm
enum ha_key_alg get_default_index_algorithm() const override
Get default key algorithm for SE.
Definition: ha_innodb.h:88
uchar
unsigned char uchar
Definition: my_inttypes.h:51
innobase_truncate::rename_tablespace
int rename_tablespace()
Rename tablespace file name.
Definition: ha_innodb.cc:13786
innodb_idx_translate_t
Definition: ha_innodb.h:45
innobase_truncate::open_table
int open_table(dict_table_t *&innodb_table)
Open the table/partition to be truncated.
Definition: ha_innodb.cc:13617
ha_innobase::external_lock
int external_lock(THD *thd, int lock_type) override
As MySQL will execute an external lock for every new table it uses when it starts to process an SQL s...
Definition: ha_innodb.cc:17557
new_ft_info::ft_result
fts_result_t * ft_result
Definition: ha_innodb.h:706
Cost_estimate
Used to store optimizer cost estimates.
Definition: handler.h:3283
INNOBASE_SHARE::table_name
const char * table_name
InnoDB table name.
Definition: ha_innodb.h:58
ha_innobase::truncate_impl
int truncate_impl(const char *name, TABLE *form, dd::Table *table_def)
TRUNCATE an InnoDB table.
Definition: ha_innodb.cc:14379
innobase_truncate::m_create_info
HA_CREATE_INFO m_create_info
Create information.
Definition: ha_innodb.h:1115
new_ft_info
Structure Returned by ha_innobase::ft_init_ext()
Definition: ha_innodb.h:702
create_table_info_t::initialize_autoinc
void initialize_autoinc()
Initialize the autoinc of this table if necessary, which should be called before we flush logs,...
Definition: ha_innodb.cc:12715
dd::Table
Definition: table.h:45
ha_innobase::reset_template
void reset_template()
Resets a query execution 'template'.
Definition: ha_innodb.cc:2870
ha_innobase::store_lock
THR_LOCK_DATA ** store_lock(THD *thd, THR_LOCK_DATA **to, thr_lock_type lock_type) override
Supposed to convert a MySQL table lock stored in the 'lock' field of the handle to a proper type befo...
Definition: ha_innodb.cc:18351
innobase_basic_ddl
Class of basic DDL implementation, for CREATE/DROP/RENAME TABLE.
Definition: ha_innodb.h:987
create_table_info_t::skip_strict
bool skip_strict() const
whether to skip strict check.
Definition: ha_innodb.h:888
INNOBASE_SHARE::idx_trans_tbl
innodb_idx_translate_t idx_trans_tbl
index translation table between MySQL and InnoDB
Definition: ha_innodb.h:65
create_table_info_t::create_table_update_global_dd
int create_table_update_global_dd(Table *dd_table)
Update the global data dictionary.
Definition: ha_innodb.cc:13147
ha_innobase::inplace_alter_table
bool inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override
Alter the table structure in-place with operations specified using HA_ALTER_FLAGS and Alter_inplace_i...
Definition: handler0alter.cc:1263
ha_innobase::change_active_index
int change_active_index(uint keynr)
Changes the active index of a handle.
Definition: ha_innodb.cc:9807
new_ft_info::please
struct _ft_vft * please
Definition: ha_innodb.h:703
ha_innobase::unlock_row
void unlock_row() override
Removes a new lock set on a row, if it was not read optimistically.
Definition: ha_innodb.cc:9394
ha_innobase::parallel_scan_init
int parallel_scan_init(void *&scan_ctx, size_t &num_threads) override
Initializes a parallel scan.
Definition: handler0alter.cc:1158
create_table_info_t::m_thd
THD * m_thd
Connection thread handle.
Definition: ha_innodb.h:934
create_table_info_t::set_tablespace_type
void set_tablespace_type(bool table_being_altered_is_file_per_table)
Set m_tablespace_type.
Definition: ha_innodb.cc:12656
innobase_truncate::m_dd_table
Table * m_dd_table
dd::Table or dd::Partition
Definition: ha_innodb.h:1103
tablespace_is_general_space
UNIV_INLINE bool tablespace_is_general_space(const HA_CREATE_INFO *create_info)
Check if table will be explicitly put in a general tablespace.
Definition: ha_innodb.h:768
thr_lock_type
thr_lock_type
Definition: thr_lock.h:50
create_table_info_t::m_form
const TABLE * m_form
Information on table columns and indexes.
Definition: ha_innodb.h:940
innobase_match_index_columns
bool innobase_match_index_columns(const KEY *key_info, const dict_index_t *index_info)
Match index columns between MySQL and InnoDB.
Definition: ha_innodb.cc:6075
ha_innobase::multi_range_read_init
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf) override
Initialize multi range read.
Definition: ha_innodb.cc:22144
name
const string name("\"Name\"")
FTS_NOT_EXIST_DOC_ID_INDEX
@ FTS_NOT_EXIST_DOC_ID_INDEX
Definition: ha_innodb.h:1145
ha_innobase::check
int check(THD *thd, HA_CHECK_OPT *check_opt) override
Tries to check that an InnoDB table is not corrupted.
Definition: ha_innodb.cc:17099
create_table_info_t::set_remote_path_flags
void set_remote_path_flags()
Set flags and append '/' to remote path if necessary.
Definition: ha_innopart.cc:2376
ha_innobase::srv_concurrency_enter
void srv_concurrency_enter()
Enter InnoDB engine after checking max allowed threads.
Definition: ha_innodb.cc:2654
innobase_truncate::load_fk
int load_fk()
Reload the FK related information.
Definition: ha_innodb.cc:13852
ha_innobase::upgrade_table
bool upgrade_table(THD *thd, const char *db_name, const char *table_name, dd::Table *dd_table) override
Set Engine specific data to dd::Table object for upgrade.
Definition: ha_innodb.cc:14146
ha_innobase::update_row
int update_row(const uchar *old_data, uchar *new_data) override
Updates a row given as a parameter to a new value.
Definition: ha_innodb.cc:9169
create_table_info_t::innobase_table_flags
bool innobase_table_flags()
Determines InnoDB table flags.
Definition: ha_innodb.cc:12280
KEY
Definition: key.h:111
INNOBASE_SHARE::use_count
uint use_count
reference count, incremented in get_share() and decremented in free_share()
Definition: ha_innodb.h:59
ha_innobase::index_flags
ulong index_flags(uint idx, uint part, bool all_parts) const override
Returns the operations supported for indexes.
Definition: ha_innodb.cc:5816
Parallel_reader_adapter::Load_fn
handler::Load_cbk Load_fn
Definition: row0pread-adapter.h:47
DBUG_ASSERT
#define DBUG_ASSERT(A)
Definition: my_dbug.h:197
create_table_info_t::table_name
const char * table_name() const
Return table name.
Definition: ha_innodb.h:891
DICT_TF2_TEMPORARY
#define DICT_TF2_TEMPORARY
TEMPORARY; TRUE for tables from CREATE TEMPORARY TABLE.
Definition: dict0mem.h:249
ha_innobase::mv_key_capacity
void mv_key_capacity(uint *num_keys, size_t *keys_length) const override
Return max limits for a single set of multi-valued keys.
Definition: ha_innodb.cc:22543
innobase_trx_allocate
trx_t * innobase_trx_allocate(THD *thd)
Allocates an InnoDB transaction for a MySQL handler object.
Definition: ha_innodb.cc:2505
RANGE_SEQ_IF
Definition: handler.h:3217
ha_innobase::get_real_row_type
row_type get_real_row_type(const HA_CREATE_INFO *create_info) const override
Get real row type for the table created based on one specified by user, CREATE TABLE options and SE c...
Definition: ha_innodb.cc:5727
dict_sys_t::s_file_per_table_name
static const char * s_file_per_table_name
The hard-coded tablespace name innodb_file_per_table.
Definition: dict0dict.h:1181
DICT_TF2_INTRINSIC
#define DICT_TF2_INTRINSIC
Intrinsic table bit Intrinsic table is table created internally by MySQL modules viz.
Definition: dict0mem.h:272
_ft_vft
Definition: ft_global.h:47
error
Log error(cerr, "ERROR")
rules_table_service::db_name
const char * db_name
Definition: rules_table_service.cc:54
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
ha_innobase::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_innodb.cc:15789
Ft_hints
Wrapper for struct ft_hints.
Definition: handler.h:3543
INNOBASE_SHARE
InnoDB table share.
Definition: ha_innodb.h:57
ha_innobase
The class defining a handle to an InnoDB table.
Definition: ha_innodb.h:79
innobase_truncate::m_flags
uint64_t m_flags
flags of the table to be truncated, which should not change
Definition: ha_innodb.h:1126
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_innobase::idx_cond_push
Item * idx_cond_push(uint keyno, Item *idx_cond) override
Attempt to push down an index condition.
Definition: ha_innodb.cc:22501
ha_innobase::info_low
virtual int info_low(uint flag, bool is_analyze)
Returns statistics information of the table to the MySQL interpreter, in various fields of the handle...
Definition: ha_innodb.cc:16177
ha_innobase::get_extra_columns_and_keys
int get_extra_columns_and_keys(const HA_CREATE_INFO *, const List< Create_field > *, const KEY *, uint, dd::Table *dd_table) override
Add hidden columns and indexes to an InnoDB table definition.
Definition: ha_innodb.cc:13922
ha_innobase::get_error_message
virtual bool get_error_message(int error, String *buf) override
See comment in handler.cc.
Definition: ha_innodb.cc:18688
Parallel_reader_adapter
Traverse an index in the leaf page block list order and send records to adapter.
Definition: row0pread-adapter.h:42
ha_innobase::end_stmt
int end_stmt()
MySQL calls this method at the end of each statement.
Definition: ha_innodb.cc:17368
row0pread-adapter.h
new_data
app_data_ptr new_data(u_int n, char *val, cons_type consensus)
Definition: app_data.c:426
ha_innobase::index_last
int index_last(uchar *buf) override
Positions a cursor on the last record in an index and reads the corresponding row to buf.
Definition: ha_innodb.cc:10046
ulong
unsigned long ulong
Definition: my_inttypes.h:48
ha_innobase::update_create_info
void update_create_info(HA_CREATE_INFO *create_info) override
Update create_info.
Definition: ha_innodb.cc:12018
ha_innobase::innobase_get_index
virtual dict_index_t * innobase_get_index(uint keynr)
Get the index for a handle.
Definition: ha_innodb.cc:9763
ha_innobase::index_first
int index_first(uchar *buf) override
Positions a cursor on the first record in an index and reads the corresponding row to buf.
Definition: ha_innodb.cc:10025
ha_innobase::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_innodb.h:247
ha_innobase::ft_end
void ft_end()
Definition: ha_innodb.cc:10590
ulonglong
unsigned long long int ulonglong
Definition: my_inttypes.h:55
enum_sampling_method
enum_sampling_method
Definition: handler.h:695
ha_innobase::index_init
int index_init(uint index, bool sorted) override
Initializes a handle to use an index.
Definition: ha_innodb.cc:9458
convert_search_mode_to_innobase
page_cur_mode_t convert_search_mode_to_innobase(enum ha_rkey_function find_flag)
Converts a search mode flag understood by MySQL to a flag understood by InnoDB.
Definition: ha_innodb.cc:9488
innobase_index_name_is_reserved
bool innobase_index_name_is_reserved(THD *thd, const KEY *key_info, ulint num_of_keys)
This function checks each index name for a table against reserved system default primary index name '...
Definition: ha_innodb.cc:20295
create_table_info_t::create_table
int create_table(const dd::Table *dd_table)
Create the internal innodb table.
Definition: ha_innodb.cc:12890
create_table_info_t::m_tablespace
char * m_tablespace
Tablespace name or zero length-string.
Definition: ha_innodb.h:950
ha_innobase::read_time
double read_time(uint index, uint ranges, ha_rows rows) override
Calculate the time it takes to read a set of ranges through an index This enables us to optimise read...
Definition: ha_innodb.cc:15870
row0pread-histogram.h
List< Create_field >
ha_innobase::init_table_handle_for_HANDLER
void init_table_handle_for_HANDLER() override
Call this when you have opened a new table handle in HANDLER, before you call index_read_map() etc.
Definition: ha_innodb.cc:2900
ha_rows
my_off_t ha_rows
Definition: my_base.h:1132
trx0trx.h
ha_innobase::index_read
int index_read(uchar *buf, const uchar *key, uint key_len, ha_rkey_function find_flag) override
Positions an index cursor to the index specified in the handle.
Definition: ha_innodb.cc:9578
ha_innobase::max_supported_keys
uint max_supported_keys() const override
Returns the maximum number of keys.
Definition: ha_innodb.cc:5855
privilege_status::error
@ error
Field
Definition: field.h:695
create_table_info_t::thd
THD * thd() const
Definition: ha_innodb.h:893
innobase_build_v_templ_callback
void innobase_build_v_templ_callback(const TABLE *table, void *ib_table)
callback used by MySQL server layer to initialized the table virtual columns' template
Definition: ha_innodb.cc:6220
ha_innobase::index_next
int index_next(uchar *buf) override
Reads the next row from a cursor, which must have previously been positioned using index_read.
Definition: ha_innodb.cc:9989
keys
static uint keys
Definition: hp_test2.cc:43
ha_innobase::update_thd
void update_thd()
Updates the user_thd field in a handle and also allocates a new InnoDB transaction handle if needed,...
Definition: ha_innodb.cc:2718
ha_innobase::discard_or_import_tablespace
int discard_or_import_tablespace(bool discard, dd::Table *table_def) override
Discards or imports an InnoDB tablespace.
Definition: ha_innodb.cc:14265
thd_parallel_read_threads
ulong thd_parallel_read_threads(THD *thd)
Return the number of read threads for this session.
Definition: ha_innodb.cc:1776
key_range
Definition: my_base.h:1116
create_table_info_t::flags_reset
void flags_reset()
Reset table flags.
Definition: ha_innodb.h:882
ha_innobase::multi_range_read_info
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint *bufsz, uint *flags, Cost_estimate *cost) override
Initialize multi range read and get information.
Definition: ha_innodb.cc:22168
innobase_basic_ddl::delete_impl
static int delete_impl(THD *thd, const char *name, const Table *dd_tab)
Drop an InnoDB table.
Definition: ha_innodb.cc:13373
ha_key_alg
ha_key_alg
Definition: my_base.h:96
row_prebuilt_t
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:539
dict_sys_t::s_sys_space_name
static const char * s_sys_space_name
The name of the hard-coded system tablespace.
Definition: dict0dict.h:1172
INNOBASE_SHARE::table_name_hash
void * table_name_hash
hash table chain node
Definition: ha_innodb.h:63
ha_innobase::m_upd_buf
uchar * m_upd_buf
buffer used in updates
Definition: ha_innodb.h:667
ha_innobase::get_foreign_dup_key
virtual bool get_foreign_dup_key(char *, uint, char *, uint) override
Retrieves the names of the table and the key for which there was a duplicate entry in the case of HA_...
Definition: ha_innodb.cc:18712
ha_innobase::m_ds_mrr
DsMrr_impl m_ds_mrr
The multi range read session object.
Definition: ha_innodb.h:654
create_table_info_t::m_allow_file_per_table
bool m_allow_file_per_table
Allow file_per_table for this table either because: 1) the setting innodb_file_per_table=on,...
Definition: ha_innodb.h:964
ha_innobase::parallel_scan_end
int parallel_scan_end(void *scan_ctx) override
End of the parallel scan.
Definition: handler0alter.cc:1242
create_table_info_t::flags2
uint32_t flags2() const
Get table flags2.
Definition: ha_innodb.h:879
ha_innobase::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:683
ha_innobase::m_user_thd
THD * m_user_thd
Thread handle of the user currently using the handler; this is set in external_lock function.
Definition: ha_innodb.h:661
tablespace_is_file_per_table
UNIV_INLINE bool tablespace_is_file_per_table(const HA_CREATE_INFO *create_info)
Check if the explicit tablespace targeted is file_per_table.
Definition: ha_innodb.h:746
ha_innobase::inplace_alter_table_impl
bool inplace_alter_table_impl(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const Table *old_dd_tab, Table *new_dd_tab)
Implementation of inplace_alter_table()
Definition: handler0alter.cc:5912
ha_innobase::index_end
int index_end() override
Currently does nothing.
Definition: ha_innodb.cc:9470
innobase_truncate::innobase_truncate
innobase_truncate(THD *thd, const char *name, TABLE *form, Table *dd_table, bool keep_autoinc)
Constructor.
Definition: ha_innodb.h:1049
create_table_info_t::create_table_update_dict
int create_table_update_dict()
Update the internal data dictionary.
Definition: ha_innodb.cc:13096
ha_innobase::prepare_inplace_alter_table_impl
bool prepare_inplace_alter_table_impl(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const Table *old_dd_tab, Table *new_dd_tab)
Implementation of prepare_inplace_alter_table()
Definition: handler0alter.cc:5180
create_table_info_t::flags2_reset
void flags2_reset()
Reset table flags2.
Definition: ha_innodb.h:885
index
char * index(const char *, int c)
Definition: mysql.cc:2875
ha_innobase::create
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info, dd::Table *table_def) override
Create an InnoDB table.
Definition: ha_innodb.cc:14233
HA_CREATE_INFO
Definition: handler.h:2628
HA_KEY_ALG_RTREE
@ HA_KEY_ALG_RTREE
Definition: my_base.h:107
ha_innobase::m_upd_buf_size
ulint m_upd_buf_size
the size of upd_buf in bytes
Definition: ha_innodb.h:670
trx_t
Definition: trx0trx.h:780
ha_innobase::commit_inplace_alter_table
bool commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, bool commit, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override
Commit or rollback the changes made during prepare_inplace_alter_table() and inplace_alter_table() in...
Definition: handler0alter.cc:1300
create_table_info_t::m_table
dict_table_t * m_table
The newly created InnoDB table object.
Definition: ha_innodb.h:955
ha_innobase::write_row
int write_row(uchar *buf) override
Stores a row in an InnoDB database, to the table specified in this handle.
Definition: ha_innodb.cc:8431
ha_innobase::ft_read
int ft_read(uchar *buf) override
Fetch next result from the FT result set.
Definition: ha_innodb.cc:10455
ha_innobase::delete_all_rows
int delete_all_rows() override
Delete all rows from the table.
Definition: ha_innodb.cc:9375
flag
static int flag
Definition: hp_test1.cc:39
create_table_info_t
Class for handling create table information.
Definition: ha_innodb.h:803
innobase_truncate::truncate
int truncate()
Do the real truncation.
Definition: ha_innodb.cc:13699
ha_innobase::multi_range_read_next
int multi_range_read_next(char **range_info) override
Process next multi range read.
Definition: ha_innodb.cc:22152
create_table_info_t::m_create_info
HA_CREATE_INFO * m_create_info
Create options.
Definition: ha_innodb.h:943
flags
static int flags[50]
Definition: hp_test1.cc:39
FT_INFO
Definition: ft_global.h:71
ha_innobase::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_innodb.cc:15670
ha_innobase::prepare_inplace_alter_table
bool prepare_inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha_alter_info, const dd::Table *old_dd_tab, dd::Table *new_dd_tab) override
Allows InnoDB to update internal structures with concurrent writes blocked (provided that check_if_su...
Definition: handler0alter.cc:1132
HA_CREATE_INFO::tablespace
const char * tablespace
Definition: handler.h:2633
HA_KEY_ALG_FULLTEXT
@ HA_KEY_ALG_FULLTEXT
Definition: my_base.h:109
create_table_info_t::m_flags2
uint32_t m_flags2
Table flags2.
Definition: ha_innodb.h:980
innobase_truncate::~innobase_truncate
~innobase_truncate()
Destructor.
Definition: ha_innodb.cc:13606
false
#define false
Definition: config_static.h:43