MySQL 9.1.0
Source Code Documentation
table_cache.h
Go to the documentation of this file.
1/* Copyright (c) 2012, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TABLE_CACHE_INCLUDED
25#define TABLE_CACHE_INCLUDED
26
27#include <assert.h>
28#include <stddef.h>
29#include <sys/types.h>
30
31#include <atomic>
32#include <memory>
33#include <string>
34#include <unordered_map>
35#include <utility>
36
37#include "lex_string.h"
38#include "my_base.h"
39
40#include "my_psi_config.h"
45#include "sql/handler.h"
46#include "sql/sql_base.h"
47#include "sql/sql_class.h"
48#include "sql/sql_plist.h"
50#include "sql/table.h"
52
54
58
59/**
60 Cache for open TABLE objects.
61
62 The idea behind this cache is that most statements don't need to
63 go to a central table definition cache to get a TABLE object and
64 therefore don't need to lock LOCK_open mutex.
65 Instead they only need to go to one Table_cache instance (the
66 specific instance is determined by thread id) and only lock the
67 mutex protecting this cache.
68 DDL statements that need to remove all TABLE objects from all caches
69 need to lock mutexes for all Table_cache instances, but they are rare.
70
71 This significantly increases scalability in some scenarios.
72*/
73
75 private:
76 /**
77 The table cache lock protects the following data:
78
79 1) m_unused_tables list.
80 2) m_cache hash.
81 3) used_tables, free_tables lists in Table_cache_element objects in
82 this cache.
83 4) m_table_count - total number of TABLE objects in this cache.
84 5) the element in TABLE_SHARE::cache_element[] array that corresponds
85 to this cache,
86 6) in_use member in TABLE object.
87 7) Also ownership of mutexes for all caches are required to update
88 the refresh_version and table_def_shutdown_in_progress variables
89 and TABLE_SHARE::version member.
90
91 The intention is that any query that finds a cached table object in
92 its designated table cache should only need to lock this mutex
93 instance and there should be no need to lock LOCK_open. LOCK_open is
94 still required however to create and release TABLE objects. However
95 most usage of the MySQL Server should be able to set the cache size
96 big enough so that the majority of the queries only need to lock this
97 mutex instance and not LOCK_open.
98 */
100
101 /**
102 The hash of Table_cache_element objects, each table/table share that
103 has any TABLE object in the Table_cache has a Table_cache_element from
104 which the list of free TABLE objects in this table cache AND the list
105 of used TABLE objects in this table cache is stored.
106 We use Table_cache_element::share::table_cache_key as key for this hash.
107 */
108 std::unordered_map<std::string, std::unique_ptr<Table_cache_element>> m_cache;
109
110 /**
111 List that contains all TABLE instances for tables in this particular
112 table cache that are in not use by any thread. Recently used TABLE
113 instances are appended to the end of the list. Thus the beginning of
114 the list contains which have been least recently used.
115 */
117
118 /**
119 Total number of TABLE instances for tables in this particular table
120 cache (both in use by threads and not in use).
121 This value summed over all table caches is accessible to users as
122 Open_tables status variable.
123 */
125
126 /**
127 LRU-organized list containing all TABLE instances with fully-loaded
128 triggers in this table cache which are not in use by any thread.
129 Tail is LRU TABLE.
130 */
136
137 /**
138 Total number of TABLE instances in this table cache with fully-loaded
139 triggers (both in use and unused).
140
141 @sa notify_triggers_load() for rationale behind use of atomic here.
142 */
143 std::atomic<uint> m_table_triggers_count;
144
145#ifdef HAVE_PSI_INTERFACE
148#endif
149
150 private:
151#ifdef EXTRA_DEBUG
152 void check_unused();
153#else
154 void check_unused() {}
155#endif
156 inline void link_unused_table(TABLE *table);
157 inline void unlink_unused_table(TABLE *table);
158
159 inline void free_unused_tables_if_necessary(THD *thd);
160
161 public:
162 bool init();
163 void destroy();
164 static void init_psi_keys();
165
166 /** Acquire lock on table cache instance. */
168 /** Release lock on table cache instance. */
170 /** Assert that caller owns lock on the table cache. */
172
173 inline TABLE *get_table(THD *thd, const char *key, size_t key_length,
174 bool is_update, TABLE_SHARE **share);
175
176 inline void release_table(THD *thd, TABLE *table);
177
178 inline bool add_used_table(THD *thd, TABLE *table);
179 inline void remove_table(TABLE *table);
180
181 /** Get number of TABLE instances in the cache. */
182 uint cached_tables() const { return m_table_count; }
183
185
186 /**
187 Notify the table cache that we have finalized loading and parsing
188 triggers for one of its TABLE objects.
189
190 @note We use atomic to make it MT-safe without introducing overhead
191 from lock()/unlock() pair.
192 */
194
196
197#ifndef NDEBUG
198 void print_tables();
199#endif
200};
201
202/**
203 Container class for all table cache instances in the system.
204*/
205
207 public:
208 /** Maximum supported number of table cache instances. */
209 static const int MAX_TABLE_CACHES = 64;
210
211 /** Default number of table cache instances */
212 static const int DEFAULT_MAX_TABLE_CACHES = 16;
213
214 bool init();
215 void destroy();
216
217 /** Get instance of table cache to be used by particular connection. */
220 }
221
222 /** Get index for the table cache in container. */
223 uint cache_index(Table_cache *cache) const {
224 return static_cast<uint>(cache - &m_table_cache[0]);
225 }
226
227 uint cached_tables();
228
229 void lock_all_and_tdc();
230 void unlock_all_and_tdc();
231 void assert_owner(THD *thd);
232 void assert_owner_all();
234
235 void free_table(THD *thd, enum_tdc_remove_table_type remove_type,
236 TABLE_SHARE *share);
237
239
240#ifndef NDEBUG
241 void print_tables();
242#endif
243
245
246 private:
247 /**
248 An array of Table_cache instances.
249 Only the first table_cache_instances elements in it are used.
250 */
252};
253
255
256/**
257 Element that represents the table in the specific table cache.
258 Plays for table cache instance role similar to role of TABLE_SHARE
259 for table definition cache.
260
261 It is an implementation detail of Table_cache and is present
262 in the header file only to allow inlining of some methods.
263*/
264
266 private:
267 /*
268 Doubly-linked (back-linked) lists of used and unused TABLE objects
269 for this table in this table cache (one such list per table cache).
270 */
271 typedef I_P_List<
274
276 /**
277 List of unused TABLE objects that do not have fully-loaded triggers;
278 either because there were no triggers, or because the triggers were
279 not previously loaded as they were not needed for read-only statements.
280 (This distinction is why our nomenclature is not just full <-> lazy.)
281 */
283 /** List of unused TABLE objects with fully-loaded triggers. */
286
287 public:
288 Table_cache_element(TABLE_SHARE *share_arg) : share(share_arg) {}
289
290 TABLE_SHARE *get_share() const { return share; }
291
292 friend class Table_cache;
295};
296
297/**
298 Iterator which allows to go through all used TABLE instances
299 for the table in all table caches.
300*/
301
306
307 inline void move_to_next_table();
308
309 public:
310 /**
311 Construct iterator over all used TABLE objects for the table share.
312
313 @note Assumes that caller owns locks on all table caches.
314 */
315 inline Table_cache_iterator(const TABLE_SHARE *share_arg);
316 inline TABLE *operator++(int);
317 inline void rewind();
318};
319
320/**
321 Add table to the tail of unused tables list for table cache
322 (i.e. as the most recently used table in this list).
323 If necessary, do the same thing for list of unused tables with
324 fully-loaded triggers.
325*/
326
328 if (m_unused_tables) {
329 table->next = m_unused_tables;
330 table->prev = m_unused_tables->prev;
332 table->prev->next = table;
333 } else
334 m_unused_tables = table->next = table->prev = table;
335 check_unused();
336
337 if (table->triggers && table->triggers->has_load_been_finalized())
338 m_unused_triggers_lru.push_back(table);
339}
340
341/**
342 Remove table from the unused tables list for the table cache.
343 If necessary, do the same thing for list of unused tables with
344 fully-loaded triggers for the table cache.
345*/
346
348 table->next->prev = table->prev;
349 table->prev->next = table->next;
350 if (table == m_unused_tables) {
352 if (table == m_unused_tables) m_unused_tables = nullptr;
353 }
354 check_unused();
355
356 if (table->triggers && table->triggers->has_load_been_finalized())
358}
359
360/**
361 Free unused TABLE instances if total number of TABLE objects
362 in table cache has exceeded table_cache_size_per_instance
363 limit.
364
365 @note That we might need to free more than one instance during
366 this call if table_cache_size was changed dynamically.
367*/
368
370 /*
371 We have too many TABLE instances around let us try to get rid of them.
372
373 Note that we might need to free more than one TABLE object, and thus
374 need the below loop, in case when table_cache_size is changed dynamically,
375 at server run time.
376
377 We also might need to get rid of TABLE instances with fully-loaded triggers
378 if there are too many of them. Unfortunately, there is no good way to
379 "unload" triggers, so we have to get rid of the whole TABLE object.
380 */
383 !m_unused_triggers_lru.is_empty())) {
386 TABLE *table_to_free = m_unused_tables;
387 remove_table(table_to_free);
388 intern_close_table(table_to_free);
392 }
394 !m_unused_triggers_lru.is_empty()) {
395 TABLE *table_to_free = m_unused_triggers_lru.front();
396 remove_table(table_to_free);
397 intern_close_table(table_to_free);
399 DBUG_PRINT("info", ("table_open_cache_triggers_overflows: %llu",
401 }
403 }
404}
405
406/**
407 Add newly created TABLE object which is going to be used right away
408 to the table cache.
409
410 @note Caller should own lock on the table cache.
411
412 @note Sets TABLE::in_use member as side effect.
413
414 @retval false - success.
415 @retval true - failure.
416*/
417
420
421 assert_owner();
422
423 assert(table->in_use == thd);
424
425 /*
426 Try to get Table_cache_element representing this table in the cache
427 from array in the TABLE_SHARE.
428 */
429 el = table->s->cache_element[table_cache_manager.cache_index(this)];
430
431 if (!el) {
432 /*
433 If TABLE_SHARE doesn't have pointer to the element representing table
434 in this cache, the element for the table must be absent from table the
435 cache.
436
437 Allocate new Table_cache_element object and add it to the cache
438 and array in TABLE_SHARE.
439 */
440 const std::string key(table->s->table_cache_key.str,
441 table->s->table_cache_key.length);
442 assert(m_cache.count(key) == 0);
443
444 el = new Table_cache_element(table->s);
445 m_cache.emplace(key, std::unique_ptr<Table_cache_element>(el));
446 table->s->cache_element[table_cache_manager.cache_index(this)] = el;
447 }
448
449 /* Add table to the used tables list */
451
453
455
456 return false;
457}
458
459/**
460 Prepare used or unused TABLE instance for destruction by removing
461 it from the table cache.
462
463 @note Caller should own lock on the table cache.
464*/
465
468 table->s->cache_element[table_cache_manager.cache_index(this)];
469
470 assert_owner();
471
472 if (table->in_use) {
473 /* Remove from per-table chain of used TABLE objects. */
475 } else {
476 /* Remove from per-table chain of unused TABLE objects. */
477 if (table->triggers && table->triggers->has_load_been_finalized())
479 else
481
482 /* And per-cache unused chain. */
484 }
485
487 if (table->triggers && table->triggers->has_load_been_finalized())
489
492 const std::string key(table->s->table_cache_key.str,
493 table->s->table_cache_key.length);
494 m_cache.erase(key);
495 /*
496 Remove reference to deleted cache element from array
497 in the TABLE_SHARE.
498 */
499 table->s->cache_element[table_cache_manager.cache_index(this)] = nullptr;
500 }
501}
502
503/**
504 Get an unused TABLE instance from the table cache.
505
506 @param thd Thread context.
507 @param key Key identifying table.
508 @param key_length Length of key for the table.
509 @param is_update Indicates whether statement is going to use
510 TABLE object for updating the table; if so,
511 it is better to obtain a TABLE instance with
512 fully-loaded triggers.
513 @param[out] share NULL - if table cache doesn't contain any
514 information about the table (i.e. doesn't have
515 neither used nor unused TABLE objects for it).
516 Pointer to TABLE_SHARE for the table otherwise.
517
518 @note Caller should own lock on the table cache.
519 @note Sets TABLE::in_use member as side effect.
520
521 @retval non-NULL - pointer to unused TABLE object, "share" out-parameter
522 contains pointer to TABLE_SHARE for this table.
523 @retval NULL - no unused TABLE object was found, "share" parameter
524 contains pointer to TABLE_SHARE for this table if there
525 are used TABLE objects in cache and NULL otherwise.
526*/
527
528TABLE *Table_cache::get_table(THD *thd, const char *key, size_t key_length,
529 bool is_update, TABLE_SHARE **share) {
530 TABLE *table;
531
532 assert_owner();
533
534 *share = nullptr;
535
536 const std::string key_str(key, key_length);
537 const auto el_it = m_cache.find(key_str);
538 if (el_it == m_cache.end()) return nullptr;
539 Table_cache_element *el = el_it->second.get();
540
541 *share = el->share;
542
543 /*
544 Obtain (get first and unlink) table from list of unused TABLE objects for
545 this table in this cache.
546 */
547 if (!is_update) {
548 /*
549 For read-only statements we prefer TABLE objects which don't have
550 triggers fully-loaded. If successful, this should leave unused TABLEs
551 with fully-loaded triggers for read-write statements.
552 If there are no TABLE instances without fully-loaded triggers available,
553 we will resort to using one that has them. That's still better than
554 doing full-blown TABLE construction process.
555 */
558 } else {
559 /*
560 For read-write statements try to get a TABLE object with fully-loaded
561 triggers.
562 If there is no such object, try to obtain a TABLE object without
563 fully-loaded triggers. (If necessary trigger loading will be finalized
564 later.)
565 */
568 }
569
570 if (table) {
571 assert(!table->in_use);
572
573 /* Unlink table from unused tables list for this cache. */
575
576 /*
577 Add table to list of used TABLE objects for this table
578 in the table cache.
579 */
581
582 table->in_use = thd;
583 /* The ex-unused table must be fully functional. */
584 assert(table->db_stat && table->file);
585 /* The children must be detached from the table. */
586 assert(!table->file->ha_extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
587 }
588
589 return table;
590}
591
592/**
593 Put used TABLE instance back to the table cache and mark
594 it as unused.
595
596 @note Caller should own lock on the table cache.
597 @note Sets TABLE::in_use member as side effect.
598*/
599
602 table->s->cache_element[table_cache_manager.cache_index(this)];
603
604 assert_owner();
605
606 assert(table->in_use);
607 assert(table->file);
608
609 /* We shouldn't put the table to 'unused' list if the share is old. */
610 assert(!table->s->has_old_version());
611
612 table->in_use = nullptr;
613
614 /* Remove TABLE from the list of used objects for the table in this cache. */
616 /* Add TABLE to the list of unused objects for the table in this cache. */
617 if (table->triggers && table->triggers->has_load_been_finalized())
619 else
621 /* Also link it last in the list of unused TABLE objects for the cache. */
623
624 /*
625 We free the least used tables, not the subject table, to keep the LRU order.
626 Note that in most common case the below call won't free anything.
627 */
629}
630
631/**
632 Construct iterator over all used TABLE objects for the table share.
633
634 @note Assumes that caller owns locks on all table caches.
635*/
637 : share(share_arg), current_cache_index(0), current_table(nullptr) {
640}
641
642/** Helper that moves iterator to the next used TABLE for the table share. */
643
647
649 if ((current_table = el->used_tables.front())) break;
650 }
651 }
652}
653
654/**
655 Get current used TABLE instance and move iterator to the next one.
656
657 @note Assumes that caller owns locks on all table caches.
658*/
659
662
664
665 if (current_table) {
668
669 current_table = ++it;
670
671 if (!current_table) {
674 }
675 }
676
677 return result;
678}
679
682 current_table = nullptr;
684}
685
686#endif /* TABLE_CACHE_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
An insertion policy class for I_P_List which can be used when fast push_back() operation is required.
Definition: sql_plist.h:260
Iterator for I_P_List.
Definition: sql_plist.h:168
Element counting policy class for I_P_List to be used in cases when no element counting should be don...
Definition: sql_plist.h:209
Intrusive parameterized list.
Definition: sql_plist.h:75
void remove(T *a)
Definition: sql_plist.h:124
bool is_empty() const
Definition: sql_plist.h:90
T * front()
Definition: sql_plist.h:133
T * pop_front()
Definition: sql_plist.h:135
void push_front(T *a)
Definition: sql_plist.h:91
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
my_thread_id thread_id() const
Definition: sql_class.h:2558
struct System_status_var status_var
Definition: sql_class.h:1152
Element that represents the table in the specific table cache.
Definition: table_cache.h:265
TABLE_SHARE * get_share() const
Definition: table_cache.h:290
Table_cache_element(TABLE_SHARE *share_arg)
Definition: table_cache.h:288
TABLE_list used_tables
Definition: table_cache.h:275
I_P_List< TABLE, I_P_List_adapter< TABLE, &TABLE::cache_next, &TABLE::cache_prev > > TABLE_list
Definition: table_cache.h:273
TABLE_list free_tables_slim
List of unused TABLE objects that do not have fully-loaded triggers; either because there were no tri...
Definition: table_cache.h:282
TABLE_list free_tables_full_triggers
List of unused TABLE objects with fully-loaded triggers.
Definition: table_cache.h:284
TABLE_SHARE * share
Definition: table_cache.h:285
Iterator which allows to go through all used TABLE instances for the table in all table caches.
Definition: table_cache.h:302
const TABLE_SHARE * share
Definition: table_cache.h:303
Table_cache_iterator(const TABLE_SHARE *share_arg)
Construct iterator over all used TABLE objects for the table share.
Definition: table_cache.h:636
uint current_cache_index
Definition: table_cache.h:304
void move_to_next_table()
Helper that moves iterator to the next used TABLE for the table share.
Definition: table_cache.h:644
TABLE * current_table
Definition: table_cache.h:305
void rewind()
Definition: table_cache.h:680
TABLE * operator++(int)
Get current used TABLE instance and move iterator to the next one.
Definition: table_cache.h:660
Container class for all table cache instances in the system.
Definition: table_cache.h:206
Table_cache m_table_cache[MAX_TABLE_CACHES]
An array of Table_cache instances.
Definition: table_cache.h:251
uint cached_tables()
Get total number of used and unused TABLE objects in all table caches.
Definition: table_cache.cc:234
void unlock_all_and_tdc()
Release locks on all instances of table cache and table definition cache.
Definition: table_cache.cc:259
void print_tables()
Print debug information for the contents of all table cache instances.
Definition: table_cache.cc:391
void lock_all_and_tdc()
Acquire locks on all instances of table cache and table definition cache (i.e.
Definition: table_cache.cc:248
void assert_owner_all_and_tdc()
Assert that caller owns locks on all instances of table cache and table definition cache.
Definition: table_cache.cc:289
bool init()
Initialize all instances of table cache to be used by server.
Definition: table_cache.cc:209
uint cache_index(Table_cache *cache) const
Get index for the table cache in container.
Definition: table_cache.h:223
void assert_owner_all()
Assert that caller owns locks on all instances of table cache.
Definition: table_cache.cc:279
void free_all_unused_tables()
Free all unused TABLE objects in all table cache instances.
Definition: table_cache.cc:379
static const int MAX_TABLE_CACHES
Maximum supported number of table cache instances.
Definition: table_cache.h:209
Table_cache * get_cache(THD *thd)
Get instance of table cache to be used by particular connection.
Definition: table_cache.h:218
void free_table(THD *thd, enum_tdc_remove_table_type remove_type, TABLE_SHARE *share)
Remove and free all or some (depending on parameter) TABLE objects for the table from all table cache...
Definition: table_cache.cc:306
static const int DEFAULT_MAX_TABLE_CACHES
Default number of table cache instances.
Definition: table_cache.h:212
void assert_owner(THD *thd)
Assert that caller owns lock on the table cache.
Definition: table_cache.cc:270
void destroy()
Destroy all instances of table cache which were used by server.
Definition: table_cache.cc:223
Cache for open TABLE objects.
Definition: table_cache.h:74
void lock()
Acquire lock on table cache instance.
Definition: table_cache.h:167
std::atomic< uint > m_table_triggers_count
Total number of TABLE instances in this table cache with fully-loaded triggers (both in use and unuse...
Definition: table_cache.h:143
bool add_used_table(THD *thd, TABLE *table)
Add newly created TABLE object which is going to be used right away to the table cache.
Definition: table_cache.h:418
void unlock()
Release lock on table cache instance.
Definition: table_cache.h:169
TABLE * get_table(THD *thd, const char *key, size_t key_length, bool is_update, TABLE_SHARE **share)
Get an unused TABLE instance from the table cache.
Definition: table_cache.h:528
uint loaded_triggers_tables() const
Definition: table_cache.h:195
bool init()
Initialize instance of table cache.
Definition: table_cache.cc:55
void release_table(THD *thd, TABLE *table)
Put used TABLE instance back to the table cache and mark it as unused.
Definition: table_cache.h:600
std::unordered_map< std::string, std::unique_ptr< Table_cache_element > > m_cache
The hash of Table_cache_element objects, each table/table share that has any TABLE object in the Tabl...
Definition: table_cache.h:108
void destroy()
Destroy instance of table cache.
Definition: table_cache.cc:65
void notify_triggers_load()
Notify the table cache that we have finalized loading and parsing triggers for one of its TABLE objec...
Definition: table_cache.h:193
mysql_mutex_t m_lock
The table cache lock protects the following data:
Definition: table_cache.h:99
uint m_table_count
Total number of TABLE instances for tables in this particular table cache (both in use by threads and...
Definition: table_cache.h:124
void assert_owner()
Assert that caller owns lock on the table cache.
Definition: table_cache.h:171
void free_all_unused_tables()
Free all unused TABLE objects in the table cache.
Definition: table_cache.cc:135
void check_unused()
Definition: table_cache.h:154
TABLE * m_unused_tables
List that contains all TABLE instances for tables in this particular table cache that are in not use ...
Definition: table_cache.h:116
void link_unused_table(TABLE *table)
Add table to the tail of unused tables list for table cache (i.e.
Definition: table_cache.h:327
static PSI_mutex_info m_mutex_keys[]
Definition: table_cache.h:147
static void init_psi_keys()
Init P_S instrumentation key for mutex protecting Table_cache instance.
Definition: table_cache.cc:69
void unlink_unused_table(TABLE *table)
Remove table from the unused tables list for the table cache.
Definition: table_cache.h:347
uint cached_tables() const
Get number of TABLE instances in the cache.
Definition: table_cache.h:182
static PSI_mutex_key m_lock_key
Definition: table_cache.h:146
void print_tables()
Print debug information for the contents of the table cache.
Definition: table_cache.cc:150
I_P_List< TABLE, I_P_List_adapter< TABLE, &TABLE::triggers_lru_next, &TABLE::triggers_lru_prev >, I_P_List_null_counter, I_P_List_fast_push_back< TABLE > > m_unused_triggers_lru
LRU-organized list containing all TABLE instances with fully-loaded triggers in this table cache whic...
Definition: table_cache.h:135
void remove_table(TABLE *table)
Prepare used or unused TABLE instance for destruction by removing it from the table cache.
Definition: table_cache.h:466
void free_unused_tables_if_necessary(THD *thd)
Free unused TABLE instances if total number of TABLE objects in table cache has exceeded table_cache_...
Definition: table_cache.h:369
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
mysql_mutex_t LOCK_open
LOCK_open protects the following variables/objects:
Definition: sql_base.cc:275
void intern_close_table(TABLE *table)
Definition: sql_base.cc:1189
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
#define mysql_mutex_assert_owner(M)
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
Definition: mysql_mutex.h:112
This file includes constants used by all storage engines.
@ HA_EXTRA_IS_ATTACHED_CHILDREN
Definition: my_base.h:400
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:181
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
ABI for instrumented mutexes.
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
struct result result
Definition: result.h:34
Instrumentation helpers for mutexes.
Instrumentation helpers for mutexes.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
enum_tdc_remove_table_type
Definition: sql_base.h:102
Hook class which via its methods specifies which members of T should be used for participating in a i...
Definition: sql_plist.h:198
Mutex information.
Definition: psi_mutex_bits.h:73
ulonglong table_open_cache_overflows
Definition: system_variables.h:557
ulonglong table_open_cache_triggers_overflows
Definition: system_variables.h:560
This structure is shared between different table objects.
Definition: table.h:704
Table_cache_element ** cache_element
Array of table_cache_instances pointers to elements of table caches respresenting this table in each ...
Definition: table.h:749
Definition: table.h:1421
TABLE ** triggers_lru_prev
Definition: table.h:1446
TABLE * next
Definition: table.h:1424
TABLE * triggers_lru_next
Links for the LRU list of unused TABLE objects with fully loaded triggers in the specific instance of...
Definition: table.h:1446
TABLE * prev
Definition: table.h:1424
std::atomic_uint64_t table_open_cache_overflows
Definition: aggregated_stats_buffer.h:60
To facilitate calculating values of status variables aggregated per all THDs in real-time,...
Definition: aggregated_stats.h:39
aggregated_stats_buffer & get_shard(my_thread_id thread_id)
Definition: aggregated_stats.h:42
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: result.h:30
ulong table_cache_instances
Definition: table_cache.h:55
struct aggregated_stats global_aggregated_stats
Definition: mysqld.cc:1550
Table_cache_manager table_cache_manager
Container for all table cache instances in the system.
Definition: table_cache.cc:40
ulong table_cache_triggers_per_instance
Definition: table_cache.h:56
ulong table_cache_size_per_instance
Definition: mysqld.cc:1350
ulong table_cache_triggers
Definition: table_cache.h:56