MySQL  8.0.19
Source Code Documentation
dict0dd.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2015, 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 /** @file include/dict0dd.h
28 Data dictionary interface */
29 
30 #ifndef dict0dd_h
31 #define dict0dd_h
32 
33 #include "dict0dict.h"
34 #include "dict0mem.h"
35 #include "dict0types.h"
36 #include "univ.i"
37 
38 #ifndef UNIV_HOTBACKUP
40 #include "dd/dd.h"
41 #include "dd/dd_schema.h"
42 #include "dd/dd_table.h"
43 #include "dd/dictionary.h"
44 #include "dd/properties.h"
45 #include "dd/types/column.h"
46 #include "dd/types/foreign_key.h"
48 #include "dd/types/index.h"
49 #include "dd/types/index_element.h"
50 #include "dd/types/partition.h"
52 #include "dd/types/table.h"
53 #include "dd/types/tablespace.h"
55 #include "dd_table_share.h"
56 #include "sess0sess.h"
57 #else
58 #include "mysql_com.h"
59 #endif /* !UNIV_HOTBACKUP */
60 #include "mysql_version.h"
61 
62 #ifndef UNIV_HOTBACKUP
63 class THD;
64 class MDL_ticket;
65 
66 /** DD functions return false for success and true for failure
67 because that is the way the server functions are defined. */
68 #define DD_SUCCESS false
69 #define DD_FAILURE true
70 
71 /** Handler name for InnoDB */
72 static constexpr char handler_name[] = "InnoDB";
73 
74 static const char innobase_hton_name[] = "InnoDB";
75 
76 /** Maximum hardcoded data dictionary tables. */
77 #define DICT_MAX_DD_TABLES 1024
78 
79 /** InnoDB private keys for dd::Table */
81  /** Auto-increment counter */
83  /** DATA DIRECTORY (static metadata) */
85  /** Dynamic metadata version */
87  /** Discard flag */
89  /** Columns before first instant ADD COLUMN */
91  /** Sentinel */
93 };
94 
95 /** InnoDB private keys for dd::Column */
96 /** About the DD_INSTANT_COLUMN_DEFAULT*, please note that if it's a
97 partitioned table, not every default value is needed for every partition.
98 For example, after ALTER TABLE ... PARTITION, maybe some partitions only
99 need part or even none of the default values. Let's say there are two
100 partitions, p1 and p2. p1 needs 10 default values while p2 needs 2.
101 If another ALTER ... PARTITION makes p1 a fresh new partition which
102 doesn't need the default values any more, currently, the extra 8(10 - 2)
103 default values are not removed form dd::Column::se_private_data. */
105  /** Default value when it was added instantly */
107  /** Default value is null or not */
109  /** Sentinel */
111 };
112 
113 #endif /* !UNIV_HOTBACKUP */
114 
115 /** Server version that the tablespace created */
116 const uint32 DD_SPACE_CURRENT_SRV_VERSION = MYSQL_VERSION_ID;
117 
118 /** The tablespace version that the tablespace created */
120 
121 #ifndef UNIV_HOTBACKUP
122 /** InnoDB private keys for dd::Partition */
124  /** Row format for this partition */
126  /** Columns before first instant ADD COLUMN.
127  This is necessary for each partition because differnet partition
128  may have different instant column numbers, especially, for a
129  newly truncated partition, it can have no instant columns.
130  So partition level one should be always >= table level one. */
132  /** Sentinel */
134 };
135 
136 /** InnoDB private keys for dd::Tablespace */
138  /** Tablespace flags */
140  /** Tablespace identifier */
142  /** Discard attribute */
144  /** Server version */
146  /** TABLESPACE_VERSION */
148  /** Current state attribute */
150  /** Sentinel */
152 };
153 
154 /** Values for InnoDB private key "state" for dd::Tablespace */
156  /** Normal IBD tablespace */
158  /** Discarded IBD tablespace */
160  /** Corrupted IBD tablespace */
162  /** Active undo tablespace */
164  /** Inactive undo tablespace being truncated, selected
165  explicitly by ALTER UNDO TABLESPACE SET INACTIVE.
166  Note: the DD is not updated when an undo space is selected
167  for truncation implicitly by the purge thread. */
169  /** Inactive undo tablespace being truncated, selected
170  explicitly by ALTER UNDO TABLESPACE SET INACTIVE. */
172  /** Sentinel */
174 };
175 
176 /** InnoDB implicit tablespace name or prefix, which should be same to
177 dict_sys_t::s_file_per_table_name */
178 static constexpr char reserved_implicit_name[] = "innodb_file_per_table";
179 
180 /** InnoDB private key strings for dd::Tablespace.
181 @see dd_space_keys */
182 const char *const dd_space_key_strings[DD_SPACE__LAST] = {
183  "flags", "id", "discard", "server_version", "space_version", "state"};
184 
185 /** InnoDB private value strings for key string "state" in dd::Tablespace.
186 @see dd_space_state_values */
187 const char *const dd_space_state_values[DD_SPACE_STATE__LAST + 1] = {
188  "normal", /* for IBD spaces */
189  "discarded", /* for IBD spaces */
190  "corrupted", /* for IBD spaces */
191  "active", /* for undo spaces*/
192  "inactive", /* for undo spaces */
193  "empty", /* for undo spaces */
194  "unknown" /* for non-existing or unknown spaces */
195 };
196 
197 /** InnoDB private key strings for dd::Table. @see dd_table_keys */
198 const char *const dd_table_key_strings[DD_TABLE__LAST] = {
199  "autoinc", "data_directory", "version", "discard", "instant_col"};
200 
201 /** InnoDB private key strings for dd::Column, @see dd_column_keys */
202 const char *const dd_column_key_strings[DD_COLUMN__LAST] = {"default",
203  "default_null"};
204 
205 /** InnoDB private key strings for dd::Partition. @see dd_partition_keys */
207  "format", "instant_col"};
208 
209 /** InnoDB private keys for dd::Index or dd::Partition_index */
211  /** Index identifier */
213  /** Space id */
215  /** Table id */
217  /** Root page number */
219  /** Creating transaction ID */
221  /** Sentinel */
223 };
224 
225 /** InnoDB private key strings for dd::Index or dd::Partition_index.
226 @see dd_index_keys */
227 const char *const dd_index_key_strings[DD_INDEX__LAST] = {
228  "id", "space_id", "table_id", "root", "trx_id"};
229 
230 /** InnoDB private key strings for dd::Index or dd::Partition_index.
231 @see dd_index_keys */
232 extern const char *const dd_index_key_strings[DD_INDEX__LAST];
233 
234 /** dd::Partition::options() key for INDEX DIRECTORY */
235 static const dd::String_type index_file_name_key("index_file_name");
236 /** dd::Partition::options() key for DATA DIRECTORY */
237 static const dd::String_type data_file_name_key("data_file_name");
238 
239 /** Table names needed to process I_S queries. */
240 static const dd::String_type dd_tables_name("mysql/tables");
241 static const dd::String_type dd_partitions_name("mysql/table_partitions");
242 static const dd::String_type dd_tablespaces_name("mysql/tablespaces");
243 static const dd::String_type dd_indexes_name("mysql/indexes");
244 static const dd::String_type dd_columns_name("mysql/columns");
245 
246 #ifdef UNIV_DEBUG
247 
248 /** Hard-coded data dictionary information */
250  /** Data dictionary table name */
251  const char *name;
252  /** Number of indexes */
254 };
255 
256 /** The hard-coded data dictionary tables. */
258  INNODB_DD_TABLE("dd_properties", 1),
259 
260  INNODB_DD_TABLE("innodb_dynamic_metadata", 1),
261  INNODB_DD_TABLE("innodb_table_stats", 1),
262  INNODB_DD_TABLE("innodb_index_stats", 1),
263  INNODB_DD_TABLE("innodb_ddl_log", 2),
264 
265  INNODB_DD_TABLE("catalogs", 2),
266  INNODB_DD_TABLE("character_sets", 3),
267  INNODB_DD_TABLE("check_constraints", 3),
268  INNODB_DD_TABLE("collations", 3),
269  INNODB_DD_TABLE("column_statistics", 3),
270  INNODB_DD_TABLE("column_type_elements", 1),
271  INNODB_DD_TABLE("columns", 5),
272  INNODB_DD_TABLE("events", 5),
273  INNODB_DD_TABLE("foreign_key_column_usage", 3),
274  INNODB_DD_TABLE("foreign_keys", 4),
275  INNODB_DD_TABLE("index_column_usage", 3),
276  INNODB_DD_TABLE("index_partitions", 3),
277  INNODB_DD_TABLE("index_stats", 1),
278  INNODB_DD_TABLE("indexes", 3),
279  INNODB_DD_TABLE("parameter_type_elements", 1),
280  INNODB_DD_TABLE("parameters", 3),
281  INNODB_DD_TABLE("resource_groups", 2),
282  INNODB_DD_TABLE("routines", 6),
283  INNODB_DD_TABLE("schemata", 3),
284  INNODB_DD_TABLE("st_spatial_reference_systems", 3),
285  INNODB_DD_TABLE("table_partition_values", 1),
286  INNODB_DD_TABLE("table_partitions", 7),
287  INNODB_DD_TABLE("table_stats", 1),
288  INNODB_DD_TABLE("tables", 9),
289  INNODB_DD_TABLE("tablespace_files", 2),
290  INNODB_DD_TABLE("tablespaces", 2),
291  INNODB_DD_TABLE("triggers", 6),
292  INNODB_DD_TABLE("view_routine_usage", 2),
293  INNODB_DD_TABLE("view_table_usage", 2)};
294 
295 /** Number of hard-coded data dictionary tables */
296 static constexpr size_t innodb_dd_table_size = UT_ARR_SIZE(innodb_dd_table);
297 
298 /** @return total number of indexes of all DD Tables. */
299 uint32_t dd_get_total_indexes_num();
300 
301 #endif /* UNIV_DEBUG */
302 
303 #endif /* !UNIV_HOTBACKUP */
304 
305 /** Class to decode or encode a stream of default value for instant table.
306 The decode/encode are necessary because that the default values would b
307 kept as InnoDB format stream, which is in fact byte stream. However,
308 to store them in the DD se_private_data, it requires text(char).
309 So basically, the encode will change the byte stream into char stream,
310 by spliting every byte into two chars, for example, 0xFF, would be splitted
311 into 0x0F and 0x0F. So the final storage space would be double. For the
312 decode, it's the converse process, combining two chars into one byte. */
314  public:
315  /** Constructor */
317 
318  /** Destructor */
320 
321  /** Encode the specified stream in format of bytes into chars
322  @param[in] stream stream to encode in bytes
323  @param[in] in_len length of the stream
324  @param[out] out_len length of the encoded stream
325  @return the encoded stream, which would be destroyed if the class
326  itself is destroyed */
327  const char *encode(const byte *stream, size_t in_len, size_t *out_len);
328 
329  /** Decode the specified stream, which is encoded by encode()
330  @param[in] stream stream to decode in chars
331  @param[in] in_len length of the stream
332  @param[out] out_len length of the decoded stream
333  @return the decoded stream, which would be destroyed if the class
334  itself is destroyed */
335  const byte *decode(const char *stream, size_t in_len, size_t *out_len);
336 
337  private:
338  /** Clean-up last result */
340 
341  private:
342  /** The encoded or decoded stream */
343  byte *m_result;
344 };
345 
346 #ifndef UNIV_HOTBACKUP
347 /** Determine if a dd::Partition is the first leaf partition in the table
348 @param[in] dd_part dd::Partition
349 @return True If it's the first partition
350 @retval False Not the first one */
351 inline bool dd_part_is_first(const dd::Partition *dd_part) {
352  return (dd_part == *(dd_part->table().leaf_partitions().begin()));
353 }
354 
355 /** Determine if a dd::Table is partitioned table
356 @param[in] table dd::Table
357 @return True If partitioned table
358 @retval False non-partitioned table */
359 inline bool dd_table_is_partitioned(const dd::Table &table) {
360  return (table.partition_type() != dd::Table::PT_NONE);
361 }
362 
363 #ifdef UNIV_DEBUG
364 /** Check if the instant columns are consistent with the se_private_data
365 in dd::Table
366 @param[in] dd_table dd::Table
367 @return true if consistent, otherwise false */
368 bool dd_instant_columns_exist(const dd::Table &dd_table);
369 #endif /* UNIV_DEBUG */
370 
371 /** Determine if a dd::Table has any instant column
372 @param[in] table dd::Table
373 @return true If it's a table with instant columns
374 @retval false Not a table with instant columns */
375 inline bool dd_table_has_instant_cols(const dd::Table &table) {
376  bool instant = table.se_private_data().exists(
378 
379  ut_ad(!instant || dd_instant_columns_exist(table));
380 
381  return (instant);
382 }
383 
384 /** Determine if a dd::Partition has any instant column
385 @param[in] part dd::Partition
386 @return true If it's a partitioned table with instant columns
387 @return false Not a partitioned table with instant columns */
388 inline bool dd_part_has_instant_cols(const dd::Partition &part) {
389  bool instant = part.se_private_data().exists(
391  ut_ad(!instant || dd_table_has_instant_cols(part.table()));
392 
393  return (instant);
394 }
395 
396 /** Determine if any partition of the table still has instant columns
397 @param[in] table dd::Table of the partitioned table
398 @return true If any partition still has instant columns
399 @return false No one has instant columns */
400 inline bool dd_table_part_has_instant_cols(const dd::Table &table) {
402 
403  if (!dd_table_has_instant_cols(table)) {
404  return (false);
405  }
406 
407  for (auto part : table.leaf_partitions()) {
408  if (dd_part_has_instant_cols(*part)) {
409  return (true);
410  }
411  }
412  return (false);
413 }
414 
415 /** Get the first index of a table or partition.
416 @tparam Table dd::Table or dd::Partition
417 @tparam Index dd::Index or dd::Partition_index
418 @param[in] table table containing user columns and indexes
419 @return the first index
420 @retval NULL if there are no indexes */
421 template <typename Table, typename Index>
422 inline const Index *dd_first(const Table *table) {
423  return (*table->indexes().begin());
424 }
425 
426 /** Get the first index of a table.
427 @param[in] table table containing user columns and indexes
428 @return the first index
429 @retval NULL if there are no indexes */
430 inline const dd::Index *dd_first_index(const dd::Table *table) {
431  return (dd_first<dd::Table, dd::Index>(table));
432 }
433 
434 /** Get the first index of a partition.
435 @param[in] partition partition or subpartition
436 @return the first index
437 @retval NULL if there are no indexes */
439  const dd::Partition *partition) {
440  return (dd_first<dd::Partition, dd::Partition_index>(partition));
441 }
442 
443 #ifdef UNIV_DEBUG
444 /** Determine if a partition is materialized.
445 @param[in] part partition
446 @return whether the partition is materialized */
447 inline bool dd_part_is_stored(const dd::Partition *part) {
448  return (part->table().subpartition_type() == dd::Table::ST_NONE ||
449  part->parent());
450 }
451 #endif /* UNIV_DEBUG */
452 
453 /** Get the explicit dd::Tablespace::id of a table.
454 @param[in] table non-partitioned table
455 @return the explicit dd::Tablespace::id
456 @retval dd::INVALID_OBJECT_ID if there is no explicit tablespace */
459  return (table.tablespace_id());
460 }
461 
462 /** Get the explicit dd::Tablespace::id of a partition.
463 @param[in] partition partition or subpartition
464 @return the explicit dd::Tablespace::id
465 @retval dd::INVALID_OBJECT_ID if there is no explicit tablespace */
466 inline dd::Object_id dd_get_space_id(const dd::Partition &partition);
467 
468 /** Set the AUTO_INCREMENT attribute.
469 @param[in,out] se_private_data dd::Table::se_private_data
470 @param[in] autoinc the auto-increment value */
471 void dd_set_autoinc(dd::Properties &se_private_data, uint64 autoinc);
472 
473 /** Get the version attribute.
474 @param[in] dd_table dd::Table
475 @return table dynamic metadata version if exists, otherwise 0 */
476 inline uint64_t dd_get_version(const dd::Table *dd_table);
477 
478 /** Copy the AUTO_INCREMENT and version attribute if exist.
479 @param[in] src dd::Table::se_private_data to copy from
480 @param[out] dest dd::Table::se_private_data to copy to */
481 void dd_copy_autoinc(const dd::Properties &src, dd::Properties &dest);
482 
483 /** Copy the metadata of a table definition if there was an instant
484 ADD COLUMN happened. This should be done when it's not an ALTER TABLE
485 with rebuild.
486 @param[in,out] new_table New table definition
487 @param[in] old_table Old table definition */
488 void dd_copy_instant_n_cols(dd::Table &new_table, const dd::Table &old_table);
489 
490 /** Copy the engine-private parts of a table or partition definition
491 when the change does not affect InnoDB. This mainly copies the common
492 private data between dd::Table and dd::Partition
493 @tparam Table dd::Table or dd::Partition
494 @param[in,out] new_table Copy of old table or partition definition
495 @param[in] old_table Old table or partition definition */
496 template <typename Table>
497 void dd_copy_private(Table &new_table, const Table &old_table);
498 
499 /** Copy the engine-private parts of column definitions of a table
500 @param[in,out] new_table Copy of old table
501 @param[in] old_table Old table */
502 void dd_copy_table_columns(dd::Table &new_table, const dd::Table &old_table);
503 
504 /** Copy the metadata of a table definition, including the INSTANT
505 ADD COLUMN information. This should be done when it's not an ALTER TABLE
506 with rebuild. Basically, check dd::Table::se_private_data and
507 dd::Column::se_private_data.
508 @param[in,out] new_table Copy of old table definition
509 @param[in] old_table Old table definition */
510 inline void dd_copy_table(dd::Table &new_table, const dd::Table &old_table) {
511  /* Copy columns first, to make checking in dd_copy_instant_n_cols pass */
512  dd_copy_table_columns(new_table, old_table);
513  if (dd_table_has_instant_cols(old_table)) {
514  dd_copy_instant_n_cols(new_table, old_table);
515  }
516 }
517 
518 /** Adjust TABLE_ID for partitioned table after ALTER TABLE ... PARTITION.
519 This makes sure that the TABLE_ID stored in dd::Column::se_private_data
520 is correct if the first partition got changed
521 @param[in,out] new_table New dd::Table */
522 void dd_part_adjust_table_id(dd::Table *new_table);
523 
524 /** Add column default values for new instantly added columns
525 @param[in] old_table MySQL table as it is before the ALTER operation
526 @param[in] altered_table MySQL table that is being altered
527 @param[in,out] new_dd_table New dd::Table
528 @param[in] new_table New InnoDB table object */
529 void dd_add_instant_columns(const TABLE *old_table, const TABLE *altered_table,
530  dd::Table *new_dd_table,
531  const dict_table_t *new_table);
532 
533 /** Clear the instant ADD COLUMN information of a table
534 @param[in,out] dd_table dd::Table */
535 void dd_clear_instant_table(dd::Table &dd_table);
536 
537 /** Clear the instant ADD COLUMN information of a partition, to make it
538 as a normal partition
539 @param[in,out] dd_part dd::Partition */
540 void dd_clear_instant_part(dd::Partition &dd_part);
541 
542 /** Compare the default values between imported column and column defined
543 in the server. Note that it's absolutely OK if there is no default value
544 in the column defined in server, since it can be filled in later.
545 @param[in] dd_col dd::Column
546 @param[in] col InnoDB column object
547 @return true The default values match
548 @retval false Not match */
549 bool dd_match_default_value(const dd::Column *dd_col, const dict_col_t *col);
550 
551 /** Write default value of a column to dd::Column
552 @param[in] col default value of this column to write
553 @param[in,out] dd_col where to store the default value */
554 void dd_write_default_value(const dict_col_t *col, dd::Column *dd_col);
555 
556 /** Import all metadata which is related to instant ADD COLUMN of a table
557 to dd::Table. This is used for IMPORT.
558 @param[in] table InnoDB table object
559 @param[in,out] dd_table dd::Table */
561  dd::Table *dd_table);
562 
563 /** Write metadata of a table to dd::Table
564 @tparam Table dd::Table or dd::Partition
565 @param[in] dd_space_id Tablespace id, which server allocates
566 @param[in,out] dd_table dd::Table or dd::Partition
567 @param[in] table InnoDB table object */
568 template <typename Table>
569 void dd_write_table(dd::Object_id dd_space_id, Table *dd_table,
570  const dict_table_t *table);
571 
572 /** Set options of dd::Table according to InnoDB table object
573 @tparam Table dd::Table or dd::Partition
574 @param[in,out] dd_table dd::Table or dd::Partition
575 @param[in] table InnoDB table object */
576 template <typename Table>
577 void dd_set_table_options(Table *dd_table, const dict_table_t *table);
578 
579 /** Update virtual columns with new se_private_data, currently, only
580 table_id is set
581 @param[in,out] dd_table dd::Table
582 @param[in] id InnoDB table ID to set */
583 void dd_update_v_cols(dd::Table *dd_table, table_id_t id);
584 
585 /** Write metadata of a tablespace to dd::Tablespace
586 @param[in,out] dd_space dd::Tablespace
587 @param[in] space_id InnoDB tablespace ID
588 @param[in] fsp_flags InnoDB tablespace flags
589 @param[in] state InnoDB tablespace state */
590 void dd_write_tablespace(dd::Tablespace *dd_space, space_id_t space_id,
591  uint32_t fsp_flags, dd_space_states state);
592 
593 /** Add fts doc id column and index to new table
594 when old table has hidden fts doc id without fulltext index
595 @param[in,out] new_table New dd table
596 @param[in] old_table Old dd table */
597 void dd_add_fts_doc_id_index(dd::Table &new_table, const dd::Table &old_table);
598 
599 /** Find the specified dd::Index or dd::Partition_index in an InnoDB table
600 @tparam Index dd::Index or dd::Partition_index
601 @param[in] table InnoDB table object
602 @param[in] dd_index Index to search
603 @return the dict_index_t object related to the index */
604 template <typename Index>
605 const dict_index_t *dd_find_index(const dict_table_t *table, Index *dd_index);
606 
607 /** Acquire a shared metadata lock.
608 @param[in,out] thd current thread
609 @param[out] mdl metadata lock
610 @param[in] db schema name
611 @param[in] table table name
612 @retval false if acquired, or trylock timed out
613 @retval true if failed (my_error() will have been called) */
614 UNIV_INLINE MY_ATTRIBUTE((warn_unused_result)) bool dd_mdl_acquire(
615  THD *thd, MDL_ticket **mdl, const char *db, const char *table);
616 
617 /** Release a metadata lock.
618 @param[in,out] thd current thread
619 @param[in,out] mdl metadata lock */
620 void dd_mdl_release(THD *thd, MDL_ticket **mdl);
621 
622 /** Returns thd associated with the trx or current_thd
623 @param[in] trx transaction
624 @return trx->mysql_thd or current_thd */
625 THD *dd_thd_for_undo(const trx_t *trx);
626 
627 /** Check if current undo needs a MDL or not
628 @param[in] trx transaction
629 @return true if MDL is necessary, otherwise false */
630 bool dd_mdl_for_undo(const trx_t *trx);
631 
632 /** Load foreign key constraint info for the dd::Table object.
633 @param[out] m_table InnoDB table handle
634 @param[in] dd_table Global DD table
635 @param[in] col_names column names, or NULL
636 @param[in] ignore_err DICT_ERR_IGNORE_FK_NOKEY or DICT_ERR_IGNORE_NONE
637 @param[in] dict_locked True if dict_sys->mutex is already held,
638  otherwise false
639 @return DB_SUCESS if successfully load FK constraint */
641  const dd::Table *dd_table,
642  const char **col_names,
643  dict_err_ignore_t ignore_err,
644  bool dict_locked);
645 
646 /** Set the AUTO_INCREMENT attribute.
647 @param[in,out] se_private_data dd::Table::se_private_data
648 @param[in] autoinc the auto-increment value */
649 void dd_set_autoinc(dd::Properties &se_private_data, uint64 autoinc);
650 
651 /** Scan a new dd system table, like mysql.tables...
652 @param[in] thd thd
653 @param[in,out] mdl mdl lock
654 @param[in,out] pcur persistent cursor
655 @param[in] mtr the mini-transaction
656 @param[in] system_table_name which dd system table to open
657 @param[in,out] table dict_table_t obj of dd system table
658 @retval the first rec of the dd system table */
659 const rec_t *dd_startscan_system(THD *thd, MDL_ticket **mdl, btr_pcur_t *pcur,
660  mtr_t *mtr, const char *system_table_name,
661  dict_table_t **table);
662 
663 /** Process one mysql.tables record and get the dict_table_t
664 @param[in] heap temp memory heap
665 @param[in,out] rec mysql.tables record
666 @param[in,out] table dict_table_t to fill
667 @param[in] dd_tables dict_table_t obj of dd system table
668 @param[in] mdl mdl on the table
669 @param[in] mtr the mini-transaction
670 @retval error message, or NULL on success */
672  mem_heap_t *heap, const rec_t *rec, dict_table_t **table,
673  dict_table_t *dd_tables, MDL_ticket **mdl, mtr_t *mtr);
674 /** Process one mysql.table_partitions record and get the dict_table_t
675 @param[in] heap temp memory heap
676 @param[in,out] rec mysql.table_partitions record
677 @param[in,out] table dict_table_t to fill
678 @param[in] dd_tables dict_table_t obj of dd partition table
679 @param[in] mdl mdl on the table
680 @param[in] mtr the mini-transaction
681 @retval error message, or NULL on success */
683  mem_heap_t *heap, const rec_t *rec, dict_table_t **table,
684  dict_table_t *dd_tables, MDL_ticket **mdl, mtr_t *mtr);
685 /** Process one mysql.columns record and get info to dict_col_t
686 @param[in,out] heap temp memory heap
687 @param[in] rec mysql.columns record
688 @param[in,out] col dict_col_t to fill
689 @param[in,out] table_id table id
690 @param[in,out] col_name column name
691 @param[in,out] nth_v_col nth v column
692 @param[in] dd_columns dict_table_t obj of mysql.columns
693 @param[in,out] mtr the mini-transaction
694 @retval true if index is filled */
695 bool dd_process_dd_columns_rec(mem_heap_t *heap, const rec_t *rec,
696  dict_col_t *col, table_id_t *table_id,
697  char **col_name, ulint *nth_v_col,
698  const dict_table_t *dd_columns, mtr_t *mtr);
699 
700 /** Process one mysql.columns record for virtual columns
701 @param[in] heap temp memory heap
702 @param[in,out] rec mysql.columns record
703 @param[in,out] table_id table id
704 @param[in,out] pos position
705 @param[in,out] base_pos base column position
706 @param[in,out] n_row number of rows
707 @param[in] dd_columns dict_table_t obj of mysql.columns
708 @param[in] mtr the mini-transaction
709 @retval true if virtual info is filled */
710 bool dd_process_dd_virtual_columns_rec(mem_heap_t *heap, const rec_t *rec,
711  table_id_t *table_id, ulint **pos,
712  ulint **base_pos, ulint *n_row,
713  dict_table_t *dd_columns, mtr_t *mtr);
714 
715 /** Get next record of new DD system tables
716 @param[in,out] pcur persistent cursor
717 @param[in] mtr the mini-transaction
718 @retval next record */
719 const rec_t *dd_getnext_system_rec(btr_pcur_t *pcur, mtr_t *mtr);
720 
721 /** Process one mysql.indexes record and get the dict_index_t
722 @param[in] heap temp memory heap
723 @param[in,out] rec mysql.indexes record
724 @param[in,out] index dict_index_t to fill
725 @param[in] mdl mdl on index->table
726 @param[in,out] parent parent table if it's fts aux table.
727 @param[in,out] parent_mdl mdl on parent if it's fts aux table.
728 @param[in] dd_indexes dict_table_t obj of mysql.indexes
729 @param[in] mtr the mini-transaction
730 @retval true if index is filled */
731 bool dd_process_dd_indexes_rec(mem_heap_t *heap, const rec_t *rec,
732  const dict_index_t **index, MDL_ticket **mdl,
733  dict_table_t **parent, MDL_ticket **parent_mdl,
734  dict_table_t *dd_indexes, mtr_t *mtr);
735 /** Process one mysql.indexes record and get brief info to dict_index_t
736 @param[in] heap temp memory heap
737 @param[in,out] rec mysql.indexes record
738 @param[in,out] index_id index id
739 @param[in,out] space_id space id
740 @param[in] dd_indexes dict_table_t obj of mysql.indexes
741 @retval true if index is filled */
742 bool dd_process_dd_indexes_rec_simple(mem_heap_t *heap, const rec_t *rec,
743  space_index_t *index_id,
744  space_id_t *space_id,
745  dict_table_t *dd_indexes);
746 
747 /** Process one mysql.tablespaces record and get info
748 @param[in] heap temp memory heap
749 @param[in,out] rec mysql.tablespaces record
750 @param[in,out] space_id space id
751 @param[in,out] name space name
752 @param[in,out] flags space flags
753 @param[in,out] server_version server version
754 @param[in,out] space_version space version
755 @param[in,out] is_encrypted true if tablespace is encrypted
756 @param[in,out] state space state
757 @param[in] dd_spaces dict_table_t obj of mysql.tablespaces
758 @return true if data is retrived */
759 bool dd_process_dd_tablespaces_rec(mem_heap_t *heap, const rec_t *rec,
760  space_id_t *space_id, char **name,
761  uint32_t *flags, uint32 *server_version,
762  uint32 *space_version, bool *is_encrypted,
763  dd::String_type *state,
764  dict_table_t *dd_spaces);
765 
766 /** Make sure the data_dir_path is saved in dict_table_t if DATA DIRECTORY
767 was used. Try to read it from the fil_system first, then from new dd.
768 @tparam Table dd::Table or dd::Partition
769 @param[in,out] table Table object
770 @param[in] dd_table DD table object
771 @param[in] dict_mutex_own true if dict_sys->mutex is owned already */
772 template <typename Table>
773 void dd_get_and_save_data_dir_path(dict_table_t *table, const Table *dd_table,
774  bool dict_mutex_own);
775 
776 /** Make sure the tablespace name is saved in dict_table_t if the table
777 uses a general tablespace.
778 Try to read it from the fil_system_t first, then from DD.
779 @param[in] table Table object
780 @param[in] dd_table Global DD table or partition object
781 @param[in] dict_mutex_own) true if dict_sys->mutex is owned already */
782 template <typename Table>
783 void dd_get_and_save_space_name(dict_table_t *table, const Table *dd_table,
784  bool dict_mutex_own);
785 
786 /** Get the meta-data filename from the table name for a
787 single-table tablespace.
788 @param[in] table table object
789 @param[in] dd_table DD table object
790 @param[out] filename filename
791 @param[in] max_len filename max length */
792 void dd_get_meta_data_filename(dict_table_t *table, dd::Table *dd_table,
793  char *filename, ulint max_len);
794 
795 /** Load foreign key constraint for the table. Note, it could also open
796 the foreign table, if this table is referenced by the foreign table
797 @param[in,out] client data dictionary client
798 @param[in] tbl_name Table Name
799 @param[in] col_names column names, or NULL
800 @param[out] m_table InnoDB table handle
801 @param[in] dd_table Global DD table
802 @param[in] thd thread THD
803 @param[in] dict_locked True if dict_sys->mutex is already held,
804  otherwise false
805 @param[in] check_charsets whether to check charset compatibility
806 @param[in,out] fk_tables name list for tables that refer to this table
807 @return DB_SUCESS if successfully load FK constraint */
809  const char *tbl_name, const char **col_names,
810  dict_table_t *m_table, const dd::Table *dd_table,
811  THD *thd, bool dict_locked, bool check_charsets,
812  dict_names_t *fk_tables);
813 
814 /** Load foreign key constraint for the table. Note, it could also open
815 the foreign table, if this table is referenced by the foreign table
816 @param[in,out] client data dictionary client
817 @param[in] tbl_name Table Name
818 @param[in] col_names column names, or NULL
819 @param[out] m_table InnoDB table handle
820 @param[in] dd_table Global DD table
821 @param[in] thd thread THD
822 @param[in] check_charsets whether to check charset compatibility
823 @param[in] ignore_err DICT_ERR_IGNORE_FK_NOKEY or DICT_ERR_IGNORE_NONE
824 @param[in,out] fk_tables name list for tables that refer to this table
825 @return DB_SUCESS if successfully load FK constraint */
827  const char *tbl_name, const char **col_names,
828  dict_table_t *m_table,
829  const dd::Table *dd_table, THD *thd,
830  bool check_charsets,
831  dict_err_ignore_t ignore_err,
832  dict_names_t *fk_tables);
833 
834 /** Instantiate an InnoDB in-memory table metadata (dict_table_t)
835 based on a Global DD object.
836 @param[in,out] client data dictionary client
837 @param[in] dd_table Global DD table object
838 @param[in] dd_part Global DD partition or subpartition, or NULL
839 @param[in] tbl_name table name, or NULL if not known
840 @param[out] table InnoDB table (NULL if not found or loadable)
841 @param[in] thd thread THD
842 @return error code
843 @retval 0 on success */
845  const dd::Table &dd_table,
846  const dd::Partition *dd_part, const char *tbl_name,
847  dict_table_t *&table, THD *thd);
848 #endif /* !UNIV_HOTBACKUP */
849 
850 /** Open a persistent InnoDB table based on table id.
851 @param[in] table_id table identifier
852 @param[in,out] thd current MySQL connection (for mdl)
853 @param[in,out] mdl metadata lock (*mdl set if
854 table_id was found); mdl=NULL if we are resurrecting table IX locks in recovery
855 @param[in] dict_locked dict_sys mutex is held
856 @param[in] check_corruption check if the table is corrupted or not.
857 @return table
858 @retval NULL if the table does not exist or cannot be opened */
860  MDL_ticket **mdl, bool dict_locked,
861  bool check_corruption);
862 
863 /** Close an internal InnoDB table handle.
864 @param[in,out] table InnoDB table handle
865 @param[in,out] thd current MySQL connection (for mdl)
866 @param[in,out] mdl metadata lock (will be set NULL)
867 @param[in] dict_locked whether we hold dict_sys mutex */
868 void dd_table_close(dict_table_t *table, THD *thd, MDL_ticket **mdl,
869  bool dict_locked);
870 
871 #ifndef UNIV_HOTBACKUP
872 /** Set the discard flag for a dd table.
873 @param[in,out] thd current thread
874 @param[in] table InnoDB table
875 @param[in] discard discard flag
876 @retval false if fail. */
877 bool dd_table_discard_tablespace(THD *thd, const dict_table_t *table,
878  dd::Table *table_def, bool discard);
879 
880 /** Open an internal handle to a persistent InnoDB table by name.
881 @param[in,out] thd current thread
882 @param[out] mdl metadata lock
883 @param[in] name InnoDB table name
884 @param[in] dict_locked has dict_sys mutex locked
885 @param[in] ignore_err whether to ignore err
886 @return handle to non-partitioned table
887 @retval NULL if the table does not exist */
889  const char *name, bool dict_locked,
890  ulint ignore_err);
891 
892 /** Returns a cached table object based on table id.
893 @param[in] table_id table id
894 @param[in] dict_locked TRUE=data dictionary locked
895 @return table, NULL if does not exist */
896 UNIV_INLINE
897 dict_table_t *dd_table_open_on_id_in_mem(table_id_t table_id, bool dict_locked);
898 
899 /** Returns a cached table object based on table name.
900 @param[in] name table name
901 @param[in] dict_locked TRUE=data dictionary locked
902 @return table, NULL if does not exist */
903 UNIV_INLINE
904 dict_table_t *dd_table_open_on_name_in_mem(const char *name, ibool dict_locked);
905 
906 /** Open or load a table definition based on a Global DD object.
907 @tparam Table dd::Table or dd::Partition
908 @param[in,out] client data dictionary client
909 @param[in] table MySQL table definition
910 @param[in] norm_name Table Name
911 @param[in] dd_table Global DD table or partition object
912 @param[in] thd thread THD
913 @return ptr to dict_table_t filled, otherwise, nullptr */
914 template <typename Table>
916  const TABLE *table, const char *norm_name,
917  const Table *dd_table, THD *thd);
918 
919 /** Open foreign tables reference a table.
920 @param[in] fk_list foreign key name list
921 @param[in] dict_locked dict_sys mutex is locked or not
922 @param[in] thd thread THD */
923 void dd_open_fk_tables(dict_names_t &fk_list, bool dict_locked, THD *thd);
924 
925 /** Update the tablespace name and file name for rename
926 operation.
927 @param[in] dd_space_id dd tablespace id
928 @param[in] is_system_cs true, if space name is in system characters set.
929  While renaming during bootstrap we have it
930  in system cs. Othwerwise, in file system cs.
931 @param[in] new_space_name dd_tablespace name
932 @param[in] new_path new data file path
933 @retval DB_SUCCESS on success. */
934 dberr_t dd_tablespace_rename(dd::Object_id dd_space_id, bool is_system_cs,
935  const char *new_space_name, const char *new_path);
936 #endif /* !UNIV_HOTBACKUP */
937 
938 #ifndef UNIV_HOTBACKUP
939 /* Create metadata for specified tablespace, acquiring exlcusive MDL first
940 @param[in,out] dd_client data dictionary client
941 @param[in,out] thd THD
942 @param[in,out] dd_space_name dd tablespace name
943 @param[in] space InnoDB tablespace ID
944 @param[in] flags InnoDB tablespace flags
945 @param[in] filename filename of this tablespace
946 @param[in] discarded true if this tablespace was discarded
947 @param[in,out] dd_space_id dd_space_id
948 @retval false on success
949 @retval true on failure */
951  const char *dd_space_name, space_id_t space_id,
952  uint32_t flags, const char *filename, bool discarded,
953  dd::Object_id &dd_space_id);
954 
955 /** Create metadata for implicit tablespace
956 @param[in,out] dd_client data dictionary client
957 @param[in,out] thd THD
958 @param[in] space_id InnoDB tablespace ID
959 @param[in] space_name tablespace name to be set for the
960  newly created tablespace
961 @param[in] filename tablespace filename
962 @param[in] discarded true if this tablespace was discarded
963 @param[in,out] dd_space_id dd tablespace id
964 @retval false on success
965 @retval true on failure */
967  THD *thd, space_id_t space_id,
968  const char *space_name, const char *filename,
969  bool discarded, dd::Object_id &dd_space_id);
970 
971 /** Drop a tablespace
972 @param[in,out] dd_client data dictionary client
973 @param[in,out] thd THD object
974 @param[in] dd_space_id dd tablespace id
975 @retval false On success
976 @retval true On failure */
978  dd::Object_id dd_space_id);
979 
980 /** Obtain the private handler of InnoDB session specific data.
981 @param[in,out] thd MySQL thread handler.
982 @return reference to private handler */
983 MY_ATTRIBUTE((warn_unused_result))
985 
986 /** Look up a column in a table using the system_charset_info collation.
987 @param[in] dd_table data dictionary table
988 @param[in] name column name
989 @return the column
990 @retval nullptr if not found */
991 UNIV_INLINE
992 const dd::Column *dd_find_column(const dd::Table *dd_table, const char *name);
993 
994 /** Add a hidden column when creating a table.
995 @param[in,out] dd_table table containing user columns and indexes
996 @param[in] name hidden column name
997 @param[in] length length of the column, in bytes
998 @param[in] type column type
999 @return the added column, or NULL if there already was a column by that name */
1000 UNIV_INLINE
1001 dd::Column *dd_add_hidden_column(dd::Table *dd_table, const char *name,
1003 
1004 /** Add a hidden index element at the end.
1005 @param[in,out] index created index metadata
1006 @param[in] column column of the index */
1007 UNIV_INLINE
1008 void dd_add_hidden_element(dd::Index *index, const dd::Column *column);
1009 
1010 /** Initialize a hidden unique B-tree index.
1011 @param[in,out] index created index metadata
1012 @param[in] name name of the index
1013 @param[in] column column of the index
1014 @return the initialized index */
1015 UNIV_INLINE
1017  const dd::Column *column);
1018 
1019 /** Check whether there exist a column named as "FTS_DOC_ID", which is
1020 reserved for InnoDB FTS Doc ID
1021 @param[in] thd MySQL thread handle
1022 @param[in] form information on table
1023  columns and indexes
1024 @param[out] doc_id_col Doc ID column number if
1025  there exist a FTS_DOC_ID column,
1026  ULINT_UNDEFINED if column is of the
1027  wrong type/name/size
1028 @return true if there exist a "FTS_DOC_ID" column */
1029 UNIV_INLINE
1030 bool create_table_check_doc_id_col(THD *thd, const TABLE *form,
1031  ulint *doc_id_col);
1032 
1033 /** Return a display name for the row format
1034 @param[in] row_format Row Format
1035 @return row format name */
1036 UNIV_INLINE
1037 const char *get_row_format_name(enum row_type row_format);
1038 
1039 /** Get the file name of a tablespace.
1040 @param[in] dd_space Tablespace metadata
1041 @return file name */
1042 UNIV_INLINE
1043 const char *dd_tablespace_get_filename(const dd::Tablespace *dd_space) {
1044  ut_ad(dd_space->id() != dd::INVALID_OBJECT_ID);
1045  ut_ad(dd_space->files().size() == 1);
1046  return ((*dd_space->files().begin())->filename().c_str());
1047 }
1048 
1049 /** Check if the InnoDB table is consistent with dd::Table
1050 @tparam Table dd::Table or dd::Partition
1051 @param[in] table InnoDB table
1052 @param[in] dd_table dd::Table or dd::Partition
1053 @return true if match
1054 @retval false if not match */
1055 template <typename Table>
1056 bool dd_table_match(const dict_table_t *table, const Table *dd_table);
1057 
1058 /** Create dd table for fts aux index table
1059 @param[in] parent_table parent table of fts table
1060 @param[in,out] table fts table
1061 @param[in] charset fts index charset
1062 @return true on success, false on failure */
1063 bool dd_create_fts_index_table(const dict_table_t *parent_table,
1064  dict_table_t *fts_table,
1065  const CHARSET_INFO *charset);
1066 
1067 /** Create dd table for fts aux common table
1068 @param[in] parent_table parent table of fts table
1069 @param[in,out] table fts table
1070 @param[in] is_config flag whether it's fts aux configure table
1071 @return true on success, false on failure */
1072 bool dd_create_fts_common_table(const dict_table_t *parent_talbe,
1073  dict_table_t *table, bool is_config);
1074 
1075 /** Drop dd table & tablespace for fts aux table
1076 @param[in] name table name
1077 @param[in] file_per_table flag whether use file per table
1078 @return true on success, false on failure. */
1079 bool dd_drop_fts_table(const char *name, bool file_per_table);
1080 
1081 /** Rename dd table & tablespace files for fts aux table
1082 @param[in] table dict table
1083 @param[in] old_name old innodb table name
1084 @return true on success, false on failure. */
1085 bool dd_rename_fts_table(const dict_table_t *table, const char *old_name);
1086 
1087 /** Open a table from its database and table name, this is currently used by
1088 foreign constraint parser to get the referenced table.
1089 @param[in] name foreign key table name
1090 @param[in] database_name table db name
1091 @param[in] database_name_len db name length
1092 @param[in] table_name table db name
1093 @param[in] table_name_len table name length
1094 @param[in,out] table table object or NULL
1095 @param[in,out] mdl mdl on table
1096 @param[in,out] heap heap memory
1097 @return complete table name with database and table name, allocated from
1098 heap memory passed in */
1099 char *dd_get_referenced_table(const char *name, const char *database_name,
1100  ulint database_name_len, const char *table_name,
1101  ulint table_name_len, dict_table_t **table,
1102  MDL_ticket **mdl, mem_heap_t *heap);
1103 
1104 /** Set state attribute in se_private_data of tablespace
1105 @param[in,out] dd_space dd::Tablespace object
1106 @param[in] state value to set for key 'state' */
1108 
1109 /** Set Space ID and state attribute in se_private_data of mysql.tablespaces
1110 for the named tablespace.
1111 @param[in] space_name tablespace name
1112 @param[in] space_id tablespace id
1113 @param[in] state value to set for key 'state'
1114 @return DB_SUCCESS or DD_FAILURE. */
1115 bool dd_tablespace_set_id_and_state(const char *space_name, space_id_t space_id,
1116  dd_space_states state);
1117 
1118 /** Get state attribute value in dd::Tablespace::se_private_data
1119 @param[in] dd_space dd::Tablespace object
1120 @param[in,out] state tablespace state attribute
1121 @param[in] space_id tablespace ID */
1122 void dd_tablespace_get_state(const dd::Tablespace *dd_space,
1123  dd::String_type *state,
1124  space_id_t space_id = SPACE_UNKNOWN);
1125 
1126 /** Get state attribute value in dd::Tablespace::se_private_data
1127 @param[in] p dd::Properties for dd::Tablespace::se_private_data
1128 @param[in,out] state tablespace state attribute
1129 @param[in] space_id tablespace ID */
1131  space_id_t space_id = SPACE_UNKNOWN);
1132 
1133 /** Get the enum for the state of the undo tablespace
1134 from either dd::Tablespace::se_private_data or undo::Tablespace
1135 @param[in] dd_space dd::Tablespace object
1136 @param[in] space_id tablespace ID
1137 @return enumerated value associated with the key 'state' */
1139  const dd::Tablespace *dd_space, space_id_t space_id = SPACE_UNKNOWN);
1140 
1141 /** Get the enum for the state of the undo tablespace
1142 from either dd::Tablespace::se_private_data or undo::Tablespace
1143 @param[in] p dd::Properties for dd::Tablespace::se_private_data
1144 @param[in] space_id tablespace ID
1145 @return enumerated value associated with the key 'state' */
1147  const dd::Properties *p, space_id_t space_id = SPACE_UNKNOWN);
1148 
1149 /** Get the discarded state from se_private_data of tablespace
1150 @param[in] dd_space dd::Tablespace object */
1151 bool dd_tablespace_is_discarded(const dd::Tablespace *dd_space);
1152 
1153 /** Get the MDL for the named tablespace. The mdl_ticket pointer can
1154 be provided if it is needed by the caller. If foreground is set to false,
1155 then the caller must explicitly release that ticket with dd_release_mdl().
1156 Otherwise, it will ne released with the transaction.
1157 @param[in] space_name tablespace name
1158 @param[in] mdl_ticket tablespace MDL ticket, default to nullptr
1159 @param[in] foreground true, if the caller is foreground thread. Default
1160  is true. For foreground, the lock duration is
1161  MDL_TRANSACTION. Otherwise, it is MDL_EXPLICIT.
1162 @return DD_SUCCESS or DD_FAILURE. */
1163 bool dd_tablespace_get_mdl(const char *space_name,
1164  MDL_ticket **mdl_ticket = nullptr,
1165  bool foreground = true);
1166 /** Set discard attribute value in se_private_dat of tablespace
1167 @param[in] dd_space dd::Tablespace object
1168 @param[in] discard true if discarded, else false */
1169 void dd_tablespace_set_discard(dd::Tablespace *dd_space, bool discard);
1170 
1171 /** Get discard attribute value stored in se_private_dat of tablespace
1172 @param[in] dd_space dd::Tablespace object
1173 @retval true if Tablespace is discarded
1174 @retval false if attribute doesn't exist or if the
1175  tablespace is not discarded */
1176 bool dd_tablespace_get_discard(const dd::Tablespace *dd_space);
1177 
1178 /** Release the MDL held by the given ticket.
1179 @param[in] mdl_ticket tablespace MDL ticket */
1180 void dd_release_mdl(MDL_ticket *mdl_ticket);
1181 
1182 #endif /* !UNIV_HOTBACKUP */
1183 
1184 /** Update all InnoDB tablespace cache objects. This step is done post
1185 dictionary trx rollback, binlog recovery and DDL_LOG apply. So DD is
1186 consistent. Update the cached tablespace objects, if they differ from
1187 dictionary
1188 @param[in,out] thd thread handle
1189 @retval true on error
1190 @retval false on success */
1191 MY_ATTRIBUTE((warn_unused_result))
1192 bool dd_tablespace_update_cache(THD *thd);
1193 
1194 /* Check if the table belongs to an encrypted tablespace.
1195 @return true if it does. */
1197 
1198 #include "dict0dd.ic"
1199 #endif
dd_get_total_indexes_num
uint32_t dd_get_total_indexes_num()
Definition: dict0dd.cc:5923
dd::Column
Definition: column.h:86
dd::Table::PT_NONE
@ PT_NONE
Definition: table.h:89
dd_table_check_for_child
dberr_t dd_table_check_for_child(dd::cache::Dictionary_client *client, const char *tbl_name, const char **col_names, dict_table_t *m_table, const dd::Table *dd_table, THD *thd, bool check_charsets, dict_err_ignore_t ignore_err, dict_names_t *fk_tables)
Load foreign key constraint for the table.
Definition: dict0dd.cc:3473
dd_create_implicit_tablespace
bool dd_create_implicit_tablespace(dd::cache::Dictionary_client *dd_client, THD *thd, space_id_t space_id, const char *space_name, const char *filename, bool discarded, dd::Object_id &dd_space_id)
Create metadata for implicit tablespace.
Definition: dict0dd.cc:3158
dictionary_client.h
dd::Properties
The Properties class defines an interface for storing key=value pairs, where both key and value may b...
Definition: properties.h:73
DD_INSTANT_COLUMN_DEFAULT_NULL
@ DD_INSTANT_COLUMN_DEFAULT_NULL
Default value is null or not.
Definition: dict0dd.h:108
THD
Definition: sql_class.h:764
DD_TABLE_VERSION
@ DD_TABLE_VERSION
Dynamic metadata version.
Definition: dict0dd.h:86
get_row_format_name
const UNIV_INLINE char * get_row_format_name(enum row_type row_format)
Return a display name for the row format.
btr_pcur_t
Definition: btr0pcur.h:177
dd::Tablespace
Definition: tablespace.h:54
DD_SPACE_ID
@ DD_SPACE_ID
Tablespace identifier.
Definition: dict0dd.h:141
dd_table_has_instant_cols
bool dd_table_has_instant_cols(const dd::Table &table)
Determine if a dd::Table has any instant column.
Definition: dict0dd.h:375
dict0types.h
rules_table_service::table_name
const char * table_name
Definition: rules_table_service.cc:55
data_file_name_key
static const dd::String_type data_file_name_key("data_file_name")
dd::Partition::options() key for DATA DIRECTORY
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
DD_PARTITION__LAST
@ DD_PARTITION__LAST
Sentinel.
Definition: dict0dd.h:133
dd_thd_for_undo
THD * dd_thd_for_undo(const trx_t *trx)
Returns thd associated with the trx or current_thd.
Definition: dict0dd.cc:241
dd_process_dd_virtual_columns_rec
bool dd_process_dd_virtual_columns_rec(mem_heap_t *heap, const rec_t *rec, table_id_t *table_id, ulint **pos, ulint **base_pos, ulint *n_row, dict_table_t *dd_columns, mtr_t *mtr)
Process one mysql.columns record for virtual columns.
Definition: dict0dd.cc:4755
dd_find_column
const UNIV_INLINE dd::Column * dd_find_column(const dd::Table *dd_table, const char *name)
Look up a column in a table using the system_charset_info collation.
DD_SPACE_DISCARD
@ DD_SPACE_DISCARD
Discard attribute.
Definition: dict0dd.h:143
dd_is_table_in_encrypted_tablespace
bool dd_is_table_in_encrypted_tablespace(const dict_table_t *table)
Definition: dict0dd.cc:6117
dd_tablespace_update_cache
bool dd_tablespace_update_cache(THD *thd)
Update all InnoDB tablespace cache objects.
Definition: dict0dd.cc:6009
dd_index_key_strings
const char *const dd_index_key_strings[DD_INDEX__LAST]
InnoDB private key strings for dd::Index or dd::Partition_index.
Definition: dict0dd.h:227
dd_table_match
bool dd_table_match(const dict_table_t *table, const Table *dd_table)
Check if the InnoDB table is consistent with dd::Table.
Definition: dict0dd.cc:183
dd_table_open_on_id_in_mem
UNIV_INLINE dict_table_t * dd_table_open_on_id_in_mem(table_id_t table_id, bool dict_locked)
Returns a cached table object based on table id.
dd::Table::subpartition_type
virtual enum_subpartition_type subpartition_type() const =0
dict_err_ignore_t
dict_err_ignore_t
Error to ignore when we load table dictionary into memory.
Definition: dict0types.h:277
dd_table.h
innodb_dd_table_size
static constexpr size_t innodb_dd_table_size
Number of hard-coded data dictionary tables.
Definition: dict0dd.h:296
dd_tablespaces_name
static const dd::String_type dd_tablespaces_name("mysql/tablespaces")
dd::Partition_index
Definition: partition_index.h:46
dd_table_open_on_name
dict_table_t * dd_table_open_on_name(THD *thd, MDL_ticket **mdl, const char *name, bool dict_locked, ulint ignore_err)
Open an internal handle to a persistent InnoDB table by name.
Definition: dict0dd.cc:868
dd_set_hidden_unique_index
UNIV_INLINE dd::Index * dd_set_hidden_unique_index(dd::Index *index, const char *name, const dd::Column *column)
Initialize a hidden unique B-tree index.
dd_add_hidden_element
UNIV_INLINE void dd_add_hidden_element(dd::Index *index, const dd::Column *column)
Add a hidden index element at the end.
dd_create_fts_index_table
bool dd_create_fts_index_table(const dict_table_t *parent_table, dict_table_t *fts_table, const CHARSET_INFO *charset)
Create dd table for fts aux index table.
Definition: dict0dd.cc:5328
ut_ad
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:65
DD_SPACE_SERVER_VERSION
@ DD_SPACE_SERVER_VERSION
Server version.
Definition: dict0dd.h:145
CHARSET_INFO
Definition: m_ctype.h:354
dict0mem.h
dd_process_dd_indexes_rec_simple
bool dd_process_dd_indexes_rec_simple(mem_heap_t *heap, const rec_t *rec, space_index_t *index_id, space_id_t *space_id, dict_table_t *dd_indexes)
Process one mysql.indexes record and get brief info to dict_index_t.
Definition: dict0dd.cc:5031
tablespace.h
dict_index_t
Data structure for an index.
Definition: dict0mem.h:869
dd_index_keys
dd_index_keys
InnoDB private keys for dd::Index or dd::Partition_index.
Definition: dict0dd.h:210
dd_part_adjust_table_id
void dd_part_adjust_table_id(dd::Table *new_table)
Adjust TABLE_ID for partitioned table after ALTER TABLE ...
Definition: dict0dd.cc:1566
innobase_hton_name
static const char innobase_hton_name[]
Definition: dict0dd.h:74
dd_write_tablespace
void dd_write_tablespace(dd::Tablespace *dd_space, space_id_t space_id, uint32_t fsp_flags, dd_space_states state)
Write metadata of a tablespace to dd::Tablespace.
Definition: dict0dd.cc:2109
mtr_t
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:169
uint64
uint64_t uint64
Definition: my_inttypes.h:68
dd_mdl_acquire
UNIV_INLINE bool dd_mdl_acquire(THD *thd, MDL_ticket **mdl, const char *db, const char *table)
Acquire a shared metadata lock.
dd::Table::tablespace_id
virtual Object_id tablespace_id() const =0
pos
char * pos
Definition: do_ctype.cc:76
dd::Table::ST_NONE
@ ST_NONE
Definition: table.h:105
dd::Collection::begin
iterator begin()
Definition: collection.h:190
DD_TABLE_AUTOINC
@ DD_TABLE_AUTOINC
Auto-increment counter.
Definition: dict0dd.h:82
TABLE
Definition: table.h:1305
dd::Table::partition_type
virtual enum_partition_type partition_type() const =0
innodb_dd_table_t::name
const char * name
Data dictionary table name.
Definition: dict0dd.h:251
innodb_session_t
Definition: sess0sess.h:70
dd_drop_fts_table
bool dd_drop_fts_table(const char *name, bool file_per_table)
Drop dd table & tablespace for fts aux table.
Definition: dict0dd.cc:5613
dd::Table::se_private_data
virtual const Properties & se_private_data() const =0
dd_column_key_strings
const char *const dd_column_key_strings[DD_COLUMN__LAST]
InnoDB private key strings for dd::Column,.
Definition: dict0dd.h:202
DD_SPACE_STATE_NORMAL
@ DD_SPACE_STATE_NORMAL
Normal IBD tablespace.
Definition: dict0dd.h:157
dberr_t
dberr_t
Definition: db0err.h:38
dd::Tablespace::files
virtual const Tablespace_file_collection & files() const =0
server_version
static char * server_version
Definition: mysql.cc:107
dd.h
dd::Table::leaf_partitions
virtual const Partition_leaf_vector & leaf_partitions() const =0
dict_table_t
Data structure for a database table.
Definition: dict0mem.h:1510
dd_table_discard_tablespace
bool dd_table_discard_tablespace(THD *thd, const dict_table_t *table, dd::Table *table_def, bool discard)
Set the discard flag for a dd table.
Definition: dict0dd.cc:773
dd_part_has_instant_cols
bool dd_part_has_instant_cols(const dd::Partition &part)
Determine if a dd::Partition has any instant column.
Definition: dict0dd.h:388
innodb_dd_table_t
Hard-coded data dictionary information.
Definition: dict0dd.h:249
DD_instant_col_val_coder::DD_instant_col_val_coder
DD_instant_col_val_coder()
Constructor.
Definition: dict0dd.h:316
dd_tablespace_get_mdl
bool dd_tablespace_get_mdl(const char *space_name, MDL_ticket **mdl_ticket=nullptr, bool foreground=true)
Get the MDL for the named tablespace.
Definition: dict0dd.cc:5884
dd_add_hidden_column
UNIV_INLINE dd::Column * dd_add_hidden_column(dd::Table *dd_table, const char *name, uint length, dd::enum_column_types type)
Add a hidden column when creating a table.
DD_INDEX_SPACE_ID
@ DD_INDEX_SPACE_ID
Space id.
Definition: dict0dd.h:214
DD_TABLE_INSTANT_COLS
@ DD_TABLE_INSTANT_COLS
Columns before first instant ADD COLUMN.
Definition: dict0dd.h:90
dd_tablespace_set_discard
void dd_tablespace_set_discard(dd::Tablespace *dd_space, bool discard)
Set discard attribute value in se_private_dat of tablespace.
DD_SPACE_STATE
@ DD_SPACE_STATE
Current state attribute.
Definition: dict0dd.h:149
dd_process_dd_partitions_rec_and_mtr_commit
const char * dd_process_dd_partitions_rec_and_mtr_commit(mem_heap_t *heap, const rec_t *rec, dict_table_t **table, dict_table_t *dd_tables, MDL_ticket **mdl, mtr_t *mtr)
Process one mysql.table_partitions record and get the dict_table_t.
Definition: dict0dd.cc:4524
dd_first
const Index * dd_first(const Table *table)
Get the first index of a table or partition.
Definition: dict0dd.h:422
dd_update_v_cols
void dd_update_v_cols(dd::Table *dd_table, table_id_t id)
Update virtual columns with new se_private_data, currently, only table_id is set.
Definition: dict0dd.cc:2080
dd_add_instant_columns
void dd_add_instant_columns(const TABLE *old_table, const TABLE *altered_table, dd::Table *new_dd_table, const dict_table_t *new_table)
Add column default values for new instantly added columns.
Definition: dict0dd.cc:1653
table_def
A table definition from the master.
Definition: rpl_utility.h:246
dd_tablespace_set_id_and_state
bool dd_tablespace_set_id_and_state(const char *space_name, space_id_t space_id, dd_space_states state)
Set Space ID and state attribute in se_private_data of mysql.tablespaces for the named tablespace.
Definition: dict0dd.cc:5763
dd_open_table
dict_table_t * dd_open_table(dd::cache::Dictionary_client *client, const TABLE *table, const char *norm_name, const Table *dd_table, THD *thd)
Open or load a table definition based on a Global DD object.
Definition: dict0dd.cc:4348
DD_TABLE_ID
@ DD_TABLE_ID
Table id.
Definition: dict0dd.h:216
dd_tablespace_is_discarded
bool dd_tablespace_is_discarded(const dd::Tablespace *dd_space)
Get the discarded state from se_private_data of tablespace.
Definition: dict0dd.cc:5872
dd_indexes_name
static const dd::String_type dd_indexes_name("mysql/indexes")
DD_INDEX_TRX_ID
@ DD_INDEX_TRX_ID
Creating transaction ID.
Definition: dict0dd.h:220
rec_t
byte rec_t
Definition: rem0types.h:39
dd_set_table_options
void dd_set_table_options(Table *dd_table, const dict_table_t *table)
Set options of dd::Table according to InnoDB table object.
Definition: dict0dd.cc:2019
DD_INDEX__LAST
@ DD_INDEX__LAST
Sentinel.
Definition: dict0dd.h:222
dd_columns_name
static const dd::String_type dd_columns_name("mysql/columns")
mem_block_info_t
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:337
Table
Definition: test_sql_stmt.cc:150
dd_create_tablespace
bool dd_create_tablespace(dd::cache::Dictionary_client *dd_client, THD *thd, const char *dd_space_name, space_id_t space_id, uint32_t flags, const char *filename, bool discarded, dd::Object_id &dd_space_id)
Definition: dict0dd.cc:3095
dd_table_load_fk
dberr_t dd_table_load_fk(dd::cache::Dictionary_client *client, const char *tbl_name, const char **col_names, dict_table_t *m_table, const dd::Table *dd_table, THD *thd, bool dict_locked, bool check_charsets, dict_names_t *fk_tables)
Load foreign key constraint for the table.
Definition: dict0dd.cc:3421
row_type
row_type
Definition: handler.h:665
dd_tablespace_rename
dberr_t dd_tablespace_rename(dd::Object_id dd_space_id, bool is_system_cs, const char *new_space_name, const char *new_path)
Update the tablespace name and file name for rename operation.
Definition: dict0dd.cc:1053
dd_find_index
const dict_index_t * dd_find_index(const dict_table_t *table, Index *dd_index)
Find the specified dd::Index or dd::Partition_index in an InnoDB table.
Definition: dict0dd.cc:2154
dd_drop_tablespace
bool dd_drop_tablespace(dd::cache::Dictionary_client *dd_client, THD *thd, dd::Object_id dd_space_id)
Drop a tablespace.
Definition: dict0dd.cc:3180
sess0sess.h
index_file_name_key
static const dd::String_type index_file_name_key("index_file_name")
dd::Partition::options() key for INDEX DIRECTORY
dd_get_and_save_space_name
void dd_get_and_save_space_name(dict_table_t *table, const Table *dd_table, bool dict_mutex_own)
Make sure the tablespace name is saved in dict_table_t if the table uses a general tablespace.
Definition: dict0dd.cc:3939
dd_create_fts_common_table
bool dd_create_fts_common_table(const dict_table_t *parent_talbe, dict_table_t *table, bool is_config)
Create dd table for fts aux common table.
Definition: dict0dd.cc:5474
UT_DELETE_ARRAY
#define UT_DELETE_ARRAY(ptr)
Destroy, deallocate and trace the deallocation of an array created by UT_NEW_ARRAY() or UT_NEW_ARRAY_...
Definition: ut0new.h:1057
dd_space_states
dd_space_states
Values for InnoDB private key "state" for dd::Tablespace.
Definition: dict0dd.h:155
dd_tablespace_set_state
void dd_tablespace_set_state(dd::Tablespace *dd_space, dd_space_states state)
Set state attribute in se_private_data of tablespace.
Definition: dict0dd.cc:5751
innodb_dd_table
const innodb_dd_table_t innodb_dd_table[]
The hard-coded data dictionary tables.
Definition: dict0dd.h:257
dd_open_fk_tables
void dd_open_fk_tables(dict_names_t &fk_list, bool dict_locked, THD *thd)
Open foreign tables reference a table.
Definition: dict0dd.cc:4319
create_table_check_doc_id_col
UNIV_INLINE bool create_table_check_doc_id_col(THD *thd, const TABLE *form, ulint *doc_id_col)
Check whether there exist a column named as "FTS_DOC_ID", which is reserved for InnoDB FTS Doc ID.
dd_tablespace_get_state_enum
dd_space_states dd_tablespace_get_state_enum(const dd::Tablespace *dd_space, space_id_t space_id=SPACE_UNKNOWN)
Get the enum for the state of the undo tablespace from either dd::Tablespace::se_private_data or undo...
Definition: dict0dd.cc:5803
reserved_implicit_name
static constexpr char reserved_implicit_name[]
InnoDB implicit tablespace name or prefix, which should be same to dict_sys_t::s_file_per_table_name.
Definition: dict0dd.h:178
dd_tablespace_get_state
void dd_tablespace_get_state(const dd::Tablespace *dd_space, dd::String_type *state, space_id_t space_id=SPACE_UNKNOWN)
Get state attribute value in dd::Tablespace::se_private_data.
Definition: dict0dd.cc:5784
dd_table_open_on_dd_obj
int dd_table_open_on_dd_obj(dd::cache::Dictionary_client *client, const dd::Table &dd_table, const dd::Partition *dd_part, const char *tbl_name, dict_table_t *&table, THD *thd)
Instantiate an InnoDB in-memory table metadata (dict_table_t) based on a Global DD object.
Definition: dict0dd.cc:276
dd_space_key_strings
const char *const dd_space_key_strings[DD_SPACE__LAST]
InnoDB private key strings for dd::Tablespace.
Definition: dict0dd.h:182
dd_table_load_fk_from_dd
dberr_t dd_table_load_fk_from_dd(dict_table_t *m_table, const dd::Table *dd_table, const char **col_names, dict_err_ignore_t ignore_err, bool dict_locked)
Load foreign key constraint info for the dd::Table object.
Definition: dict0dd.cc:3252
DD_INDEX_ROOT
@ DD_INDEX_ROOT
Root page number.
Definition: dict0dd.h:218
DD_SPACE__LAST
@ DD_SPACE__LAST
Sentinel.
Definition: dict0dd.h:151
dd_table_open_on_id
dict_table_t * dd_table_open_on_id(table_id_t table_id, THD *thd, MDL_ticket **mdl, bool dict_locked, bool check_corruption)
Open a persistent InnoDB table based on table id.
Definition: dict0dd.cc:598
dd_table_is_partitioned
bool dd_table_is_partitioned(const dd::Table &table)
Determine if a dd::Table is partitioned table.
Definition: dict0dd.h:359
dd_clear_instant_table
void dd_clear_instant_table(dd::Table &dd_table)
Clear the instant ADD COLUMN information of a table.
Definition: dict0dd.cc:1580
dd_startscan_system
const rec_t * dd_startscan_system(THD *thd, MDL_ticket **mdl, btr_pcur_t *pcur, mtr_t *mtr, const char *system_table_name, dict_table_t **table)
Scan a new dd system table, like mysql.tables...
Definition: dict0dd.cc:4419
table_id_t
ib_id_t table_id_t
Table or partition identifier (unique within an InnoDB instance).
Definition: dict0types.h:215
DD_SPACE_STATE__LAST
@ DD_SPACE_STATE__LAST
Sentinel.
Definition: dict0dd.h:173
DD_SPACE_STATE_ACTIVE
@ DD_SPACE_STATE_ACTIVE
Active undo tablespace.
Definition: dict0dd.h:163
uint
unsigned int uint
Definition: uca-dump.cc:29
mysql_com.h
handler_name
static constexpr char handler_name[]
Handler name for InnoDB.
Definition: dict0dd.h:72
dd::Properties::exists
virtual bool exists(const String_type &key) const =0
Check for the existence of a key=value pair given the key.
is_config
static int is_config(cargo_type x)
Definition: xcom_base.c:1870
dd::is_encrypted
bool is_encrypted(const String_type &type)
Definition: dd_table.h:420
dd::Partition::parent
virtual const Partition * parent() const =0
column.h
dd_column_keys
dd_column_keys
InnoDB private keys for dd::Column.
Definition: dict0dd.h:104
DD_instant_col_val_coder::decode
const byte * decode(const char *stream, size_t in_len, size_t *out_len)
Decode the specified stream, which is encoded by encode()
Definition: dict0dd.cc:96
foreign_key_element.h
DD_INSTANT_COLUMN_DEFAULT
@ DD_INSTANT_COLUMN_DEFAULT
Default value when it was added instantly.
Definition: dict0dd.h:106
dd_import_instant_add_columns
void dd_import_instant_add_columns(const dict_table_t *table, dd::Table *dd_table)
Import all metadata which is related to instant ADD COLUMN of a table to dd::Table.
Definition: dict0dd.cc:1879
dd::cache::Dictionary_client
Definition: dictionary_client.h:145
table.h
dd_first_index
const dd::Index * dd_first_index(const dd::Table *table)
Get the first index of a table.
Definition: dict0dd.h:430
dd_match_default_value
bool dd_match_default_value(const dd::Column *dd_col, const dict_col_t *col)
Compare the default values between imported column and column defined in the server.
Definition: dict0dd.cc:1802
DD_SPACE_STATE_CORRUPTED
@ DD_SPACE_STATE_CORRUPTED
Corrupted IBD tablespace.
Definition: dict0dd.h:161
dd_process_dd_indexes_rec
bool dd_process_dd_indexes_rec(mem_heap_t *heap, const rec_t *rec, const dict_index_t **index, MDL_ticket **mdl, dict_table_t **parent, MDL_ticket **parent_mdl, dict_table_t *dd_indexes, mtr_t *mtr)
Process one mysql.indexes record and get the dict_index_t.
Definition: dict0dd.cc:4876
tablespace_file.h
dd_table_close
void dd_table_close(dict_table_t *table, THD *thd, MDL_ticket **mdl, bool dict_locked)
Close an internal InnoDB table handle.
Definition: dict0dd.cc:995
dd_getnext_system_rec
const rec_t * dd_getnext_system_rec(btr_pcur_t *pcur, mtr_t *mtr)
Get next record of new DD system tables.
Definition: dict0dd.cc:4404
uint32
uint32_t uint32
Definition: my_inttypes.h:66
space_index_t
ib_id_t space_index_t
Index identifier (unique within a tablespace).
Definition: dict0types.h:217
DD_instant_col_val_coder
Class to decode or encode a stream of default value for instant table.
Definition: dict0dd.h:313
dd::Table
Definition: table.h:45
DD_COLUMN__LAST
@ DD_COLUMN__LAST
Sentinel.
Definition: dict0dd.h:110
DD_TABLE_DATA_DIRECTORY
@ DD_TABLE_DATA_DIRECTORY
DATA DIRECTORY (static metadata)
Definition: dict0dd.h:84
dd_get_space_id
dd::Object_id dd_get_space_id(const dd::Table &table)
Get the explicit dd::Tablespace::id of a table.
Definition: dict0dd.h:457
dd_copy_instant_n_cols
void dd_copy_instant_n_cols(dd::Table &new_table, const dd::Table &old_table)
Copy the metadata of a table definition if there was an instant ADD COLUMN happened.
Definition: dict0dd.cc:1458
partition.h
dd_table_keys
dd_table_keys
InnoDB private keys for dd::Table.
Definition: dict0dd.h:80
dd_copy_table
void dd_copy_table(dd::Table &new_table, const dd::Table &old_table)
Copy the metadata of a table definition, including the INSTANT ADD COLUMN information.
Definition: dict0dd.h:510
name
const string name("\"Name\"")
DD_INDEX_ID
@ DD_INDEX_ID
Index identifier.
Definition: dict0dd.h:212
thd_to_innodb_session
innodb_session_t *& thd_to_innodb_session(THD *thd)
Obtain the private handler of InnoDB session specific data.
Definition: ha_innodb.cc:1750
dd::Object_id
unsigned long long Object_id
Definition: object_id.h:30
dd::INVALID_OBJECT_ID
const Object_id INVALID_OBJECT_ID
The default object ID which represents that the DD object is new and not persistent in dictionary tab...
Definition: object_id.h:36
DD_SPACE_STATE_INACTIVE
@ DD_SPACE_STATE_INACTIVE
Inactive undo tablespace being truncated, selected explicitly by ALTER UNDO TABLESPACE SET INACTIVE.
Definition: dict0dd.h:168
index_element.h
DD_SPACE_CURRENT_SPACE_VERSION
const uint32 DD_SPACE_CURRENT_SPACE_VERSION
The tablespace version that the tablespace created.
Definition: dict0dd.h:119
dd_part_is_first
bool dd_part_is_first(const dd::Partition *dd_part)
Determine if a dd::Partition is the first leaf partition in the table.
Definition: dict0dd.h:351
dictionary.h
dd_schema.h
dd_copy_private
void dd_copy_private(Table &new_table, const Table &old_table)
Copy the engine-private parts of a table or partition definition when the change does not affect Inno...
Definition: dict0dd.cc:1487
dd_part_is_stored
bool dd_part_is_stored(const dd::Partition *part)
Determine if a partition is materialized.
Definition: dict0dd.h:447
dd_instant_columns_exist
bool dd_instant_columns_exist(const dd::Table &dd_table)
Check if the instant columns are consistent with the se_private_data in dd::Table.
Definition: dict0dd.cc:1613
dd::enum_column_types
enum_column_types
Definition: column.h:52
dd_release_mdl
void dd_release_mdl(MDL_ticket *mdl_ticket)
Release the MDL held by the given ticket.
Definition: dict0dd.cc:5916
dd_clear_instant_part
void dd_clear_instant_part(dd::Partition &dd_part)
Clear the instant ADD COLUMN information of a partition, to make it as a normal partition.
Definition: dict0dd.cc:1605
dd_set_autoinc
void dd_set_autoinc(dd::Properties &se_private_data, uint64 autoinc)
Set the AUTO_INCREMENT attribute.
Definition: dict0dd.cc:1399
dd_write_table
void dd_write_table(dd::Object_id dd_space_id, Table *dd_table, const dict_table_t *table)
Write metadata of a table to dd::Table.
Definition: dict0dd.cc:1975
dd_rename_fts_table
bool dd_rename_fts_table(const dict_table_t *table, const char *old_name)
Rename dd table & tablespace files for fts aux table.
Definition: dict0dd.cc:5659
DD_instant_col_val_coder::encode
const char * encode(const byte *stream, size_t in_len, size_t *out_len)
Encode the specified stream in format of bytes into chars.
Definition: dict0dd.cc:76
dd_table_share.h
DD_SPACE_FLAGS
@ DD_SPACE_FLAGS
Tablespace flags.
Definition: dict0dd.h:139
Vt100::foreground
std::string HARNESS_EXPORT foreground(Color c)
get 'change foreground color' ESC sequence.
Definition: vt100.cc:132
dd_tables_name
static const dd::String_type dd_tables_name("mysql/tables")
Table names needed to process I_S queries.
dd_partitions_name
static const dd::String_type dd_partitions_name("mysql/table_partitions")
dd_tablespace_get_filename
const UNIV_INLINE char * dd_tablespace_get_filename(const dd::Tablespace *dd_space)
Get the file name of a tablespace.
Definition: dict0dd.h:1043
DD_instant_col_val_coder::cleanup
void cleanup()
Clean-up last result.
Definition: dict0dd.h:339
HttpMethod::type
int type
Definition: http_common.h:411
dd_process_dd_tables_rec_and_mtr_commit
const char * dd_process_dd_tables_rec_and_mtr_commit(mem_heap_t *heap, const rec_t *rec, dict_table_t **table, dict_table_t *dd_tables, MDL_ticket **mdl, mtr_t *mtr)
Process one mysql.tables record and get the dict_table_t.
Definition: dict0dd.cc:4454
DD_TABLE_DISCARD
@ DD_TABLE_DISCARD
Discard flag.
Definition: dict0dd.h:88
dd::Partition::se_private_data
virtual const Properties & se_private_data() const =0
dd::Entity_object::id
virtual Object_id id() const =0
The unique dictionary object id.
dd_space_keys
dd_space_keys
InnoDB private keys for dd::Tablespace.
Definition: dict0dd.h:137
dd_mdl_for_undo
bool dd_mdl_for_undo(const trx_t *trx)
Check if current undo needs a MDL or not.
Definition: dict0dd.cc:248
dd_copy_autoinc
void dd_copy_autoinc(const dd::Properties &src, dd::Properties &dest)
Copy the AUTO_INCREMENT and version attribute if exist.
Definition: dict0dd.cc:1433
dd_copy_table_columns
void dd_copy_table_columns(dd::Table &new_table, const dd::Table &old_table)
Copy the engine-private parts of column definitions of a table.
Definition: dict0dd.cc:1545
dd::Index
Definition: index.h:49
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
dd_get_and_save_data_dir_path
void dd_get_and_save_data_dir_path(dict_table_t *table, const Table *dd_table, bool dict_mutex_own)
Make sure the data_dir_path is saved in dict_table_t if DATA DIRECTORY was used.
Definition: dict0dd.cc:3680
index.h
dict_col_t
Data structure for a column in a table.
Definition: dict0mem.h:455
space_id_t
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
dd_process_dd_columns_rec
bool dd_process_dd_columns_rec(mem_heap_t *heap, const rec_t *rec, dict_col_t *col, table_id_t *table_id, char **col_name, ulint *nth_v_col, const dict_table_t *dd_columns, mtr_t *mtr)
Process one mysql.columns record and get info to dict_col_t.
Definition: dict0dd.cc:4598
dd_get_referenced_table
char * dd_get_referenced_table(const char *name, const char *database_name, ulint database_name_len, const char *table_name, ulint table_name_len, dict_table_t **table, MDL_ticket **mdl, mem_heap_t *heap)
Open a table from its database and table name, this is currently used by foreign constraint parser to...
Definition: dict0dd.cc:5944
dict_names_t
std::deque< const char *, ut_allocator< const char * > > dict_names_t
A stack of table names related through foreign key constraints.
Definition: dict0load.h:49
SPACE_UNKNOWN
constexpr space_id_t SPACE_UNKNOWN
Unknown space id.
Definition: fil0fil.h:890
dd_process_dd_tablespaces_rec
bool dd_process_dd_tablespaces_rec(mem_heap_t *heap, const rec_t *rec, space_id_t *space_id, char **name, uint32_t *flags, uint32 *server_version, uint32 *space_version, bool *is_encrypted, dd::String_type *state, dict_table_t *dd_spaces)
Process one mysql.tablespaces record and get info.
Definition: dict0dd.cc:5106
DD_SPACE_VERSION
@ DD_SPACE_VERSION
TABLESPACE_VERSION.
Definition: dict0dd.h:147
dd::Partition::table
virtual const Table & table() const =0
dd::Collection::size
size_t size() const
Definition: collection.h:220
dd_mdl_release
void dd_mdl_release(THD *thd, MDL_ticket **mdl)
Release a metadata lock.
Definition: dict0dd.cc:232
dd_add_fts_doc_id_index
void dd_add_fts_doc_id_index(dd::Table &new_table, const dd::Table &old_table)
Add fts doc id column and index to new table when old table has hidden fts doc id without fulltext in...
Definition: dict0dd.cc:2124
dd_partition_keys
dd_partition_keys
InnoDB private keys for dd::Partition.
Definition: dict0dd.h:123
DD_TABLE__LAST
@ DD_TABLE__LAST
Sentinel.
Definition: dict0dd.h:92
udf_ext::consts::charset
const std::string charset("charset")
DD_PARTITION_ROW_FORMAT
@ DD_PARTITION_ROW_FORMAT
Row format for this partition.
Definition: dict0dd.h:125
DD_SPACE_STATE_EMPTY
@ DD_SPACE_STATE_EMPTY
Inactive undo tablespace being truncated, selected explicitly by ALTER UNDO TABLESPACE SET INACTIVE.
Definition: dict0dd.h:171
properties.h
dd_tablespace_get_discard
bool dd_tablespace_get_discard(const dd::Tablespace *dd_space)
Get discard attribute value stored in se_private_dat of tablespace.
dd::Partition
Definition: partition.h:50
DD_SPACE_STATE_DISCARDED
@ DD_SPACE_STATE_DISCARDED
Discarded IBD tablespace.
Definition: dict0dd.h:159
dd_table_open_on_name_in_mem
UNIV_INLINE dict_table_t * dd_table_open_on_name_in_mem(const char *name, ibool dict_locked)
Returns a cached table object based on table name.
DD_instant_col_val_coder::~DD_instant_col_val_coder
~DD_instant_col_val_coder()
Destructor.
Definition: dict0dd.h:319
MDL_ticket
A granted metadata lock.
Definition: mdl.h:963
p
const char * p
Definition: ctype-mb.cc:1233
DD_SPACE_CURRENT_SRV_VERSION
const uint32 DD_SPACE_CURRENT_SRV_VERSION
Server version that the tablespace created.
Definition: dict0dd.h:116
dd_table_key_strings
const char *const dd_table_key_strings[DD_TABLE__LAST]
InnoDB private key strings for dd::Table.
Definition: dict0dd.h:198
dict0dict.h
dd_get_meta_data_filename
void dd_get_meta_data_filename(dict_table_t *table, dd::Table *dd_table, char *filename, ulint max_len)
Get the meta-data filename from the table name for a single-table tablespace.
Definition: dict0dd.cc:3732
foreign_key.h
dd_partition_key_strings
const char *const dd_partition_key_strings[DD_PARTITION__LAST]
InnoDB private key strings for dd::Partition.
Definition: dict0dd.h:206
innodb_dd_table_t::n_indexes
const uint n_indexes
Number of indexes.
Definition: dict0dd.h:253
index
char * index(const char *, int c)
Definition: mysql.cc:2875
partition_index.h
trx_t
Definition: trx0trx.h:780
DD_instant_col_val_coder::m_result
byte * m_result
The encoded or decoded stream.
Definition: dict0dd.h:343
dd_write_default_value
void dd_write_default_value(const dict_col_t *col, dd::Column *dd_col)
Write default value of a column to dd::Column.
Definition: dict0dd.cc:1833
dd_get_version
uint64_t dd_get_version(const dd::Table *dd_table)
Get the version attribute.
dd_table_part_has_instant_cols
bool dd_table_part_has_instant_cols(const dd::Table &table)
Determine if any partition of the table still has instant columns.
Definition: dict0dd.h:400
flags
static int flags[50]
Definition: hp_test1.cc:39
filename
const char * filename
Definition: pfs_example_component_population.cc:64
dd_space_state_values
const char *const dd_space_state_values[DD_SPACE_STATE__LAST+1]
InnoDB private value strings for key string "state" in dd::Tablespace.
Definition: dict0dd.h:187
DD_PARTITION_INSTANT_COLS
@ DD_PARTITION_INSTANT_COLS
Columns before first instant ADD COLUMN.
Definition: dict0dd.h:131