MySQL 9.1.0
Source Code Documentation

Definition of externally visible functions and classes, declared in sdi.h. More...

Collaboration diagram for SDI API:

Namespaces

namespace  dd::anonymous_namespace{sdi.cc}
 
namespace  dd::sdi
 
namespace  dd::sdi::anonymous_namespace{sdi.cc}
 

Typedefs

using dd::anonymous_namespace{sdi.cc}::DC = dd::cache::Dictionary_client
 
using dd::anonymous_namespace{sdi.cc}::AR = dd::cache::Dictionary_client::Auto_releaser
 

Functions

 dd::Sdi_wcontext::Sdi_wcontext (THD *thd, const String_type *schema_name)
 
bool dd::Sdi_wcontext::error () const
 
void dd::Sdi_wcontext::set_error ()
 
THDdd::Sdi_wcontext::thd () const
 
 dd::Sdi_rcontext::Sdi_rcontext (THD *thd, uint target_dd_version, std::uint64_t sdi_version)
 
bool dd::Sdi_rcontext::error () const
 
template<typename DDT >
static handlertondd::anonymous_namespace{sdi.cc}::resolve_hton (THD *thd, const DDT &ddt)
 Templated convenience wrapper which first attempts to resolve the handlerton using the data dictionary object's engine() string. More...
 
template<class AKT , class CLOS >
bool dd::anonymous_namespace{sdi.cc}::with_schema (THD *thd, const AKT &key, CLOS &&clos)
 Covenience function for acquiring the schema and invoking a closure which uses the schema object. More...
 
template<class CHAR_IT >
bool dd::anonymous_namespace{sdi.cc}::equal_prefix_chars (CHAR_IT &&begin1, CHAR_IT &&end1, CHAR_IT &&begin2, CHAR_IT &&end2, size_t n, const CHARSET_INFO *csi=system_charset_info)
 Predicate which returns true if an n-character prefix of two character ranges are equal. More...
 
template<class DDT >
bool dd::anonymous_namespace{sdi.cc}::equal_prefix_chars_name (const DDT &a, const DDT &b, size_t prefix_chars)
 Convenience function for comparing a prefix of the names of two DD objects. More...
 
bool dd::sdi::store (THD *thd, const Tablespace *ts)
 Stores the SDI for a table space. More...
 
template<typename DDT >
bool dd::sdi::anonymous_namespace{sdi.cc}::drop_all_impl (THD *thd, const DDT *tp)
 
bool dd::sdi::drop_all_for_table (THD *, const Table *)
 Drop all SDIs from all tablespaces associated with table. More...
 
bool dd::sdi::drop_all_for_part (THD *, const Partition *)
 Drop all SDIs from all tablespaces associated with partition or sub-partition. More...
 
dd::Sdi_wcontext sdi_unittest::drv_wctx (nullptr, &drv_s)
 
dd::Sdi_wcontextsdi_unittest::get_wctx ()
 
dd::Sdi_rcontextsdi_unittest::get_rctx ()
 
bool sdi_unittest::equal_prefix_chars_driver (const dd::String_type &a, const dd::String_type &b, size_t prefix)
 

Variables

Byte_buffer dd::Sdi_wcontext::m_buf
 A reusable byte buffer for e.g. More...
 
THDdd::Sdi_wcontext::m_thd
 Thread context. More...
 
const String_typedd::Sdi_wcontext::m_schema_name
 Pointer to schema name to use for schema references in SDI. More...
 
bool dd::Sdi_wcontext::m_error
 Flag indicating that an error has occurred. More...
 
Byte_buffer dd::Sdi_rcontext::buf
 A reusable byte buffer for e.g. More...
 
dd_vector< Column * > dd::Sdi_rcontext::m_column_object_opx
 Column objects created during deserialization. More...
 
dd_vector< Index * > dd::Sdi_rcontext::m_index_object_opx
 Index objects created during deserialization. More...
 
THDdd::Sdi_rcontext::m_thd
 Thread context. More...
 
uint dd::Sdi_rcontext::m_target_dd_version
 Target dd version from SDI. More...
 
std::uint64_t dd::Sdi_rcontext::m_sdi_version
 Sdi version from SDI. More...
 
bool dd::Sdi_rcontext::m_error
 Flag indicating that an error has occurred. More...
 
String_type dd::Sdi_rcontext::m_schema_name
 
dd::String_type sdi_unittest::drv_s = "driver_schema"
 
dd::Sdi_rcontext sdi_unittest::drv_rctx (nullptr, 0, 0)
 

Friends

char * dd::Sdi_wcontext::buf_handle (Sdi_wcontext *wctx, size_t sz)
 Return a non-owning pointer to a char buffer which can be used for e.g. More...
 
const String_typedd::Sdi_wcontext::lookup_schema_name (Sdi_wcontext *wctx)
 Returns const reference to string holding schema name to use in SDI. More...
 
void dd::Sdi_rcontext::track_object (Sdi_rcontext *rctx, Column *column_object)
 Register Column objects being deserialized so that it will be possible to resolve references to it after deserialization has finished. More...
 
void dd::Sdi_rcontext::track_object (Sdi_rcontext *rctx, Index *index_object)
 Register Index objects being deserialized so that it will be possible to resolve references to it after deserialization has finished. More...
 
Indexdd::Sdi_rcontext::get_by_opx (Sdi_rcontext *rctx, const Index *, uint opx)
 Return an non-owning raw pointer to the deserialized Index object with ordinal position index opx (ordinal position opx+1). More...
 
Columndd::Sdi_rcontext::get_by_opx (Sdi_rcontext *rctx, const Column *, uint opx)
 Return an non-owning raw pointer to the deserialized Column object with ordinal position index opx (ordinal position opx+1). More...
 
char * dd::Sdi_rcontext::buf_handle (Sdi_rcontext *rctx, size_t sz)
 Return a non-owning pointer to a char buffer which can be used for e.g. More...
 
bool dd::Sdi_rcontext::lookup_schema_ref (Sdi_rcontext *rctx, const String_type &name, dd::Object_id *idp)
 Return the the Object_id of a schema name in the current data dictionary. More...
 
bool dd::Sdi_rcontext::lookup_tablespace_ref (Sdi_rcontext *rctx, const String_type &name, Object_id *idp)
 Return the the Object_id of a tablespace name in the current data dictionary. More...
 
Sdi_type dd::serialize (const Tablespace &tablespace)
 Serialize a Tablespace object. More...
 
bool dd::CheckDefaultCompatibility (const RJ_Document &doc)
 Default checker which implements the traditional (strict) compatibility check: MYSQL_VERSION less than or equal, dd_version equal, and sdi_version equal. More...
 
template<class Dd_type >
bool dd::generic_deserialize (THD *thd, const Sdi_type &sdi, const String_type &object_type_name, Dd_type *dst, const SdiCompatibilityChecker &comp_checker, String_type *schema_name_from_sdi)
 
bool dd::deserialize (THD *thd, const Sdi_type &sdi, Table *dst_table, SdiCompatibilityChecker comp_checker, String_type *deser_schema_name)
 Deserialize a dd::Table object. More...
 
bool dd::deserialize (THD *thd, const Sdi_type &sdi, Tablespace *dst_tablespace, SdiCompatibilityChecker comp_checker)
 Deserialize a dd::Tablespace object. More...
 

Detailed Description

Definition of externally visible functions and classes, declared in sdi.h.

Typedef Documentation

◆ AR

using dd::anonymous_namespace{sdi.cc}::AR = typedef dd::cache::Dictionary_client::Auto_releaser

◆ DC

using dd::anonymous_namespace{sdi.cc}::DC = typedef dd::cache::Dictionary_client

Function Documentation

◆ Sdi_rcontext()

dd::Sdi_rcontext::Sdi_rcontext ( THD thd,
uint  target_dd_version,
std::uint64_t  sdi_version 
)
inline

◆ Sdi_wcontext()

dd::Sdi_wcontext::Sdi_wcontext ( THD thd,
const String_type schema_name 
)
inline

◆ CheckDefaultCompatibility()

bool dd::CheckDefaultCompatibility ( const RJ_Document doc)

Default checker which implements the traditional (strict) compatibility check: MYSQL_VERSION less than or equal, dd_version equal, and sdi_version equal.

◆ deserialize() [1/2]

bool dd::deserialize ( THD thd,
const Sdi_type sdi,
Table dst_table,
SdiCompatibilityChecker  comp_checker,
String_type deser_schema_name 
)

Deserialize a dd::Table object.

Populates the dd::Table object provided with data from sdi string. Note! Additional objects are dynamically allocated and added to the top-level Schema object, which assumes ownership.

Parameters
thdthread context
sdiserialized representation of schema (as a json string)
dst_tableempty top-level object
comp_checkercallable which will be used to determine if the SDI is compatible
deser_schema_namename of schema containing the table
Returns
error status
Return values
falseif successful
trueotherwise

◆ deserialize() [2/2]

bool dd::deserialize ( THD thd,
const Sdi_type sdi,
Tablespace dst_tablespace,
SdiCompatibilityChecker  comp_checker 
)

Deserialize a dd::Tablespace object.

Populates the dd::Tablespace object provided with data from sdi string. Note! Additional objects are dynamically allocated and added to the top-level Tablespace object, which assumes ownership.

Parameters
thdthread context
sdiserialized representation of schema (as a json string)
dst_tablespaceempty top-level object
comp_checkercallable which will be used to determine if the SDI is compatible.
Returns
error status
Return values
falseif successful
trueotherwise

◆ drop_all_for_part()

bool dd::sdi::drop_all_for_part ( THD ,
const Partition  
)

Drop all SDIs from all tablespaces associated with partition or sub-partition.

For a top-level partition of a sub-partitioned table, SDIs are removed for all sub-partitions of that partition.

◆ drop_all_for_table()

bool dd::sdi::drop_all_for_table ( THD ,
const Table  
)

Drop all SDIs from all tablespaces associated with table.

For a partitioned table SDIs are deleted from all the partition tablespaces.

◆ drop_all_impl()

template<typename DDT >
bool dd::sdi::anonymous_namespace{sdi.cc}::drop_all_impl ( THD thd,
const DDT *  tp 
)

◆ drv_wctx()

dd::Sdi_wcontext sdi_unittest::drv_wctx ( nullptr  ,
drv_s 
)

◆ equal_prefix_chars()

template<class CHAR_IT >
bool dd::anonymous_namespace{sdi.cc}::equal_prefix_chars ( CHAR_IT &&  begin1,
CHAR_IT &&  end1,
CHAR_IT &&  begin2,
CHAR_IT &&  end2,
size_t  n,
const CHARSET_INFO csi = system_charset_info 
)

Predicate which returns true if an n-character prefix of two character ranges are equal.

Parameters
begin1beginning of first range
end1end of first range
begin2beginning of second range
end2end of second range
nnumber of characters to compare
csicharacter set to use (defaults to system_charset_info)
Returns
true if prefix compares equal, false otherwise

◆ equal_prefix_chars_driver()

bool sdi_unittest::equal_prefix_chars_driver ( const dd::String_type a,
const dd::String_type b,
size_t  prefix 
)

◆ equal_prefix_chars_name()

template<class DDT >
bool dd::anonymous_namespace{sdi.cc}::equal_prefix_chars_name ( const DDT &  a,
const DDT &  b,
size_t  prefix_chars 
)

Convenience function for comparing a prefix of the names of two DD objects.

Parameters
afirst DD object
bsecond DD object
prefix_charsnumber characters in prefix to compare
Returns
true if prefix compares equal, false otherwise

◆ error() [1/2]

bool dd::Sdi_wcontext::error ( ) const
inline

◆ error() [2/2]

bool dd::Sdi_rcontext::error ( ) const
inline

◆ generic_deserialize()

template<class Dd_type >
bool dd::generic_deserialize ( THD thd,
const Sdi_type sdi,
const String_type object_type_name,
Dd_type *  dst,
const SdiCompatibilityChecker comp_checker,
String_type schema_name_from_sdi 
)

◆ get_rctx()

dd::Sdi_rcontext * sdi_unittest::get_rctx ( )

◆ get_wctx()

dd::Sdi_wcontext * sdi_unittest::get_wctx ( )

◆ resolve_hton()

template<typename DDT >
static handlerton * dd::anonymous_namespace{sdi.cc}::resolve_hton ( THD thd,
const DDT &  ddt 
)
static

Templated convenience wrapper which first attempts to resolve the handlerton using the data dictionary object's engine() string.

Parameters
thdthread context
ddtData dictionary object
Returns
handlerton pointer for this object
Return values
handlertonpointer on success
nullptron error

◆ serialize()

Sdi_type dd::serialize ( const Tablespace tablespace)

Serialize a Tablespace object.

Parameters
tablespaceobject which will be serialized
Returns
sdi (as json string).

◆ set_error()

void dd::Sdi_wcontext::set_error ( )
inline

◆ store()

bool dd::sdi::store ( THD thd,
const Tablespace ts 
)

Stores the SDI for a table space.

Serializes the table space object, and then forwards to SE through handlerton api, or falls back to storing the sdi string in an .SDI file in the default case.

Parameters
thdthread context
tsTablespace object.
Returns
error status
Return values
falseon success
trueotherwise

◆ thd()

THD * dd::Sdi_wcontext::thd ( ) const
inline

◆ with_schema()

template<class AKT , class CLOS >
bool dd::anonymous_namespace{sdi.cc}::with_schema ( THD thd,
const AKT &  key,
CLOS &&  clos 
)

Covenience function for acquiring the schema and invoking a closure which uses the schema object.

Parameters
thdthread context
keykey to use when acquiring Schema object
closclosure to invoke with the Schema object
Returns
error status
Return values
falseon success
trueotherwise

Variable Documentation

◆ buf

Byte_buffer dd::Sdi_rcontext::buf
private

A reusable byte buffer for e.g.

base64 decoding.

◆ drv_rctx

dd::Sdi_rcontext sdi_unittest::drv_rctx(nullptr, 0, 0) ( nullptr  ,
,
 
)

◆ drv_s

dd::String_type sdi_unittest::drv_s = "driver_schema"

◆ m_buf

Byte_buffer dd::Sdi_wcontext::m_buf
private

A reusable byte buffer for e.g.

base64 encoding.

◆ m_column_object_opx

dd_vector<Column *> dd::Sdi_rcontext::m_column_object_opx
private

Column objects created during deserialization.

◆ m_error [1/2]

bool dd::Sdi_wcontext::m_error
private

Flag indicating that an error has occurred.

◆ m_error [2/2]

bool dd::Sdi_rcontext::m_error
private

Flag indicating that an error has occurred.

◆ m_index_object_opx

dd_vector<Index *> dd::Sdi_rcontext::m_index_object_opx
private

Index objects created during deserialization.

◆ m_schema_name [1/2]

const String_type* dd::Sdi_wcontext::m_schema_name
private

Pointer to schema name to use for schema references in SDI.

◆ m_schema_name [2/2]

String_type dd::Sdi_rcontext::m_schema_name

◆ m_sdi_version

std::uint64_t dd::Sdi_rcontext::m_sdi_version
private

Sdi version from SDI.

◆ m_target_dd_version

uint dd::Sdi_rcontext::m_target_dd_version
private

Target dd version from SDI.

◆ m_thd [1/2]

THD* dd::Sdi_wcontext::m_thd
private

Thread context.

◆ m_thd [2/2]

THD* dd::Sdi_rcontext::m_thd
private

Thread context.

Friends

◆ buf_handle [1/2]

char * buf_handle ( Sdi_rcontext rctx,
size_t  sz 
)
friend

Return a non-owning pointer to a char buffer which can be used for e.g.

base64 encoding.

Parameters
rctxopaque context
szsize of buffer
Returns
non-owning pointer to buffer

◆ buf_handle [2/2]

char * buf_handle ( Sdi_wcontext wctx,
size_t  sz 
)
friend

Return a non-owning pointer to a char buffer which can be used for e.g.

base64 encoding.

Parameters
wctxopaque context.
szsize of buffer.

◆ get_by_opx [1/2]

Column * get_by_opx ( Sdi_rcontext rctx,
const Column ,
uint  opx 
)
friend

Return an non-owning raw pointer to the deserialized Column object with ordinal position index opx (ordinal position opx+1).

The unused const Column* argument is needed for overload resolution.

Parameters
rctxopaque context
opxordinal position index

◆ get_by_opx [2/2]

Index * get_by_opx ( Sdi_rcontext rctx,
const Index ,
uint  opx 
)
friend

Return an non-owning raw pointer to the deserialized Index object with ordinal position index opx (ordinal position opx+1).

The unused const Index* argument is needed for overload resolution.

Parameters
rctxopaque context
opxordinal position index

◆ lookup_schema_name

const String_type & lookup_schema_name ( Sdi_wcontext wctx)
friend

Returns const reference to string holding schema name to use in SDI.

Parameters
wctxopaque context.
Returns
schema name to use.

◆ lookup_schema_ref

bool lookup_schema_ref ( Sdi_rcontext rctx,
const String_type name,
dd::Object_id idp 
)
friend

Return the the Object_id of a schema name in the current data dictionary.

Used to recreate a reference to a schema during deserialization.

Parameters
rctxopaque context.
nameschema name used as reference.
idp[OUT] pointer to Object_id variable where result is stored.
Returns
MySQL error handling.

◆ lookup_tablespace_ref

bool lookup_tablespace_ref ( Sdi_rcontext rctx,
const String_type name,
Object_id idp 
)
friend

Return the the Object_id of a tablespace name in the current data dictionary.

Used to recreate a reference to a tablespace during deserialization.

Parameters
rctxopaque context.
nameschema name used as reference.
idp[OUT] pointer to Object_id variable where result is stored.
Returns
MySQL error handling.

◆ track_object [1/2]

void track_object ( Sdi_rcontext rctx,
Column column_object 
)
friend

Register Column objects being deserialized so that it will be possible to resolve references to it after deserialization has finished.

Parameters
rctxopaque context
column_objectobject which may be referenced by other objects.

◆ track_object [2/2]

void track_object ( Sdi_rcontext rctx,
Index index_object 
)
friend

Register Index objects being deserialized so that it will be possible to resolve references to it after deserialization has finished.

Parameters
rctxopaque context
index_objectobject which may be referenced by other objects.