MySQL  8.0.27
Source Code Documentation
dictionary_client.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2021, 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 also distributed 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 included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef DD_CACHE__DICTIONARY_CLIENT_INCLUDED
24 #define DD_CACHE__DICTIONARY_CLIENT_INCLUDED
25 
26 #include <assert.h>
27 #include <stddef.h>
28 #include <functional>
29 #include <memory>
30 #include <string>
31 #include <vector>
32 
33 #include "my_compiler.h"
34 
35 #include "object_registry.h" // Object_registry
36 #include "sql/dd/object_id.h"
37 #include "sql/dd/string_type.h"
38 
39 class THD;
40 struct LEX_USER;
41 
42 namespace dd {
43 class Schema;
44 class Table;
45 class Entity_object;
46 } // namespace dd
47 
48 namespace dd {
49 namespace cache {
50 
51 class SPI_lru_cache;
52 
53 /**
54  A smart-pointer for managing an SPI_lru_cache even when it is only
55  forward declared. Automaticlly allocated cache with new, and assigns
56  m_spi_lru_cache to it, when dereferenced using non-const
57  operator->(). Destructor deletes the object pointed to by
58  m_spi_lru_cache.
59 */
62 
63  public:
64  /** Calls delete on m_spi_lru_cache unless nullptr. */
66 
67  /**
68  Creates cache on demand if m_spi_lru_cache is nullptr.
69  @return pointer to cache.
70  */
72 
73  /**
74  Const overload which does not create cache on demand, but merely
75  returns the pointer.
76  @return pointer to cache (may be nullptr)
77  */
78  const SPI_lru_cache *operator->() const { return m_spi_lru_cache; }
79 
80  /*
81  Predicate for nullptr.
82  @return true if points to valid cache, false otherwise.
83  */
84  bool is_nullptr() const { return (m_spi_lru_cache == nullptr); }
85 };
86 
87 /**
88  Implementation of a dictionary client.
89 
90  The dictionary client provides a unified interface to accessing dictionary
91  objects. The client is a member of the THD, and is typically used in
92  server code to access the dictionary. When we refer to "the user" below,
93  we mean the server code using the dictionary client.
94 
95  The main task of the client is to access a shared cache to retrieve
96  dictionary objects. The shared cache, in its turn, will access the
97  dictionary tables if there is a cache miss.
98 
99  To support cache eviction, the shared cache must keep track of which
100  clients that have acquired an object. When a client acquires an object
101  from the shared cache for the first time, it is added to a client local
102  object registry. Further acquisition of the same object from the client
103  will get the object from the client's registry. Thus, the usage tracking
104  in the shared cache only keep track of the number of clients currently
105  using the object, and hence, there must be an operation that complements
106  acquisition, to inform the shared cache that the object is not used
107  anymore. This complementing operation is called releasing the object.
108 
109  To manage releasing objects, the Auto_releaser class provides some
110  support. When an auto releaser is instantiated, it will keep track of
111  the objects that are acquired from the shared cache in its lifetime.
112  Auto releasers may be nested or stacked, and the current releaser is
113  the one at the top of the stack. The auto releaser stack is associated
114  with a dictionary client instance. When the auto releaser goes out
115  of scope, it will release all objects that have been acquired from the
116  shared cache in its lifetime. Objects retrieved earlier than that will
117  be automatically released by a releaser further down the auto releaser
118  stack. For more coarse grained control, there is a release method that
119  will release all objects acquired by the client.
120 
121  In addition to the auto releasers, the client has an object registry.
122  The registry holds pointers to all currently acquired objects. Thus,
123  the object registry is the union of the registers in the stack of
124  auto releasers. The client's object registry is used for looking up
125  objects, while the registers in the auto releasers are used for
126  releasing objects.
127 
128  The client also has a second registery of objects with uncommitted changes.
129  These are objects acquired by acquire_for_modification() or registered
130  with register_uncommitted_object(). These objects are only present in
131  the local registry and not in the shared cache. Once registered, the
132  objects can also be retrieved with normal acquire(). This means that
133  a given client has a view which includes uncommitted changes made
134  using the same client, while other clients do not see these changes.
135 
136  @note We must handle situations where an object is actually acquired from
137  the shared cache, while the dynamic cast to a subtype fails. We use
138  the auto release mechanism to achieve that.
139 
140  @note When a dictionary client method returns true, indicating that an
141  error has occurred, the error has been reported, either by the
142  client itself, or by the dictionary subsystem.
143 */
144 
145 template <typename T>
146 class Cache_element;
147 
149  public:
150  /**
151  Class to help releasing and deleting objects.
152 
153  This class keeps a register of shared objects that are automatically
154  released when the instance goes out of scope. When a new instance
155  is created, the encompassing dictionary client's current auto releaser
156  is replaced by this one, keeping a link to the old one. When the
157  auto releaser is deleted, it links the old releaser back in as the
158  client's current releaser.
159 
160  Shared objects that are added to the auto releaser will be released when
161  the releaser is deleted. Only the dictionary client is allowed to add
162  objects to the auto releaser.
163 
164  The usage pattern is that objects that are retrieved from the shared
165  dictionary cache are added to the current auto releaser. Objects that
166  are retrieved from the client's local object register are not added to
167  the auto releaser. Thus, when the releaser is deleted, it releases all
168  objects that have been retrieved from the shared cache during the
169  lifetime of the releaser.
170 
171  Similarly the auto releaser maintains a list of objects created
172  by acquire_uncached(). These objects are owned by the Auto_releaser
173  and are deleted when the auto releaser goes out of scope.
174  */
175 
177  friend class Dictionary_client;
178 
179  private:
183 
184  /**
185  Register an object to be auto released.
186 
187  @tparam T Dictionary object type.
188  @param element Cache element to auto release.
189  */
190 
191  template <typename T>
193  // Catch situations where we do not use a non-default releaser.
194  assert(m_prev != nullptr);
195  m_release_registry.put(element);
196  }
197 
198  /**
199  Transfer an object from the current to the previous auto releaser.
200 
201  @tparam T Dictionary object type.
202  @param object Dictionary object to transfer.
203  */
204 
205  template <typename T>
206  void transfer_release(const T *object);
207 
208  /**
209  Remove an element from some auto releaser down the chain.
210 
211  Return a pointer to the releaser where the element was found.
212  Thus, the element may be re-inserted into the appropriate
213  auto releaser after e.g. changing the keys.
214 
215  @tparam T Dictionary object type.
216  @param element Cache element to auto remove.
217 
218  @return Pointer to the auto releaser where the object was signed up.
219  */
220 
221  template <typename T>
223 
224  // Create a new empty auto releaser. Used only by the Dictionary_client.
225  Auto_releaser();
226 
227  public:
228  /**
229  Create a new auto releaser and link it into the dictionary client
230  as the current releaser.
231 
232  @param client Dictionary client for which to install this auto
233  releaser.
234  */
235 
236  explicit Auto_releaser(Dictionary_client *client);
237 
238  // Release all objects registered and restore previous releaser.
239  ~Auto_releaser();
240 
241  // Debug dump to stderr.
242  template <typename T>
243  void dump() const;
244  };
245 
246  private:
247  std::vector<Entity_object *> m_uncached_objects; // Objects to be deleted.
248  Object_registry m_registry_committed; // Registry of committed objects.
249  Object_registry m_registry_uncommitted; // Registry of uncommitted objects.
250  Object_registry m_registry_dropped; // Registry of dropped objects.
251  THD *m_thd; // Thread context, needed for cache misses.
252  Auto_releaser m_default_releaser; // Default auto releaser.
253  Auto_releaser *m_current_releaser; // Current auto releaser.
254 
255  /**
256  Se-private ids known not to exist in either TABLES or PARTITIONS
257  or both.
258  */
260 
261  /**
262  Get a dictionary object.
263 
264  The operation retrieves a dictionary object by one of its keys from the
265  cache and returns it through the object parameter. If the object is
266  already present in the client's local object registry, it is fetched
267  from there. Otherwise, it is fetched from the shared cache (possibly
268  involving a cache miss), and eventually added to the local object
269  registry.
270 
271  If no object is found for the given key, NULL is returned. The shared
272  cache owns the returned object, i.e., the caller must not delete it.
273  After using the object(s), the user must release it using one of the
274  release mechanisms described earlier.
275 
276  The reference counter for the object is incremented if the object is
277  retrieved from the shared cache. If the object was present in the local
278  registry, the reference counter stays the same. A cache miss is handled
279  transparently by the shared cache.
280 
281  @note This function must be called with type T being the same as
282  T::Cache_partition. Dynamic casting to the actual subtype
283  must be done at an outer level.
284 
285  @tparam K Key type.
286  @tparam T Dictionary object type.
287  @param key Key to use for looking up the object.
288  @param [out] object Object pointer, if an object exists, otherwise NULL.
289  @param [out] local_committed
290  Whether the object was read from the local
291  committed object registry.
292  @param [out] local_uncommitted
293  Whether the object was read from the local
294  uncommitted registry.
295 
296  @retval false No error.
297  @retval true Error (from handling a cache miss).
298  */
299 
300  template <typename K, typename T>
301  [[nodiscard]] bool acquire(const K &key, const T **object,
302  bool *local_committed, bool *local_uncommitted);
303 
304  /**
305  Get an uncommitted dictionary object that can be modified safely.
306 
307  The difference between this method and acquire(), is that this method
308  only looks in the local registry of uncommitted objects. That is, object
309  created by acquire_for_modification() or registered with
310  register_uncommitted_object(). It will not access the shared cache.
311  Objects that have been dropped are returned as nullptr, but
312  with the value of the parameter 'dropped' set to 'true'.
313 
314  @tparam K Key type.
315  @tparam T Dictionary object type.
316  @param key Key to use for looking up the object.
317  @param [out] object Object pointer, if an object exists, otherwise NULL.
318  @param [out] dropped Object exists, but has been dropped and has not yet
319  committed. In this case, 'object' is set to nullptr.
320  */
321 
322  template <typename K, typename T>
323  void acquire_uncommitted(const K &key, T **object, bool *dropped);
324 
325  /**
326  Mark all objects of a certain type as not being used by this client.
327 
328  This function is called with the client's own object registry, or with
329  the registry of an auto releaser (which will contain a subset of the
330  objects in the client's object registry).
331 
332  The function will release all objects of a given type in the registry
333  submitted.The objects must be present and in use. If the objects become
334  unused, they are added to the free list in the shared cache, which is
335  then rectified to enforce its capacity constraints. The objects are also
336  removed from the client's object registry.
337 
338  @tparam T Dictionary object type.
339  @param registry Object registry tp release from.
340 
341  @return Number of objects released.
342  */
343 
344  template <typename T>
345  size_t release(Object_registry *registry);
346 
347  /**
348  Release all objects in the submitted object registry.
349 
350  This function will release all objects from the client's registry, or
351  from the registry of an auto releaser.
352 
353  @param registry Object registry tp release from.
354 
355  @return Number of objects released.
356  */
357 
358  size_t release(Object_registry *registry);
359 
360  /**
361  Register an uncached object to be auto deleted.
362 
363  @tparam T Dictionary object type.
364  @param object Dictionary object to auto delete.
365  */
366 
367  template <typename T>
368  void auto_delete(T *object) {
369 #ifndef NDEBUG
370  // Make sure we do not sign up a shared object for auto delete.
373  static_cast<const typename T::Cache_partition *>(object), &element);
374  assert(element == nullptr);
375 
376  // Make sure we do not sign up an uncommitted object for auto delete.
378  static_cast<const typename T::Cache_partition *>(object), &element);
379  assert(element == nullptr);
380 
381  // We must require a top level non-default releaser to ensure a
382  // predictable life span of the objects.
384 #endif
385 
386  m_uncached_objects.push_back(object);
387  }
388 
389  /**
390  Remove an object from the auto delete vector.
391 
392  @tparam T Dictionary object type.
393  @param object Dictionary object to keep.
394  */
395 
396  template <typename T>
397  void no_auto_delete(T *object) {
398 #ifndef NDEBUG
399  // Make sure the object has been registered as uncommitted.
402  static_cast<const typename T::Cache_partition *>(object), &element);
403  assert(element != nullptr);
404 #endif
406  m_uncached_objects.end(), object),
407  m_uncached_objects.end());
408  }
409 
410  /**
411  Transfer object ownership from caller to Dictionary_client,
412  and register the object as uncommitted.
413 
414  This is intended for objects created by the caller that should
415  be managed by Dictionary_client. Transferring an object in this
416  way will make it accessible by calling acquire().
417 
418  This method takes a non-const argument as it only makes
419  sense to register objects not acquired from the shared cache.
420 
421  @tparam T Dictionary object type.
422  @param object Object to transfer ownership.
423  */
424 
425  template <typename T>
426  void register_uncommitted_object(T *object);
427 
428  /**
429  Transfer object ownership from caller to Dictionary_client,
430  and register the object as dropped.
431 
432  This method is used internally by the Dictionary_client for
433  keeping track of dropped objects. This is needed before
434  transaction commit if an attempt is made to acquire the
435  dropped object, to avoid consulting the shared cache, which
436  might contaminate the cache due to a cache miss (handled with
437  isolation level READ_COMMITTED). Instead of consulting the
438  shared cache, this Dictionary_client will recognize that the
439  object is dropped, and return a nullptr.
440 
441  This method takes a non-const argument as it only makes
442  sense to register objects not acquired from the shared cache.
443 
444  @tparam T Dictionary object type.
445  @param object Object to transfer ownership.
446  */
447 
448  template <typename T>
449  void register_dropped_object(T *object);
450 
451  /**
452  Remove the uncommitted objects from the client and (depending
453  on the parameter) put them into the shared cache,
454  thereby making them visible to other clients. Should be called
455  after commit to disk but before metadata locks are released.
456 
457  Can also be called after rollback in order to explicitly throw
458  the modified objects away before making any actions to compensate
459  for a partially completed statement. Note that uncommitted objects
460  are automatically removed once the topmost stack-allocated auto
461  releaser goes out of scope, so calling this function in case of
462  abort is only needed to make acquire return the old object again
463  later in the same statement.
464 
465  @param commit_to_shared_cache
466  If true, uncommitted objects will
467  be put into the shared cache.
468  @tparam T Dictionary object type.
469  */
470 
471  template <typename T>
472  void remove_uncommitted_objects(bool commit_to_shared_cache);
473 
474  template <typename T>
475  using Const_ptr_vec = std::vector<const T *>;
476 
477  /**
478  Fetch objects from DD tables that match the supplied key.
479 
480  @tparam Object_type Type of object to fetch.
481  @param coll Vector to fill with objects.
482  @param object_key The search key. If key is not supplied, then
483  we do full index scan.
484 
485  @return false Success.
486  @return true Failure (error is reported).
487  */
488 
489  template <typename Object_type>
490  [[nodiscard]] bool fetch(Const_ptr_vec<Object_type> *coll,
491  const Object_key *object_key);
492 
493  /**
494  Auxiliary function to retrieve an object by its object id without caching
495  it.It is responsibility of the caller to delete the retrieved object.
496  */
497  template <typename T>
498  bool acquire_uncached_impl(Object_id id, T **object);
499 
500  /**
501  Auxiliary function to retrieve a possibly uncommitted object by its object
502  id without caching it. It is responsibility of the caller to delete the
503  retrieved object.
504  */
505  template <typename T>
506  bool acquire_uncached_uncommitted_impl(Object_id id, T **object);
507 
508  public:
509  // Initialize an instance with a default auto releaser.
510  explicit Dictionary_client(THD *thd);
511 
512  // Make sure all objects are released.
514 
517  /**
518  Retrieve an object by its object id.
519 
520  @tparam T Dictionary object type.
521  @param id Object id to retrieve.
522  @param [out] object Dictionary object, if present; otherwise NULL.
523 
524  @retval false No error.
525  @retval true Error (from handling a cache miss).
526  */
528 
529  template <typename T>
530  [[nodiscard]] bool acquire(Object_id id, const T **object);
531 
532  /**
533  Retrieve an object by its object id.
534 
535  This function returns a cloned object that can be modified.
536 
537  @tparam T Dictionary object type.
538  @param id Object id to retrieve.
539  @param [out] object Dictionary object, if present; otherwise NULL.
540 
541  @retval false No error.
542  @retval true Error (from handling a cache miss).
543  */
544 
545  template <typename T>
546  [[nodiscard]] bool acquire_for_modification(Object_id id, T **object);
547 
548  /**
549  Retrieve an object by its object id without caching it.
550 
551  The object is not cached but owned by the dictionary client, who
552  makes sure it is deleted. The object must not be released, and may not
553  be used as a parameter to the other dictionary client methods since it is
554  not known by the object registry.
555 
556  @tparam T Dictionary object type.
557  @param id Object id to retrieve.
558  @param [out] object Dictionary object, if present; otherwise NULL.
559 
560  @retval false No error.
561  @retval true Error (from reading the dictionary tables).
562  */
563 
564  template <typename T>
565  [[nodiscard]] bool acquire_uncached(Object_id id, T **object);
566 
567  /**
568  Retrieve an object by its object id without caching it.
569 
570  The object is not cached and owned by the caller through unique_ptr
571  it provides. The object may not be used as a parameter to the other
572  dictionary client methods since it is not known by the object registry.
573 
574  @tparam T Dictionary object type.
575  @param id Object id to retrieve.
576  @param [out] object_ptr Smart pointer with dictionary object,
577  if present or with nullptr otherwise.
578 
579  @retval false No error.
580  @retval true Error (from reading the dictionary tables).
581  */
582  template <typename T>
583  [[nodiscard]] bool acquire_uncached(Object_id id,
584  std::unique_ptr<T> *object_ptr);
585 
586  /**
587  Retrieve a possibly uncommitted object by its object id without caching it.
588 
589  The object is not cached but owned by the dictionary client, who
590  makes sure it is deleted. The object must not be released, and may not
591  be used as a parameter to the other dictionary client methods since it is
592  not known by the object registry.
593 
594  When the object is read from the persistent tables, the transaction
595  isolation level is READ UNCOMMITTED. This is necessary to be able to
596  read uncommitted data from an earlier stage of the same session.
597 
598  @tparam T Dictionary object type.
599  @param id Object id to retrieve.
600  @param [out] object Dictionary object, if present; otherwise nullptr.
601 
602  @retval false No error.
603  @retval true Error (from reading the dictionary tables).
604  */
605 
606  template <typename T>
607  [[nodiscard]] bool acquire_uncached_uncommitted(Object_id id, T **object);
608 
609  /**
610  Retrieve a possibly uncommitted object by its object id without caching it.
611 
612  The object is not cached and owned by the caller through unique_ptr
613  it provides. The object may not be used as a parameter to the other
614  dictionary client methods since it is not known by the object registry.
615 
616  When the object is read from the persistent tables, the transaction
617  isolation level is READ UNCOMMITTED. This is necessary to be able to
618  read uncommitted data from an earlier stage of the same session.
619 
620  @tparam T Dictionary object type.
621  @param id Object id to retrieve.
622  @param [out] object_ptr Smart pointer with dictionary object,
623  if present or with nullptr otherwise.
624 
625  @retval false No error.
626  @retval true Error (from reading the dictionary tables).
627  */
628  template <typename T>
629  [[nodiscard]] bool acquire_uncached_uncommitted(
630  Object_id id, std::unique_ptr<T> *object_ptr);
631 
632  /**
633  Retrieve an object by its name.
634 
635  @tparam T Dictionary object type.
636  @param object_name Name of the object.
637  @param [out] object Dictionary object, if present; otherwise NULL.
638 
639  @retval false No error.
640  @retval true Error (from handling a cache miss).
641  */
642 
643  template <typename T>
644  [[nodiscard]] bool acquire(const String_type &object_name, const T **object);
645 
646  /**
647  Retrieve an object by its name.
648 
649  This function returns a cloned object that can be modified.
650 
651  @tparam T Dictionary object type.
652  @param object_name Name of the object.
653  @param [out] object Dictionary object, if present; otherwise NULL.
654 
655  @retval false No error.
656  @retval true Error (from handling a cache miss).
657  */
658 
659  template <typename T>
660  [[nodiscard]] bool acquire_for_modification(const String_type &object_name,
661  T **object);
662 
663  /**
664  Retrieve an object by its schema- and object name.
665 
666  @note We will acquire an IX-lock on the schema name unless we already
667  have one. This is needed for proper synchronization with schema
668  DDL in cases where the table does not exist, and where the
669  indirect synchronization based on table names therefore will not
670  apply.
671 
672  @todo TODO: We should change the MDL acquisition (see above) for a more
673  long term solution.
674 
675  @tparam T Dictionary object type.
676  @param schema_name Name of the schema containing the object.
677  @param object_name Name of the object.
678  @param [out] object Dictionary object, if present; otherwise NULL.
679 
680  @retval false No error.
681  @retval true Error (from handling a cache miss, or from
682  failing to get an MDL lock).
683  */
684 
685  template <typename T>
686  [[nodiscard]] bool acquire(const String_type &schema_name,
687  const String_type &object_name, const T **object);
688 
689  /**
690  Retrieve an object by its schema- and object name.
691 
692  This function returns a cloned object that can be modified.
693 
694  @note We will acquire an IX-lock on the schema name unless we already
695  have one. This is needed for proper synchronization with schema
696  DDL in cases where the table does not exist, and where the
697  indirect synchronization based on table names therefore will not
698  apply.
699 
700  @todo TODO: We should change the MDL acquisition (see above) for a more
701  long term solution.
702 
703  @tparam T Dictionary object type.
704  @param schema_name Name of the schema containing the object.
705  @param object_name Name of the object.
706  @param [out] object Dictionary object, if present; otherwise NULL.
707 
708  @retval false No error.
709  @retval true Error (from handling a cache miss, or from
710  failing to get an MDL lock).
711  */
712 
713  template <typename T>
714  [[nodiscard]] bool acquire_for_modification(const String_type &schema_name,
715  const String_type &object_name,
716  T **object);
717 
718  /**
719  Retrieve an object by its schema- and object name.
720 
721  @note We will acquire an IX-lock on the schema name unless we already
722  have one. This is needed for proper synchronization with schema
723  DDL in cases where the table does not exist, and where the
724  indirect synchronization based on table names therefore will not
725  apply.
726 
727  @note This is a variant of the method above asking for an object of type
728  T, and hence using T's functions for updating name keys etc.
729  This function, however, returns the instance pointed to as type
730  T::Cache_partition to ease handling of various subtypes
731  of the same base type.
732 
733  @todo TODO: We should change the MDL acquisition (see above) for a more
734  long term solution.
735 
736  @tparam T Dictionary object type.
737  @param schema_name Name of the schema containing the object.
738  @param object_name Name of the object.
739  @param [out] object Dictionary object, if present; otherwise NULL.
740 
741  @retval false No error.
742  @retval true Error (from handling a cache miss, or from
743  failing to get an MDL lock).
744  */
745 
746  template <typename T>
747  [[nodiscard]] bool acquire(const String_type &schema_name,
748  const String_type &object_name,
749  const typename T::Cache_partition **object);
750 
751  /**
752  Retrieve an object by its schema- and object name.
753 
754  This function returns a cloned object that can be modified.
755 
756  @note We will acquire an IX-lock on the schema name unless we already
757  have one. This is needed for proper synchronization with schema
758  DDL in cases where the table does not exist, and where the
759  indirect synchronization based on table names therefore will not
760  apply.
761 
762  @note This is a variant of the method above asking for an object of type
763  T, and hence using T's functions for updating name keys etc.
764  This function, however, returns the instance pointed to as type
765  T::Cache_partition to ease handling of various subtypes
766  of the same base type.
767 
768  @todo TODO: We should change the MDL acquisition (see above) for a more
769  long term solution.
770 
771  @tparam T Dictionary object type.
772  @param schema_name Name of the schema containing the object.
773  @param object_name Name of the object.
774  @param [out] object Dictionary object, if present; otherwise NULL.
775 
776  @retval false No error.
777  @retval true Error (from handling a cache miss, or from
778  failing to get an MDL lock).
779  */
780 
781  template <typename T>
782  [[nodiscard]] bool acquire_for_modification(
783  const String_type &schema_name, const String_type &object_name,
784  typename T::Cache_partition **object);
785 
786  /**
787  Retrieve a table object by its se private id.
788 
789  @param engine Name of the engine storing the table.
790  @param se_private_id SE private id of the table.
791  @param [out] table Table object, if present; otherwise NULL.
792 
793  @note The object must be acquired uncached since we cannot acquire a
794  metadata lock in advance since we do not know the table name.
795  Thus, the returned table object is owned by the caller, who must
796  make sure it is deleted.
797 
798  @retval false No error or if object was not found.
799  @retval true Error (e.g. from reading DD tables, or if an
800  object of a wrong type was found).
801  */
802 
803  [[nodiscard]] bool acquire_uncached_table_by_se_private_id(
804  const String_type &engine, Object_id se_private_id, Table **table);
805 
806  /**
807  Retrieve a table object by its partition se private id.
808 
809  @param engine Name of the engine storing the table.
810  @param se_partition_id SE private id of the partition.
811  @param [out] table Table object, if present; otherwise NULL.
812 
813  @retval false No error or if object was not found.
814  @retval true Error (from handling a cache miss).
815  */
816 
818  const String_type &engine, Object_id se_partition_id, Table **table);
819 
820  /**
821  Retrieve schema and table name by the se private id of the table.
822 
823  @param engine Name of the engine storing the table.
824  @param se_private_id SE private id of the table.
825  @param [out] schema_name Name of the schema containing the table.
826  @param [out] table_name Name of the table.
827 
828  @retval false No error OR if object was not found.
829  The OUT params will be set to empty
830  string when object is not found.
831  @retval true Error.
832  */
833 
834  [[nodiscard]] bool get_table_name_by_se_private_id(const String_type &engine,
835  Object_id se_private_id,
836  String_type *schema_name,
838 
839  /**
840  Retrieve schema and table name by the se private id of the partition.
841 
842  @param engine Name of the engine storing the table.
843  @param se_partition_id SE private id of the table partition.
844  @param [out] schema_name Name of the schema containing the table.
845  @param [out] table_name Name of the table.
846 
847  @retval false No error or if object was not found.
848  The OUT params will be set to empty
849  string when object is not found.
850  @retval true Error.
851  */
852 
854  const String_type &engine, Object_id se_partition_id,
855  String_type *schema_name, String_type *table_name);
856 
857  /**
858  Retrieve a table name of a given trigger name and schema.
859 
860  @param schema Schema containing the trigger.
861  @param trigger_name Name of the trigger.
862  @param [out] table_name Name of the table for which
863  trigger belongs to. Empty string if
864  there is no such trigger.
865 
866  @retval false No error.
867  @retval true Error.
868  */
869 
870  [[nodiscard]] bool get_table_name_by_trigger_name(
871  const Schema &schema, const String_type &trigger_name,
873 
874  /**
875  Check if schema contains foreign key with specified name.
876 
877  @param schema Schema containing the foreign key.
878  @param foreign_key_name Name of the foreign key.
879  @param [out] exists Set to true if foreign key with
880  the name provided exists in the
881  schema, false otherwise.
882 
883  @retval false No error.
884  @retval true Error.
885  */
886 
887  [[nodiscard]] bool check_foreign_key_exists(
888  const Schema &schema, const String_type &foreign_key_name, bool *exists);
889 
890  /**
891  Check if schema contains check constraint with specified name.
892 
893  @param schema Schema containing the check constraint.
894  @param check_cons_name Name of the check constraint.
895  @param [out] exists Set to true if check constraint with
896  the name provided exists in the
897  schema, false otherwise.
898 
899  @retval false No error.
900  @retval true Error.
901  */
902 
903  bool check_constraint_exists(const Schema &schema,
904  const String_type &check_cons_name,
905  bool *exists);
906 
907  /**
908  Fetch the names of the components in the schema. Hidden components are
909  ignored. E.g., Object with dd::Table::hidden() == true will be ignored.
910 
911  @tparam T Type of object to retrieve names for.
912  @param schema Schema for which to get component names.
913  @param [out] names An std::vector containing all object names.
914 
915  @return true Failure (error is reported).
916  @return false Success.
917  */
918 
919  template <typename T>
920  [[nodiscard]] bool fetch_schema_component_names(
921  const Schema *schema, std::vector<String_type> *names) const;
922 
923  /**
924  Fetch the names of the tables in the schema belonging to specific
925  storage engine. E.g., Object with dd::Table::hidden() == true will be
926  ignored.
927 
928  @param schema Schema for which to get component names.
929  @param engine Engine name of tables to match.
930  @param [out] names An std::vector containing all object names.
931 
932  @return true Failure (error is reported).
933  @return false Success.
934  */
935 
936  [[nodiscard]] bool fetch_schema_table_names_by_engine(
937  const Schema *schema, const String_type &engine,
938  std::vector<String_type> *names) const;
939 
940  /**
941  Fetch the names of the server tables in the schema. Ignore tables
942  hidden by SE.
943 
944  @param schema Schema for which to get component names.
945  @param [out] names An std::vector containing all object names.
946 
947  @return true Failure (error is reported).
948  @return false Success.
949  */
950 
952  const Schema *schema, std::vector<String_type> *names) const;
953 
954  /**
955  Fetch all global component ids of the given type.
956 
957  @tparam T Type of components to get.
958  @param [out] ids An std::vector containing all component ids.
959 
960  @return true Failure (error is reported).
961  @return false Success.
962  */
963 
964  template <typename T>
965  [[nodiscard]] bool fetch_global_component_ids(
966  std::vector<Object_id> *ids) const;
967 
968  /**
969  Fetch all global component names of the given type.
970 
971  @tparam T Type of components to get.
972  @param [out] names An std::vector containing all component names.
973 
974  @return true Failure (error is reported).
975  @return false Success.
976  */
977 
978  template <typename T>
979  [[nodiscard]] bool fetch_global_component_names(
980  std::vector<String_type> *names) const;
981 
982  /**
983  Execute the submitted lambda function for each entity of the given type
984  selected by the submitted key. If the lambda returns true, iteration
985  stops and the function returns.
986 
987  @tparam Object_type Entity type to examine.
988  @param object_key Key to use for selecting entities.
989  @param processor Lambda to execute for each entity.
990  @return true Failure (error is reported unless the lambda
991  returned true).
992  @return false Success.
993  */
994 
995  template <typename Object_type>
996  [[nodiscard]] bool foreach (
997  const Object_key *object_key,
998  std::function<bool(std::unique_ptr<Object_type> &)> const &processor)
999  const;
1000 
1001  /**
1002  Fetch all components in the schema.
1003 
1004  @tparam T Type of components to get.
1005  @param schema Schema for which to get components.
1006  @param [out] coll An std::vector containing all components.
1007 
1008  @return true Failure (error is reported).
1009  @return false Success.
1010  */
1011 
1012  template <typename T>
1013  [[nodiscard]] bool fetch_schema_components(const Schema *schema,
1014  Const_ptr_vec<T> *coll);
1015 
1016  /**
1017  Fetch all global components of the given type.
1018 
1019  @tparam T Type of components to get.
1020  @param [out] coll An std::vector containing all components.
1021 
1022  @return true Failure (error is reported).
1023  @return false Success.
1024  */
1025 
1026  template <typename T>
1027  [[nodiscard]] bool fetch_global_components(Const_ptr_vec<T> *coll);
1028 
1029  /**
1030  Check if a user is referenced as definer by some object of the given type.
1031 
1032  @tparam T Type of dictionary objects to check.
1033  @param user User name, including @ and host.
1034  @param [out] is_definer True if the user is referenced as definer
1035  by some object.
1036 
1037  @return true Failure (error is reported, is_definer is undefined).
1038  @return false Success.
1039  */
1040  template <typename T>
1041  [[nodiscard]] bool is_user_definer(const LEX_USER &user,
1042  bool *is_definer) const;
1043 
1044  /**
1045  Fetch Object ids of all the views referencing base table/ view/ stored
1046  function name specified in "schema"."name". The views are retrieved
1047  using READ_UNCOMMITTED reads as the views could be changed by the same
1048  statement (e.g. multi-table/-view RENAME TABLE).
1049 
1050  @tparam T Type of the object (View_table/View_routine)
1051  to retrieve view names for.
1052  @param schema Schema name.
1053  @param tbl_or_sf_name Base table/ View/ Stored function name.
1054  @param[out] view_ids Vector to store Object ids of all the views
1055  referencing schema.name.
1056 
1057  @return true Failure (error is reported).
1058  @return false Success.
1059  */
1060  template <typename T>
1061  [[nodiscard]] bool fetch_referencing_views_object_id(
1062  const char *schema, const char *tbl_or_sf_name,
1063  std::vector<Object_id> *view_ids) const;
1064 
1065  /**
1066  Fetch the names of tables (children) which have foreign keys
1067  defined to the given table (parent).
1068 
1069  @param parent_schema Schema name of parent table.
1070  @param parent_name Table name of parent table.
1071  @param parent_engine Storage engine of parent table.
1072  @param uncommitted Use READ_UNCOMMITTED isolation.
1073  @param[out] children_schemas Schema names of child tables.
1074  @param[out] children_names Table names of child tables.
1075 
1076  @return true Failure (error is reported).
1077  @return false Success.
1078 
1079  @note Child tables are identified by matching pairs of names.
1080 
1081  @note This is a temporary workaround until WL#6049. This function will
1082  *not* take any locks protecting against DDL changes. So the returned
1083  names could become invalid at any time - e.g. due to DROP DATABASE,
1084  DROP TABLE or DROP FOREIGN KEY.
1085  */
1086 
1087  [[nodiscard]] bool fetch_fk_children_uncached(
1088  const String_type &parent_schema, const String_type &parent_name,
1089  const String_type &parent_engine, bool uncommitted,
1090  std::vector<String_type> *children_schemas,
1091  std::vector<String_type> *children_names);
1092 
1093  /**
1094  Invalidate a cache entry.
1095 
1096  This function will acquire a table object based on the schema qualified
1097  table name, and call 'invalidate(table_object)'.
1098 
1099  @note This function only applies to tables yet.
1100 
1101  @param schema_name Name of the schema containing the table.
1102  @param table_name Name of the table.
1103 
1104  @retval false No error.
1105  @retval true Error (from handling a cache miss, or from
1106  failing to get an MDL lock).
1107  */
1108 
1109  [[nodiscard]] bool invalidate(const String_type &schema_name,
1110  const String_type &table_name);
1111 
1112  /**
1113  Invalidate a cache entry.
1114 
1115  This function will remove and delete an object from the shared cache,
1116  based on the id of the object. If the object id is present in the local
1117  object registry and the auto releaser, it will be removed from there as
1118  well.
1119 
1120  @note There is no particular consideration of already dropped or modified
1121  objects in this method.
1122 
1123  @tparam T Dictionary object type.
1124  @param object Object to be invalidated.
1125  */
1126 
1127  template <typename T>
1128  void invalidate(const T *object);
1129 
1130  /**
1131  Remove and delete an object from the cache and the dd tables.
1132 
1133  This function will remove the object from the local registry as well as
1134  the shared cache. This means that all keys associated with the object will
1135  be removed from the maps, and the cache element wrapper will be deleted.
1136  Afterwards, the object pointed to will also be deleted, and finally, the
1137  corresponding entry in the appropriate dd table is deleted. The object may
1138  not be accessed after calling this function.
1139 
1140  @sa invalidate()
1141 
1142  @note The object parameter is const since the contents of the object
1143  is not really changed, the object is just deleted. The method
1144  makes sure there is an exclusive meta data lock on the object
1145  name.
1146 
1147  @note The argument to this funcion may come from acquire(), and may
1148  be an instance that is present in the uncommitted registry,
1149  or in the committed registry. These use cases are handled by
1150  the implementation of the function. The ownership of the
1151  'object' is not changed, instead, a clone is created and
1152  added to the dropped registry.
1153 
1154  @tparam T Dictionary object type.
1155  @param object Object to be dropped.
1156 
1157  @retval false The operation was successful.
1158  @retval true There was an error.
1159  */
1160 
1161  template <typename T>
1162  [[nodiscard]] bool drop(const T *object);
1163 
1164  /**
1165  Store a new dictionary object.
1166 
1167  This function will write the object to the dd tables. The object is
1168  added neither to the dictionary client's object registry nor the shared
1169  cache.
1170 
1171  @note A precondition is that the object has not been acquired from the
1172  shared cache. For storing an object which is already in the cache,
1173  please use update().
1174 
1175  @note After calling store(), the submitted dictionary object can not be
1176  used for further calls to store(). It might be used as an argument
1177  to update(), but this is not recommended since calling update()
1178  will imply transferring object ownership to the dictionary client.
1179  Instead, please call 'acquire_for_modification()' to get a new
1180  object instance to use for modification and further updates.
1181 
1182  @tparam T Dictionary object type.
1183  @param object Object to be stored.
1184 
1185  @retval false The operation was successful.
1186  @retval true There was an error.
1187  */
1188 
1189  template <typename T>
1190  [[nodiscard]] bool store(T *object);
1191 
1192  /**
1193  Update a persisted dictionary object, but keep the shared cache unchanged.
1194 
1195  This function will store a dictionary object to the DD tables after
1196  verifying that an object with the same id already exists. The old object,
1197  which may be present in the shared dictionary cache, is not modified. To
1198  make the changes visible in the shared cache, please call
1199  remove_uncommuitted_objects().
1200 
1201  @note A precondition is that the object has been acquired from the
1202  shared cache indirectly by acquire_for_modification(). For storing
1203  an object which is not already in the cache, please use store().
1204 
1205  @note The new_object pointer submitted to this function, is owned by the
1206  auto delete vector. When registering the new object as an uncommitted
1207  object, the object must be removed from the auto delete vector.
1208 
1209  @tparam T Dictionary object type.
1210  @param new_object New object, not present in the cache, to be
1211  stored persistently.
1212 
1213  @retval false The operation was successful.
1214  @retval true There was an error.
1215  */
1216 
1217  template <typename T>
1218  [[nodiscard]] bool update(T *new_object);
1219 
1220  /**
1221  Remove the uncommitted objects from the client.
1222 
1223  Can also be used to explicitly throw the modified objects
1224  away before making any actions to compensate
1225  for a partially completed statement. Note that uncommitted objects
1226  are automatically removed once the topmost stack-allocated auto
1227  releaser goes out of scope, so calling this function in case of
1228  abort is only needed to make acquire return the old object again
1229  later in the same statement.
1230  */
1231 
1233 
1234  /**
1235  Remove the uncommitted objects from the client and put them into
1236  the shared cache, thereby making them visible to other clients.
1237  Should be called after commit to disk but before metadata locks
1238  are released.
1239  */
1240 
1241  void commit_modified_objects();
1242 
1243  /**
1244  Remove table statistics entries from mysql.table_stats and
1245  mysql.index_stats.
1246 
1247  @param schema_name Schema name of the table
1248  @param table_name Table name of which stats should be cleaned.
1249 
1250  @return true - on failure
1251  @return false - on success
1252  */
1253  [[nodiscard]] bool remove_table_dynamic_statistics(
1254  const String_type &schema_name, const String_type &table_name);
1255 
1256  /**
1257  Debug dump of a partition of the client and its registry to stderr.
1258 
1259  @tparam T Dictionary object type.
1260  */
1261 
1262  template <typename T>
1263  void dump() const;
1264 };
1265 
1266 } // namespace cache
1267 } // namespace dd
1268 
1269 // Functions declarations exported only to facilitate unit testing.
1273 } // namespace dd_cache_unittest
1274 
1275 #endif // DD_CACHE__DICTIONARY_CLIENT_INCLUDED
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
Base class for dictionary objects which has single column integer primary key.
Definition: entity_object.h:47
Definition: object_key.h:37
Definition: schema.h:62
Definition: table.h:46
Implementation of a dictionary client.
Definition: cache_element.h:68
Class to help releasing and deleting objects.
Definition: dictionary_client.h:176
void dump() const
Definition: dictionary_client.cc:820
Auto_releaser * m_prev
Definition: dictionary_client.h:182
~Auto_releaser()
Definition: dictionary_client.cc:776
Dictionary_client * m_client
Definition: dictionary_client.h:180
Object_registry m_release_registry
Definition: dictionary_client.h:181
Auto_releaser * remove(Cache_element< T > *element)
Remove an element from some auto releaser down the chain.
Auto_releaser()
Definition: dictionary_client.cc:758
void transfer_release(const T *object)
Transfer an object from the current to the previous auto releaser.
Definition: dictionary_client.cc:727
void auto_release(Cache_element< T > *element)
Register an object to be auto released.
Definition: dictionary_client.h:192
Definition: dictionary_client.h:148
THD * m_thd
Definition: dictionary_client.h:251
bool acquire_uncached(Object_id id, T **object)
Retrieve an object by its object id without caching it.
Definition: dictionary_client.cc:1179
Auto_releaser * m_current_releaser
Definition: dictionary_client.h:253
void dump() const
Debug dump of a partition of the client and its registry to stderr.
Definition: dictionary_client.cc:2925
bool fetch_referencing_views_object_id(const char *schema, const char *tbl_or_sf_name, std::vector< Object_id > *view_ids) const
Fetch Object ids of all the views referencing base table/ view/ stored function name specified in "sc...
Definition: dictionary_client.cc:2282
Object_registry m_registry_committed
Definition: dictionary_client.h:248
bool drop(const T *object)
Remove and delete an object from the cache and the dd tables.
Definition: dictionary_client.cc:2515
bool acquire_for_modification(Object_id id, T **object)
Retrieve an object by its object id.
Definition: dictionary_client.cc:1116
bool fetch_global_components(Const_ptr_vec< T > *coll)
Fetch all global components of the given type.
Definition: dictionary_client.cc:2236
bool fetch_fk_children_uncached(const String_type &parent_schema, const String_type &parent_name, const String_type &parent_engine, bool uncommitted, std::vector< String_type > *children_schemas, std::vector< String_type > *children_names)
Fetch the names of tables (children) which have foreign keys defined to the given table (parent).
Definition: dictionary_client.cc:2328
Object_registry m_registry_dropped
Definition: dictionary_client.h:250
~Dictionary_client()
Definition: dictionary_client.cc:1057
bool get_table_name_by_trigger_name(const Schema &schema, const String_type &trigger_name, String_type *table_name)
Retrieve a table name of a given trigger name and schema.
Definition: dictionary_client.cc:1870
bool check_foreign_key_exists(const Schema &schema, const String_type &foreign_key_name, bool *exists)
Check if schema contains foreign key with specified name.
Definition: dictionary_client.cc:1915
bool acquire(const K &key, const T **object, bool *local_committed, bool *local_uncommitted)
Get a dictionary object.
Definition: dictionary_client.cc:858
SPI_lru_cache_owner_ptr m_no_table_spids
Se-private ids known not to exist in either TABLES or PARTITIONS or both.
Definition: dictionary_client.h:259
bool acquire_uncached_table_by_se_private_id(const String_type &engine, Object_id se_private_id, Table **table)
Retrieve a table object by its se private id.
Definition: dictionary_client.cc:1556
Auto_releaser m_default_releaser
Definition: dictionary_client.h:252
std::vector< const T * > Const_ptr_vec
Definition: dictionary_client.h:475
bool fetch(Const_ptr_vec< Object_type > *coll, const Object_key *object_key)
Fetch objects from DD tables that match the supplied key.
Definition: dictionary_client.cc:2197
bool is_user_definer(const LEX_USER &user, bool *is_definer) const
Check if a user is referenced as definer by some object of the given type.
Definition: dictionary_client.cc:2248
bool acquire_uncached_table_by_partition_se_private_id(const String_type &engine, Object_id se_partition_id, Table **table)
Retrieve a table object by its partition se private id.
Definition: dictionary_client.cc:1605
std::vector< Entity_object * > m_uncached_objects
Definition: dictionary_client.h:247
bool store(T *object)
Store a new dictionary object.
Definition: dictionary_client.cc:2550
bool foreach(const Object_key *object_key, std::function< bool(std::unique_ptr< Object_type > &)> const &processor) const
Execute the submitted lambda function for each entity of the given type selected by the submitted key...
Definition: dictionary_client.cc:2120
void commit_modified_objects()
Remove the uncommitted objects from the client and put them into the shared cache,...
Definition: dictionary_client.cc:2909
bool fetch_schema_table_names_not_hidden_by_se(const Schema *schema, std::vector< String_type > *names) const
Fetch the names of the server tables in the schema.
Definition: dictionary_client.cc:2057
bool fetch_global_component_names(std::vector< String_type > *names) const
Fetch all global component names of the given type.
Definition: dictionary_client.cc:2019
bool update(T *new_object)
Update a persisted dictionary object, but keep the shared cache unchanged.
Definition: dictionary_client.cc:2600
bool remove_table_dynamic_statistics(const String_type &schema_name, const String_type &table_name)
Remove table statistics entries from mysql.table_stats and mysql.index_stats.
Definition: dictionary_client.cc:1696
void remove_uncommitted_objects(bool commit_to_shared_cache)
Remove the uncommitted objects from the client and (depending on the parameter) put them into the sha...
Definition: dictionary_client.cc:2787
bool fetch_schema_component_names(const Schema *schema, std::vector< String_type > *names) const
Fetch the names of the components in the schema.
Definition: dictionary_client.cc:2107
void rollback_modified_objects()
Remove the uncommitted objects from the client.
Definition: dictionary_client.cc:2896
bool fetch_schema_components(const Schema *schema, Const_ptr_vec< T > *coll)
Fetch all components in the schema.
Definition: dictionary_client.cc:2220
bool invalidate(const String_type &schema_name, const String_type &table_name)
Invalidate a cache entry.
Definition: dictionary_client.cc:2414
void register_dropped_object(T *object)
Transfer object ownership from caller to Dictionary_client, and register the object as dropped.
Definition: dictionary_client.cc:2724
bool check_constraint_exists(const Schema &schema, const String_type &check_cons_name, bool *exists)
Check if schema contains check constraint with specified name.
Definition: dictionary_client.cc:1940
Object_registry m_registry_uncommitted
Definition: dictionary_client.h:249
void auto_delete(T *object)
Register an uncached object to be auto deleted.
Definition: dictionary_client.h:368
bool acquire_uncached_uncommitted(Object_id id, T **object)
Retrieve a possibly uncommitted object by its object id without caching it.
Definition: dictionary_client.cc:1245
bool fetch_schema_table_names_by_engine(const Schema *schema, const String_type &engine, std::vector< String_type > *names) const
Fetch the names of the tables in the schema belonging to specific storage engine.
Definition: dictionary_client.cc:2038
void acquire_uncommitted(const K &key, T **object, bool *dropped)
Get an uncommitted dictionary object that can be modified safely.
Definition: dictionary_client.cc:943
size_t release(Object_registry *registry)
Mark all objects of a certain type as not being used by this client.
Definition: dictionary_client.cc:982
bool acquire_uncached_uncommitted_impl(Object_id id, T **object)
Auxiliary function to retrieve a possibly uncommitted object by its object id without caching it.
Definition: dictionary_client.cc:1196
void no_auto_delete(T *object)
Remove an object from the auto delete vector.
Definition: dictionary_client.h:397
bool get_table_name_by_se_private_id(const String_type &engine, Object_id se_private_id, String_type *schema_name, String_type *table_name)
Retrieve schema and table name by the se private id of the table.
Definition: dictionary_client.cc:1781
Dictionary_client(THD *thd)
Definition: dictionary_client.cc:1047
bool acquire_uncached_impl(Object_id id, T **object)
Auxiliary function to retrieve an object by its object id without caching it.It is responsibility of ...
Definition: dictionary_client.cc:1151
bool get_table_name_by_partition_se_private_id(const String_type &engine, Object_id se_partition_id, String_type *schema_name, String_type *table_name)
Retrieve schema and table name by the se private id of the partition.
Definition: dictionary_client.cc:1828
bool fetch_global_component_ids(std::vector< Object_id > *ids) const
Fetch all global component ids of the given type.
Definition: dictionary_client.cc:1999
void register_uncommitted_object(T *object)
Transfer object ownership from caller to Dictionary_client, and register the object as uncommitted.
Definition: dictionary_client.cc:2688
Object registry containing several maps.
Definition: object_registry.h:61
void put(Cache_element< T > *element)
Add a new element to the registry.
Definition: object_registry.h:278
void get(const K &key, Cache_element< T > **element) const
Get the element corresponding to the given key.
Definition: object_registry.h:262
A smart-pointer for managing an SPI_lru_cache even when it is only forward declared.
Definition: dictionary_client.h:60
SPI_lru_cache * m_spi_lru_cache
Definition: dictionary_client.h:61
~SPI_lru_cache_owner_ptr()
Calls delete on m_spi_lru_cache unless nullptr.
Definition: dictionary_client.cc:707
const SPI_lru_cache * operator->() const
Const overload which does not create cache on demand, but merely returns the pointer.
Definition: dictionary_client.h:78
SPI_lru_cache * operator->()
Creates cache on demand if m_spi_lru_cache is nullptr.
Definition: dictionary_client.cc:713
bool is_nullptr() const
Definition: dictionary_client.h:84
Inherit from an instantiation of the template to allow forward-declaring in Dictionary_client.
Definition: dictionary_client.cc:705
Header for compiler-dependent features.
#define MY_COMPILER_DIAGNOSTIC_PUSH()
save the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:295
#define MY_COMPILER_DIAGNOSTIC_POP()
restore the compiler's diagnostic (enabled warnings, errors, ...) state
Definition: my_compiler.h:296
#define MY_COMPILER_CLANG_WORKAROUND_TPARAM_DOCBUG()
ignore -Wdocumentation compiler warnings for @tparam.
Definition: my_compiler.h:318
char * user
Definition: mysqladmin.cc:59
bool is_cached(const SPI_lru_cache_owner_ptr &cache, Object_id id, SPI_missing_type t)
Definition: dictionary_client.cc:720
Definition: dictionary_client.h:1270
void insert(dd::cache::SPI_lru_cache_owner_ptr &c, dd::Object_id id)
Definition: dictionary_client.cc:3234
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
static mysql_service_status_t remove(reference_caching_channel channel, const char *implementation_name) noexcept
Definition: component.cc:144
const char * table_name
Definition: rules_table_service.cc:55
Definition: varlen_sort.h:183
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2162
static int exists(node_address *name, node_list const *nodes, u_int with_uid)
Definition: node_list.cc:105
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Definition: table.h:2561