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