MySQL 8.3.0
Source Code Documentation
TABLE_SHARE Struct Reference

This structure is shared between different table objects. More...

#include <table.h>

Public Types

enum class  Schema_read_only { NOT_SET , RO_OFF , RO_ON }
 Schema's read only mode - ON (true) or OFF (false). More...
 

Public Member Functions

 TABLE_SHARE ()=default
 
 TABLE_SHARE (unsigned long version, bool secondary)
 Create a new TABLE_SHARE with the given version number. More...
 
handlertondb_type () const
 
void set_table_cache_key (char *key_buff, size_t key_length)
 Set share's table cache key and update its db and table name appropriately. More...
 
void set_table_cache_key (char *key_buff, const char *key, size_t key_length)
 Set share's table cache key and update its db and table name appropriately. More...
 
ulonglong get_table_def_version () const
 
unsigned long version () const
 Returns the version of this TABLE_SHARE. More...
 
void clear_version ()
 Set the version of this TABLE_SHARE to zero. More...
 
bool has_old_version () const
 Is this table share being expelled from the table definition cache?
More...
 
enum enum_table_ref_type get_table_ref_type () const
 Convert unrelated members of TABLE_SHARE to one enum representing its type. More...
 
ulonglong get_table_ref_version () const
 Return a table metadata version. More...
 
bool is_missing_primary_key () const
 Determine if the table is missing a PRIMARY KEY. More...
 
uint find_first_unused_tmp_key (const Key_map &k)
 For a materialized derived table: informs the share that certain not-yet-used keys are going to be used. More...
 
bool visit_subgraph (Wait_for_flush *waiting_ticket, MDL_wait_for_graph_visitor *gvisitor)
 Traverse portion of wait-for graph which is reachable through this table share in search for deadlocks. More...
 
bool wait_for_old_version (THD *thd, struct timespec *abstime, uint deadlock_weight)
 Wait until the subject share is removed from the table definition cache and make sure it's destroyed. More...
 
Key_map usable_indexes (const THD *thd) const
 The set of indexes that the optimizer may use when creating an execution plan. More...
 
void destroy ()
 Release resources and free memory occupied by the table share. More...
 
unsigned int ref_count () const
 How many TABLE objects use this TABLE_SHARE. More...
 
unsigned int increment_ref_count ()
 Increment the reference count by one. More...
 
unsigned int decrement_ref_count ()
 Decrement the reference count by one. More...
 
bool is_primary_engine () const
 Does this TABLE_SHARE represent a table in a primary storage engine? More...
 
bool is_secondary_engine () const
 Does this TABLE_SHARE represent a table in a secondary storage engine? More...
 
bool has_secondary_engine () const
 Does this TABLE_SHARE represent a primary table that has a shadow copy in a secondary storage engine? More...
 
bool is_referenced_by_foreign_key () const
 Returns whether this table is referenced by a foreign key. More...
 

Public Attributes

Table_histograms_collectionm_histograms {nullptr}
 
TABLE_CATEGORY table_category {TABLE_UNKNOWN_CATEGORY}
 Category of this table. More...
 
MEM_ROOT mem_root
 
MEM_ROOTalloc_for_tmp_file_handler {nullptr}
 Used to allocate new handler for internal temporary table when the size limitation of the primary storage engine is exceeded. More...
 
TYPELIB keynames
 
TYPELIBintervals {nullptr}
 
mysql_mutex_t LOCK_ha_data
 
TABLE_SHAREnext {nullptr}
 
TABLE_SHARE ** prev {nullptr}
 
Table_cache_element ** cache_element {nullptr}
 Array of table_cache_instances pointers to elements of table caches respresenting this table in each of Table_cache instances. More...
 
Field ** field {nullptr}
 
Field ** found_next_number_field {nullptr}
 
KEYkey_info {nullptr}
 
uint * blob_field {nullptr}
 
uchardefault_values {nullptr}
 
LEX_STRING comment {nullptr, 0}
 
LEX_STRING compress {nullptr, 0}
 
LEX_STRING encrypt_type {nullptr, 0}
 
LEX_CSTRING secondary_engine {nullptr, 0}
 Secondary storage engine. More...
 
bool secondary_load {false}
 Secondary engine load status. More...
 
const CHARSET_INFOtable_charset
 
MY_BITMAP all_set
 
LEX_CSTRING table_cache_key {nullptr, 0}
 
LEX_CSTRING db {nullptr, 0}
 
LEX_CSTRING table_name {nullptr, 0}
 
LEX_STRING path {nullptr, 0}
 
LEX_CSTRING normalized_path {nullptr, 0}
 
LEX_STRING connect_string {nullptr, 0}
 
LEX_CSTRING engine_attribute = EMPTY_CSTR
 
LEX_CSTRING secondary_engine_attribute = EMPTY_CSTR
 
Key_map keys_in_use
 The set of indexes that are not disabled for this table. More...
 
Key_map visible_indexes
 The set of visible and enabled indexes for this table. More...
 
Key_map keys_for_keyread
 
ha_rows min_rows {0}
 
ha_rows max_rows {0}
 
ulong avg_row_length {0}
 
ulong mysql_version {0}
 
ulong reclength {0}
 
ulong stored_rec_length {0}
 
ulonglong autoextend_size {0}
 
plugin_ref db_plugin {nullptr}
 
enum row_type row_type = {}
 Value of ROW_FORMAT option for the table as provided by user. More...
 
enum row_type real_row_type = {}
 Real row format used for the table by the storage engine. More...
 
tmp_table_type tmp_table {NO_TMP_TABLE}
 
uint tmp_handler_count {0}
 Only for internal temporary tables. More...
 
uint tmp_open_count {0}
 Only for internal temporary tables. More...
 
std::uint32_t key_block_size {0}
 
uint stats_sample_pages {0}
 
enum_stats_auto_recalc stats_auto_recalc {}
 
uint null_bytes {0}
 
uint last_null_bit_pos {0}
 
uint fields {0}
 
uint rec_buff_length {0}
 
uint keys {0}
 
uint key_parts {0}
 
uint max_key_length {0}
 
uint max_unique_length {0}
 
uint total_key_length {0}
 
bool is_distinct {false}
 Whether this is a temporary table that already has a UNIQUE index (removing duplicate rows on insert), so that the optimizer does not need to run DISTINCT itself. More...
 
uint null_fields {0}
 
uint blob_fields {0}
 
uint varchar_fields {0}
 
uint first_unused_tmp_key {0}
 For materialized derived tables;. More...
 
uint max_tmp_keys {0}
 For materialized derived tables: allocated size of key_info array. More...
 
uint max_tmp_key_parts {0}
 For materialized derived tables: allocated size of base_key_parts array of all TABLE objects. More...
 
Key_namekey_names {nullptr}
 Array of names for generated keys, used for materialized derived tables. More...
 
ulong * base_rec_per_key {nullptr}
 Records per key array, used for materialized derived tables. More...
 
rec_per_key_tbase_rec_per_key_float {nullptr}
 Records per key array, float rep., used for materialized derived tables. More...
 
uint db_create_options {0}
 Bitmap with flags representing some of table options/attributes. More...
 
uint db_options_in_use {0}
 Bitmap with flags representing some of table options/attributes which are in use by storage engine. More...
 
uint rowid_field_offset {0}
 
uint primary_key {0}
 
uint next_number_index {0}
 
uint next_number_key_offset {0}
 
uint next_number_keypart {0}
 
bool error {false}
 
uint column_bitmap_size {0}
 
uint vfields {0}
 Number of generated fields. More...
 
uint gen_def_field_count {0}
 Number of fields having the default value generated. More...
 
bool system {false}
 
bool db_low_byte_first {false}
 
bool crashed {false}
 
bool is_view {false}
 
bool m_open_in_progress {false}
 
mysql::binlog::event::Table_id table_map_id
 
int cached_row_logging_check {0}
 
ha_storage_media default_storage_media {HA_SM_DEFAULT}
 
const char * tablespace {nullptr}
 
partition_infom_part_info {nullptr}
 Partition meta data. More...
 
bool auto_partitioned {false}
 Filled in when reading from frm. More...
 
char * partition_info_str {nullptr}
 Storing the full partitioning clause (PARTITION BY ...) which is used when creating new partition_info object for each new TABLE object by parsing this string. More...
 
uint partition_info_str_len {0}
 
const TABLE_FIELD_DEFtable_field_def_cache {nullptr}
 Cache the checked structure of this table. More...
 
Handler_shareha_share {nullptr}
 Main handler's share. More...
 
PSI_table_sharem_psi {nullptr}
 Instrumentation for this table share. More...
 
Wait_for_flush_list m_flush_tickets
 List of tickets representing threads waiting for the share to be flushed. More...
 
const dd::Viewview_object {nullptr}
 View object holding view definition read from DD. More...
 
dd::Tabletmp_table_def {nullptr}
 Data-dictionary object describing explicit temporary table represented by this share. More...
 
Query_blockowner_of_possible_tmp_keys {nullptr}
 For materialized derived tables;. More...
 
uint foreign_keys {0}
 Arrays with descriptions of foreign keys in which this table participates as child or parent. More...
 
TABLE_SHARE_FOREIGN_KEY_INFOforeign_key {nullptr}
 
uint foreign_key_parents {0}
 
TABLE_SHARE_FOREIGN_KEY_PARENT_INFOforeign_key_parent {nullptr}
 
Sql_check_constraint_share_listcheck_constraint_share_list {nullptr}
 
Schema_read_only schema_read_only {Schema_read_only::NOT_SET}
 

Protected Attributes

bool m_secondary_engine {false}
 Does this TABLE_SHARE represent a table in a secondary storage engine? More...
 

Private Attributes

unsigned int m_ref_count {0}
 How many TABLE objects use this TABLE_SHARE. More...
 
unsigned long m_version {0}
 TABLE_SHARE version, if changed the TABLE_SHARE must be reopened. More...
 

Detailed Description

This structure is shared between different table objects.

There is one instance of table share per one table in the database.

Member Enumeration Documentation

◆ Schema_read_only

enum class TABLE_SHARE::Schema_read_only
strong

Schema's read only mode - ON (true) or OFF (false).

This is filled in when the share is initialized with meta data from DD. If the schema is altered, the tables and share are removed. This can be done since ALTER SCHEMA acquires exclusive meta data locks on the tables in the schema. We set this only for non-temporary tables. Otherwise, the value of the member below is 'NOT_SET'.

Enumerator
NOT_SET 
RO_OFF 
RO_ON 

Constructor & Destructor Documentation

◆ TABLE_SHARE() [1/2]

TABLE_SHARE::TABLE_SHARE ( )
default

◆ TABLE_SHARE() [2/2]

TABLE_SHARE::TABLE_SHARE ( unsigned long  version,
bool  secondary 
)
inline

Create a new TABLE_SHARE with the given version number.

Parameters
versionthe version of the TABLE_SHARE
secondaryset to true if the TABLE_SHARE represents a table in a secondary storage engine

Member Function Documentation

◆ clear_version()

void TABLE_SHARE::clear_version ( )

Set the version of this TABLE_SHARE to zero.

This marks the TABLE_SHARE for automatic removal from the table definition cache once it is no longer referenced.

◆ db_type()

handlerton * TABLE_SHARE::db_type ( ) const
inline

◆ decrement_ref_count()

unsigned int TABLE_SHARE::decrement_ref_count ( )
inline

Decrement the reference count by one.

Returns
the new reference count

◆ destroy()

void TABLE_SHARE::destroy ( )

Release resources and free memory occupied by the table share.

Release resources (plugins) used by the share and free its memory.

TABLE_SHARE is self-contained – it's stored in its own MEM_ROOT. Free this MEM_ROOT.

◆ find_first_unused_tmp_key()

uint TABLE_SHARE::find_first_unused_tmp_key ( const Key_map k)

For a materialized derived table: informs the share that certain not-yet-used keys are going to be used.

Parameters
kUsed keys
Returns
New position of first not-yet-used key.

◆ get_table_def_version()

ulonglong TABLE_SHARE::get_table_def_version ( ) const
inline

◆ get_table_ref_type()

enum enum_table_ref_type TABLE_SHARE::get_table_ref_type ( ) const
inline

Convert unrelated members of TABLE_SHARE to one enum representing its type.

◆ get_table_ref_version()

ulonglong TABLE_SHARE::get_table_ref_version ( ) const

Return a table metadata version.

for base tables and views, we return table_map_id. It is assigned from a global counter incremented for each new table loaded into the table definition cache (TDC). for temporary tables it's table_map_id again. But for temporary tables table_map_id is assigned from thd->query_id. The latter is assigned from a thread local counter incremented for every new SQL statement. Since temporary tables are thread-local, each temporary table gets a unique id. for everything else (e.g. information schema tables), the version id is zero.

This choice of version id is a large compromise to have a working prepared statement validation in 5.1. In future version ids will be persistent, as described in WL#4180.

Let's try to explain why and how this limited solution allows to validate prepared statements.

Firstly, sets (in mathematical sense) of version numbers never intersect for different table types. Therefore, version id of a temporary table is never compared with a version id of a view, and vice versa.

Secondly, for base tables and views, we know that each DDL flushes the respective share from the TDC. This ensures that whenever a table is altered or dropped and recreated, it gets a new version id. Unfortunately, since elements of the TDC are also flushed on LRU basis, this choice of version ids leads to false positives. E.g. when the TDC size is too small, we may have a SELECT FROM INFORMATION_SCHEMA.TABLES flush all its elements, which in turn will lead to a validation error and a subsequent reprepare of all prepared statements. This is considered acceptable, since as long as prepared statements are automatically reprepared, spurious invalidation is only a performance hit. Besides, no better simple solution exists.

For temporary tables, using thd->query_id ensures that if a temporary table was altered or recreated, a new version id is assigned. This suits validation needs very well and will perhaps never change.

Metadata of information schema tables never changes. Thus we can safely assume 0 for a good enough version id.

Finally, by taking into account table type, we always track that a change has taken place when a view is replaced with a base table, a base table is replaced with a temporary table and so on.

Return values
0For schema tables, DD tables and system views. non-0 For bases tables, views and temporary tables.
See also
Table_ref::is_table_ref_id_equal()

◆ has_old_version()

bool TABLE_SHARE::has_old_version ( ) const
inline

Is this table share being expelled from the table definition cache?

◆ has_secondary_engine()

bool TABLE_SHARE::has_secondary_engine ( ) const
inline

Does this TABLE_SHARE represent a primary table that has a shadow copy in a secondary storage engine?

◆ increment_ref_count()

unsigned int TABLE_SHARE::increment_ref_count ( )
inline

Increment the reference count by one.

Returns
the new reference count

◆ is_missing_primary_key()

bool TABLE_SHARE::is_missing_primary_key ( ) const
inline

Determine if the table is missing a PRIMARY KEY.

◆ is_primary_engine()

bool TABLE_SHARE::is_primary_engine ( ) const
inline

Does this TABLE_SHARE represent a table in a primary storage engine?

◆ is_referenced_by_foreign_key()

bool TABLE_SHARE::is_referenced_by_foreign_key ( ) const
inline

Returns whether this table is referenced by a foreign key.

◆ is_secondary_engine()

bool TABLE_SHARE::is_secondary_engine ( ) const
inline

Does this TABLE_SHARE represent a table in a secondary storage engine?

◆ ref_count()

unsigned int TABLE_SHARE::ref_count ( ) const
inline

How many TABLE objects use this TABLE_SHARE.

Returns
the reference count

◆ set_table_cache_key() [1/2]

void TABLE_SHARE::set_table_cache_key ( char *  key_buff,
const char *  key,
size_t  key_length 
)
inline

Set share's table cache key and update its db and table name appropriately.

Parameters
key_buffBuffer to be used as storage for table cache key (should be at least key_length bytes).
keyValue for table cache key.
key_lengthKey length.

NOTE Since 'key_buff' buffer will be used as storage for table cache key it should has same life-time as share itself.

◆ set_table_cache_key() [2/2]

void TABLE_SHARE::set_table_cache_key ( char *  key_buff,
size_t  key_length 
)
inline

Set share's table cache key and update its db and table name appropriately.

Parameters
key_buffBuffer with already built table cache key to be referenced from share.
key_lengthKey length.
Note
Since 'key_buff' buffer will be referenced from share it should has same life-time as share itself. This method automatically ensures that TABLE_SHARE::table_name/db have appropriate values by using table cache key as their source.

◆ usable_indexes()

Key_map TABLE_SHARE::usable_indexes ( const THD thd) const

The set of indexes that the optimizer may use when creating an execution plan.

◆ version()

unsigned long TABLE_SHARE::version ( ) const
inline

Returns the version of this TABLE_SHARE.

◆ visit_subgraph()

bool TABLE_SHARE::visit_subgraph ( Wait_for_flush wait_for_flush,
MDL_wait_for_graph_visitor gvisitor 
)

Traverse portion of wait-for graph which is reachable through this table share in search for deadlocks.

Parameters
wait_for_flushUndocumented.
gvisitorDeadlock detection visitor.
Return values
trueA deadlock is found. A victim is remembered by the visitor.
falseNo deadlocks, it's OK to begin wait.

◆ wait_for_old_version()

bool TABLE_SHARE::wait_for_old_version ( THD thd,
struct timespec *  abstime,
uint  deadlock_weight 
)

Wait until the subject share is removed from the table definition cache and make sure it's destroyed.

Note
This method may access the share concurrently with another thread if the share is in the process of being opened, i.e., that m_open_in_progress is true. In this case, close_cached_tables() may iterate over elements in the table definition cache, and call this method regardless of the share being opened or not. This works anyway since a new flush ticket is added below, and LOCK_open ensures that the share may not be destroyed by another thread in the time between finding this share (having an old version) and adding the flush ticket. Thus, after this thread has added the flush ticket, the thread opening the table will eventually call free_table_share (as a result of releasing the share after using it, or as a result of a failing open_table_def()), which will notify the owners of the flush tickets, and the last one being notified will actually destroy the share.
Parameters
thdSession.
abstimeTimeout for waiting as absolute time value.
deadlock_weightWeight of this wait for deadlock detector.
Precondition
LOCK_open is write locked, the share is used (has non-zero reference count), is marked for flush and this connection does not reference the share. LOCK_open will be unlocked temporarily during execution.
Return values
false- Success.
true- Error (OOM, deadlock, timeout, etc...).

Member Data Documentation

◆ all_set

MY_BITMAP TABLE_SHARE::all_set

◆ alloc_for_tmp_file_handler

MEM_ROOT* TABLE_SHARE::alloc_for_tmp_file_handler {nullptr}

Used to allocate new handler for internal temporary table when the size limitation of the primary storage engine is exceeded.

◆ auto_partitioned

bool TABLE_SHARE::auto_partitioned {false}

Filled in when reading from frm.

This can simply be removed when removing the .frm support, since it is already stored in the new DD.

◆ autoextend_size

ulonglong TABLE_SHARE::autoextend_size {0}

◆ avg_row_length

ulong TABLE_SHARE::avg_row_length {0}

◆ base_rec_per_key

ulong* TABLE_SHARE::base_rec_per_key {nullptr}

Records per key array, used for materialized derived tables.

This is a contiguous array, with size given by max_tmp_key_parts. The array is shared with all TABLE objects referring to this table share.

◆ base_rec_per_key_float

rec_per_key_t* TABLE_SHARE::base_rec_per_key_float {nullptr}

Records per key array, float rep., used for materialized derived tables.

This is a contiguous array, with size given by max_tmp_key_parts. The array is shared with all TABLE objects referring to this table share.

◆ blob_field

uint* TABLE_SHARE::blob_field {nullptr}

◆ blob_fields

uint TABLE_SHARE::blob_fields {0}

◆ cache_element

Table_cache_element** TABLE_SHARE::cache_element {nullptr}

Array of table_cache_instances pointers to elements of table caches respresenting this table in each of Table_cache instances.

Allocated along with the share itself in alloc_table_share(). Each element of the array is protected by Table_cache::m_lock in the corresponding Table_cache. False sharing should not be a problem in this case as elements of this array are supposed to be updated rarely.

◆ cached_row_logging_check

int TABLE_SHARE::cached_row_logging_check {0}

◆ check_constraint_share_list

Sql_check_constraint_share_list* TABLE_SHARE::check_constraint_share_list {nullptr}

◆ column_bitmap_size

uint TABLE_SHARE::column_bitmap_size {0}

◆ comment

LEX_STRING TABLE_SHARE::comment {nullptr, 0}

◆ compress

LEX_STRING TABLE_SHARE::compress {nullptr, 0}

◆ connect_string

LEX_STRING TABLE_SHARE::connect_string {nullptr, 0}

◆ crashed

bool TABLE_SHARE::crashed {false}

◆ db

LEX_CSTRING TABLE_SHARE::db {nullptr, 0}

◆ db_create_options

uint TABLE_SHARE::db_create_options {0}

Bitmap with flags representing some of table options/attributes.

See also
HA_OPTION_PACK_RECORD, HA_OPTION_PACK_KEYS, ...
Note
This is basically copy of HA_CREATE_INFO::table_options bitmap at the time of table opening/usage.

◆ db_low_byte_first

bool TABLE_SHARE::db_low_byte_first {false}

◆ db_options_in_use

uint TABLE_SHARE::db_options_in_use {0}

Bitmap with flags representing some of table options/attributes which are in use by storage engine.

Note
db_options_in_use is normally copy of db_create_options but can be overridden by SE. E.g. MyISAM does this at handler::open() and handler::info() time.

◆ db_plugin

plugin_ref TABLE_SHARE::db_plugin {nullptr}

◆ default_storage_media

ha_storage_media TABLE_SHARE::default_storage_media {HA_SM_DEFAULT}

◆ default_values

uchar* TABLE_SHARE::default_values {nullptr}

◆ encrypt_type

LEX_STRING TABLE_SHARE::encrypt_type {nullptr, 0}

◆ engine_attribute

LEX_CSTRING TABLE_SHARE::engine_attribute = EMPTY_CSTR

◆ error

bool TABLE_SHARE::error {false}

◆ field

Field** TABLE_SHARE::field {nullptr}

◆ fields

uint TABLE_SHARE::fields {0}

◆ first_unused_tmp_key

uint TABLE_SHARE::first_unused_tmp_key {0}

For materialized derived tables;.

See also
add_derived_key(). 'first' means: having the lowest position in key_info.

◆ foreign_key

TABLE_SHARE_FOREIGN_KEY_INFO* TABLE_SHARE::foreign_key {nullptr}

◆ foreign_key_parent

TABLE_SHARE_FOREIGN_KEY_PARENT_INFO* TABLE_SHARE::foreign_key_parent {nullptr}

◆ foreign_key_parents

uint TABLE_SHARE::foreign_key_parents {0}

◆ foreign_keys

uint TABLE_SHARE::foreign_keys {0}

Arrays with descriptions of foreign keys in which this table participates as child or parent.

We only cache in them information from dd::Table object which is sufficient for use by prelocking algorithm/to check if table is referenced by a foreign key.

◆ found_next_number_field

Field** TABLE_SHARE::found_next_number_field {nullptr}

◆ gen_def_field_count

uint TABLE_SHARE::gen_def_field_count {0}

Number of fields having the default value generated.

◆ ha_share

Handler_share* TABLE_SHARE::ha_share {nullptr}

Main handler's share.

◆ intervals

TYPELIB* TABLE_SHARE::intervals {nullptr}

◆ is_distinct

bool TABLE_SHARE::is_distinct {false}

Whether this is a temporary table that already has a UNIQUE index (removing duplicate rows on insert), so that the optimizer does not need to run DISTINCT itself.

Also used for INTERSECT and EXCEPT as a fall-back if hashing fails (secondary overflow of in-memory hash table, in which case we revert to de-duplication using the unique key in the output table).

◆ is_view

bool TABLE_SHARE::is_view {false}

◆ key_block_size

std::uint32_t TABLE_SHARE::key_block_size {0}

◆ key_info

KEY* TABLE_SHARE::key_info {nullptr}

◆ key_names

Key_name* TABLE_SHARE::key_names {nullptr}

Array of names for generated keys, used for materialized derived tables.

Shared among all TABLE objects referring to this table share.

◆ key_parts

uint TABLE_SHARE::key_parts {0}

◆ keynames

TYPELIB TABLE_SHARE::keynames

◆ keys

uint TABLE_SHARE::keys {0}

◆ keys_for_keyread

Key_map TABLE_SHARE::keys_for_keyread

◆ keys_in_use

Key_map TABLE_SHARE::keys_in_use

The set of indexes that are not disabled for this table.

I.e. it excludes indexes disabled by ALTER TABLE ... DISABLE KEYS, however it does include invisible indexes. The data dictionary populates this bitmap.

◆ last_null_bit_pos

uint TABLE_SHARE::last_null_bit_pos {0}

◆ LOCK_ha_data

mysql_mutex_t TABLE_SHARE::LOCK_ha_data

◆ m_flush_tickets

Wait_for_flush_list TABLE_SHARE::m_flush_tickets

List of tickets representing threads waiting for the share to be flushed.

◆ m_histograms

Table_histograms_collection* TABLE_SHARE::m_histograms {nullptr}

◆ m_open_in_progress

bool TABLE_SHARE::m_open_in_progress {false}

◆ m_part_info

partition_info* TABLE_SHARE::m_part_info {nullptr}

Partition meta data.

Allocated from TABLE_SHARE::mem_root, created when reading from the dd tables, used as template for each TABLE instance. The reason for having it on the TABLE_SHARE is to be able to reuse the partition_elements containing partition names, values etc. instead of allocating them for each TABLE instance. TODO: Currently it is filled in and then only used for generating the partition_info_str. The plan is to clone/copy/reference each TABLE::part_info instance from it. What is missing before it can be completed: 1) The partition expression, currently created only during parsing which also needs the current TABLE instance as context for name resolution etc. 2) The partition values, currently the DD stores them as text so it needs to be converted to field images (which is now done by first parsing the value text into an Item, then saving the Item result/value into a field and then finally copy the field image).

◆ m_psi

PSI_table_share* TABLE_SHARE::m_psi {nullptr}

Instrumentation for this table share.

◆ m_ref_count

unsigned int TABLE_SHARE::m_ref_count {0}
private

How many TABLE objects use this TABLE_SHARE.

◆ m_secondary_engine

bool TABLE_SHARE::m_secondary_engine {false}
protected

Does this TABLE_SHARE represent a table in a secondary storage engine?

◆ m_version

unsigned long TABLE_SHARE::m_version {0}
private

TABLE_SHARE version, if changed the TABLE_SHARE must be reopened.

NOTE: The TABLE_SHARE will not be reopened during LOCK TABLES in close_thread_tables!!!

◆ max_key_length

uint TABLE_SHARE::max_key_length {0}

◆ max_rows

ha_rows TABLE_SHARE::max_rows {0}

◆ max_tmp_key_parts

uint TABLE_SHARE::max_tmp_key_parts {0}

For materialized derived tables: allocated size of base_key_parts array of all TABLE objects.

Used for generated keys.

◆ max_tmp_keys

uint TABLE_SHARE::max_tmp_keys {0}

For materialized derived tables: allocated size of key_info array.

◆ max_unique_length

uint TABLE_SHARE::max_unique_length {0}

◆ mem_root

MEM_ROOT TABLE_SHARE::mem_root

◆ min_rows

ha_rows TABLE_SHARE::min_rows {0}

◆ mysql_version

ulong TABLE_SHARE::mysql_version {0}

◆ next

TABLE_SHARE* TABLE_SHARE::next {nullptr}

◆ next_number_index

uint TABLE_SHARE::next_number_index {0}

◆ next_number_key_offset

uint TABLE_SHARE::next_number_key_offset {0}

◆ next_number_keypart

uint TABLE_SHARE::next_number_keypart {0}

◆ normalized_path

LEX_CSTRING TABLE_SHARE::normalized_path {nullptr, 0}

◆ null_bytes

uint TABLE_SHARE::null_bytes {0}

◆ null_fields

uint TABLE_SHARE::null_fields {0}

◆ owner_of_possible_tmp_keys

Query_block* TABLE_SHARE::owner_of_possible_tmp_keys {nullptr}

For materialized derived tables;.

See also
add_derived_key().

◆ partition_info_str

char* TABLE_SHARE::partition_info_str {nullptr}

Storing the full partitioning clause (PARTITION BY ...) which is used when creating new partition_info object for each new TABLE object by parsing this string.

These two will be needed until the missing parts above is fixed.

◆ partition_info_str_len

uint TABLE_SHARE::partition_info_str_len {0}

◆ path

LEX_STRING TABLE_SHARE::path {nullptr, 0}

◆ prev

TABLE_SHARE ** TABLE_SHARE::prev {nullptr}

◆ primary_key

uint TABLE_SHARE::primary_key {0}

◆ real_row_type

enum row_type TABLE_SHARE::real_row_type = {}

Real row format used for the table by the storage engine.

◆ rec_buff_length

uint TABLE_SHARE::rec_buff_length {0}

◆ reclength

ulong TABLE_SHARE::reclength {0}

◆ row_type

enum row_type TABLE_SHARE::row_type = {}

Value of ROW_FORMAT option for the table as provided by user.

Can be different from the real row format used by the storage engine. ROW_TYPE_DEFAULT value indicates that no explicit ROW_FORMAT was specified for the table.

See also
real_row_type.

◆ rowid_field_offset

uint TABLE_SHARE::rowid_field_offset {0}

◆ schema_read_only

Schema_read_only TABLE_SHARE::schema_read_only {Schema_read_only::NOT_SET}

◆ secondary_engine

LEX_CSTRING TABLE_SHARE::secondary_engine {nullptr, 0}

Secondary storage engine.

◆ secondary_engine_attribute

LEX_CSTRING TABLE_SHARE::secondary_engine_attribute = EMPTY_CSTR

◆ secondary_load

bool TABLE_SHARE::secondary_load {false}

Secondary engine load status.

◆ stats_auto_recalc

enum_stats_auto_recalc TABLE_SHARE::stats_auto_recalc {}

◆ stats_sample_pages

uint TABLE_SHARE::stats_sample_pages {0}

◆ stored_rec_length

ulong TABLE_SHARE::stored_rec_length {0}

◆ system

bool TABLE_SHARE::system {false}

◆ table_cache_key

LEX_CSTRING TABLE_SHARE::table_cache_key {nullptr, 0}

◆ table_category

TABLE_CATEGORY TABLE_SHARE::table_category {TABLE_UNKNOWN_CATEGORY}

Category of this table.

◆ table_charset

const CHARSET_INFO* TABLE_SHARE::table_charset
Initial value:
{
nullptr}

◆ table_field_def_cache

const TABLE_FIELD_DEF* TABLE_SHARE::table_field_def_cache {nullptr}

Cache the checked structure of this table.

The pointer data is used to describe the structure that a instance of the table must have. Each element of the array specifies a field that must exist on the table.

The pointer is cached in order to perform the check only once – when the table is loaded from the disk.

◆ table_map_id

mysql::binlog::event::Table_id TABLE_SHARE::table_map_id

◆ table_name

LEX_CSTRING TABLE_SHARE::table_name {nullptr, 0}

◆ tablespace

const char* TABLE_SHARE::tablespace {nullptr}

◆ tmp_handler_count

uint TABLE_SHARE::tmp_handler_count {0}

Only for internal temporary tables.

Count of TABLEs (having this TABLE_SHARE) which have a "handler" (table->file!=nullptr) which is open (ha_open() has been called).

◆ tmp_open_count

uint TABLE_SHARE::tmp_open_count {0}

Only for internal temporary tables.

Count of TABLEs (having this TABLE_SHARE) which have opened this table.

◆ tmp_table

tmp_table_type TABLE_SHARE::tmp_table {NO_TMP_TABLE}

◆ tmp_table_def

dd::Table* TABLE_SHARE::tmp_table_def {nullptr}

Data-dictionary object describing explicit temporary table represented by this share.

NULL for other table types (non-temporary tables, internal temporary tables). This object is owned by TABLE_SHARE and should be deleted along with it.

◆ total_key_length

uint TABLE_SHARE::total_key_length {0}

◆ varchar_fields

uint TABLE_SHARE::varchar_fields {0}

◆ vfields

uint TABLE_SHARE::vfields {0}

Number of generated fields.

◆ view_object

const dd::View* TABLE_SHARE::view_object {nullptr}

View object holding view definition read from DD.

This object is not cached, and is owned by the table share. We are not able to read it on demand since we may then get a cache miss while holding LOCK_OPEN.

◆ visible_indexes

Key_map TABLE_SHARE::visible_indexes

The set of visible and enabled indexes for this table.


The documentation for this struct was generated from the following files: