MySQL 8.0.40
Source Code Documentation
dict0sdi.cc File Reference
#include <algorithm>
#include <current_thd.h>
#include <sql_class.h>
#include <sql_show.h>
#include <sql_table.h>
#include <sql_tablespace.h>
#include "api0api.h"
#include "api0misc.h"
#include "dict0boot.h"
#include "dict0crea.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "dict0sdi-decompress.h"
#include "dict0sdi.h"
#include "fsp0fsp.h"
#include "ha_innodb.h"
#include "trx0trx.h"

Functions

static dberr_t dict_sdi_exists (const dd::Tablespace &dd_space, uint32_t *space_id)
 Check if SDI Index exists in a tablespace. More...
 
static void dict_sdi_report_error (int errornum, const char *operation, const dd::Table *table, const dd::Tablespace &tablespace)
 Report error on failure. More...
 
static void dict_sdi_report_error (const char *operation, const dd::Table *table, const dd::Tablespace &tablespace)
 Report error on failure. More...
 
bool dict_sdi_create (dd::Tablespace *tablespace)
 Create SDI in a tablespace. More...
 
bool dict_sdi_drop (dd::Tablespace *)
 Drop SDI in a tablespace. More...
 
bool dict_sdi_get_keys (const dd::Tablespace &tablespace, sdi_vector_t &vector)
 Get the SDI keys in a tablespace into the vector provided. More...
 
bool dict_sdi_get (const dd::Tablespace &, const sdi_key_t *, void *, uint64_t *)
 Retrieve SDI from tablespace. More...
 
bool dict_sdi_set (handlerton *hton, const dd::Tablespace &tablespace, const dd::Table *table, const sdi_key_t *sdi_key, const void *sdi, uint64_t sdi_len)
 Insert/Update SDI in tablespace. More...
 
bool dict_sdi_delete (const dd::Tablespace &tablespace, const dd::Table *table, const sdi_key_t *sdi_key)
 Delete SDI from tablespace. More...
 

Function Documentation

◆ dict_sdi_create()

bool dict_sdi_create ( dd::Tablespace tablespace)

Create SDI in a tablespace.

This API should be used when upgrading a tablespace with no SDI.

Parameters
[in,out]tablespacetablespace object
Return values
falsesuccess
truefailure

◆ dict_sdi_delete()

bool dict_sdi_delete ( const dd::Tablespace tablespace,
const dd::Table table,
const sdi_key_t sdi_key 
)

Delete SDI from tablespace.

Parameters
[in]tablespacetablespace object
[in]tabletable object
[in]sdi_keySDI key to uniquely identify the tablespace object
Return values
falsesuccess
truefailure

◆ dict_sdi_drop()

bool dict_sdi_drop ( dd::Tablespace tablespace)

Drop SDI in a tablespace.

This API should be used only when SDI is corrupted.

Parameters
[in,out]tablespacetablespace object
Return values
falsesuccess
truefailure

◆ dict_sdi_exists()

static dberr_t dict_sdi_exists ( const dd::Tablespace dd_space,
uint32_t *  space_id 
)
static

Check if SDI Index exists in a tablespace.

Parameters
[in]dd_spaceDD tablespace object
[in,out]space_idspace_id from tablespace object
Returns
DB_SUCCESS if SDI exists, else return DB_ERROR, DB_TABLESPACE_NOT_FOUND

◆ dict_sdi_get()

bool dict_sdi_get ( const dd::Tablespace tablespace,
const sdi_key_t sdi_key,
void *  sdi,
uint64_t *  sdi_len 
)

Retrieve SDI from tablespace.

Parameters
[in]tablespacetablespace object
[in]sdi_keySDI key
[in,out]sdiSDI retrieved from tablespace
[in,out]sdi_lenin: size of memory allocated out: actual length of SDI
Return values
falsesuccess
truein case of failures like record not found, sdi_len is UINT64MAX_T, else sdi_len is actual length of SDI

◆ dict_sdi_get_keys()

bool dict_sdi_get_keys ( const dd::Tablespace tablespace,
sdi_vector_t vector 
)

Get the SDI keys in a tablespace into the vector provided.

Parameters
[in]tablespacetablespace object
[in,out]vectorvector to hold SDI keys
Return values
falsesuccess
truefailure

◆ dict_sdi_report_error() [1/2]

static void dict_sdi_report_error ( const char *  operation,
const dd::Table table,
const dd::Tablespace tablespace 
)
static

Report error on failure.

Calls dict_sdi_report_error(int errornum, const char *operation, const dd::Table *table, const dd::Tablespace &tablespace) with errornum=SDI_OPERATION_FAILED (for compatibility with existing code).

Parameters
[in]operationSDI set or delete
[in]tabletable object for which SDI is serialized
[in]tablespacetablespace where SDI is stored

◆ dict_sdi_report_error() [2/2]

static void dict_sdi_report_error ( int  errornum,
const char *  operation,
const dd::Table table,
const dd::Tablespace tablespace 
)
static

Report error on failure.

Parameters
[in]errornumMySQL error number (for my_error()) (Must take 4 string arguments, in the same way as ER_SDI_OPERATION_FAILED)
[in]operationSDI set or delete
[in]tabletable object for which SDI is serialized
[in]tablespacetablespace where SDI is stored

◆ dict_sdi_set()

bool dict_sdi_set ( handlerton hton,
const dd::Tablespace tablespace,
const dd::Table table,
const sdi_key_t sdi_key,
const void *  sdi,
uint64_t  sdi_len 
)

Insert/Update SDI in tablespace.

Parameters
[in]htonhandlerton object
[in]tablespacetablespace object
[in]tabletable object
[in]sdi_keySDI key to uniquely identify the tablespace object
[in]sdiSDI to be stored in tablespace
[in]sdi_lenSDI length
Return values
falsesuccess
truefailure