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