MySQL 8.0.39
Source Code Documentation
opt_costconstantcache.cc File Reference
#include "sql/opt_costconstantcache.h"
#include <memory>
#include "m_ctype.h"
#include "m_string.h"
#include "my_dbug.h"
#include "my_loglevel.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysqld_error.h"
#include "sql/current_thd.h"
#include "sql/dd/upgrade_57/upgrade.h"
#include "sql/field.h"
#include "sql/iterators/row_iterator.h"
#include "sql/mysqld.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_executor.h"
#include "sql/sql_lex.h"
#include "sql/sql_tmp_table.h"
#include "sql/table.h"
#include "sql/transaction.h"
#include "sql_string.h"
#include "template_utils.h"
#include "thr_lock.h"
#include "thr_mutex.h"

Functions

static void read_cost_constants (Cost_model_constants *cost_constants)
 Read the cost configuration tables and update the cost constant set. More...
 
static void report_server_cost_warnings (const LEX_CSTRING &cost_name, double value, cost_constant_error error)
 Write warnings about illegal entries in the server_cost table. More...
 
static void report_engine_cost_warnings (const LEX_CSTRING &se_name, int storage_category, const LEX_CSTRING &cost_name, double value, cost_constant_error error)
 Write warnings about illegal entries in the engine_cost table. More...
 
static void read_server_cost_constants (THD *thd, TABLE *table, Cost_model_constants *cost_constants)
 Read the table that contains the cost constants for the server. More...
 
static void read_engine_cost_constants (THD *thd, TABLE *table, Cost_model_constants *cost_constants)
 Read the table that contains the cost constants for the storage engines. More...
 
void init_optimizer_cost_module (bool enable_plugins)
 Initializes the optimizer cost module. More...
 
void delete_optimizer_cost_module ()
 Deletes the optimizer cost module. More...
 
void reload_optimizer_cost_constants ()
 Reloads the optimizer cost constants from the cost constant tables. More...
 

Variables

Cost_constant_cachecost_constant_cache = nullptr
 

Function Documentation

◆ delete_optimizer_cost_module()

void delete_optimizer_cost_module ( )

Deletes the optimizer cost module.

This should be called when the server stops to release allocated resources.

◆ init_optimizer_cost_module()

void init_optimizer_cost_module ( bool  enable_plugins)

Initializes the optimizer cost module.

This should be done during startup from mysqld.cc.

◆ read_cost_constants()

static void read_cost_constants ( Cost_model_constants cost_constants)
static

Read the cost configuration tables and update the cost constant set.

The const constant set must be initialized with default values when calling this function.

Parameters
cost_constantsset with cost constants

◆ read_engine_cost_constants()

static void read_engine_cost_constants ( THD thd,
TABLE table,
Cost_model_constants cost_constants 
)
static

Read the table that contains the cost constants for the storage engines.

The table must already be opened. The cost constant object is updated with cost constants found in the configuration table.

Parameters
thdthe THD
tablethe table to read from
[in,out]cost_constantscost constant object

◆ read_server_cost_constants()

static void read_server_cost_constants ( THD thd,
TABLE table,
Cost_model_constants cost_constants 
)
static

Read the table that contains the cost constants for the server.

The table must already be opened. The cost constant object is updated with cost constants found in the configuration table.

Parameters
thdthe THD
tablethe table to read from
[in,out]cost_constantscost constant object

◆ reload_optimizer_cost_constants()

void reload_optimizer_cost_constants ( )

Reloads the optimizer cost constants from the cost constant tables.

Note
In order to read the cost constant tables, a THD is needed. This function will create a new temporary THD that will be used for this. In case the caller already has a THD this will not be used.

◆ report_engine_cost_warnings()

static void report_engine_cost_warnings ( const LEX_CSTRING se_name,
int  storage_category,
const LEX_CSTRING cost_name,
double  value,
cost_constant_error  error 
)
static

Write warnings about illegal entries in the engine_cost table.

The warnings are written to the MySQL error log.

Parameters
se_namename of storage engine
storage_categorydevice type
cost_namename of the cost constant
valuevalue it was attempted set to
errorerror status

◆ report_server_cost_warnings()

static void report_server_cost_warnings ( const LEX_CSTRING cost_name,
double  value,
cost_constant_error  error 
)
static

Write warnings about illegal entries in the server_cost table.

The warnings are written to the MySQL error log.

Parameters
cost_namename of the cost constant
valuevalue it was attempted set to
errorerror status

Variable Documentation

◆ cost_constant_cache

Cost_constant_cache* cost_constant_cache = nullptr