MySQL 9.1.0
Source Code Documentation
resource_group_sql_cmd.cc File Reference
#include "sql/resourcegroups/resource_group_sql_cmd.h"
#include <stdint.h>
#include <string.h>
#include <memory>
#include <new>
#include <string>
#include <utility>
#include <vector>
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "mysql/components/services/bits/psi_thread_bits.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "pfs_thread_provider.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/current_thd.h"
#include "sql/dd/cache/dictionary_client.h"
#include "sql/dd/dd_resource_group.h"
#include "sql/dd/string_type.h"
#include "sql/derror.h"
#include "sql/lock.h"
#include "sql/mdl.h"
#include "sql/mysqld_thd_manager.h"
#include "sql/parse_tree_helpers.h"
#include "sql/resourcegroups/resource_group.h"
#include "sql/resourcegroups/resource_group_mgr.h"
#include "sql/resourcegroups/thread_resource_control.h"
#include "sql/sql_backup_lock.h"
#include "sql/sql_class.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/system_variables.h"
#include "sql/thd_raii.h"
#include "string_with_len.h"

Classes

class  anonymous_namespace{resource_group_sql_cmd.cc}::Move_thread_to_default_group
 This class represents a functional call to move a thread specified by pfs_thread_id to a resource group specified in class' constructor. More...
 

Namespaces

namespace  dd
 The version of the current data dictionary table definitions.
 
namespace  anonymous_namespace{resource_group_sql_cmd.cc}
 

Functions

static bool anonymous_namespace{resource_group_sql_cmd.cc}::acquire_exclusive_mdl_for_resource_group (THD *thd, const char *res_grp_name)
 Acquire an exclusive MDL lock on resource group name. More...
 
bool anonymous_namespace{resource_group_sql_cmd.cc}::validate_vcpu_range_vector (std::vector< resourcegroups::Range > *vcpu_range_vector, const Mem_root_array< resourcegroups::Range > *cpu_list, uint32_t num_vcpus)
 Validate CPU id ranges provided by a user in the statements CREATE RESOURCE GROUP, ALTER RESOURCE GROUP. More...
 
bool anonymous_namespace{resource_group_sql_cmd.cc}::is_default_resource_group (const char *res_grp_name)
 Check if given resource group name is a default resource group. More...
 
static resourcegroups::Resource_groupcheck_and_load_resource_group (THD *thd, const LEX_CSTRING &resource_group_name)
 Check if a resource group specified by a name is present in memory. More...
 
static bool check_and_apply_resource_grp (THD *thd, ulonglong thread_id, resourcegroups::Resource_group *resource_group, bool error)
 Check if resource group controls can be applied to thread identified by PFS thread id. More...
 
static bool check_resource_group_set_privilege (Security_context *sctx)
 Check if user has sufficient privilege to exercise SET RESOURCE GROUP. More...
 

Function Documentation

◆ check_and_apply_resource_grp()

static bool check_and_apply_resource_grp ( THD thd,
ulonglong  thread_id,
resourcegroups::Resource_group resource_group,
bool  error 
)
inlinestatic

Check if resource group controls can be applied to thread identified by PFS thread id.

Apply the controls to thread if the checks were successful.

Parameters
thdTHD context
thread_idThread id of the thread.
resource_groupPointer to resource group.
errorLog error so that error is returned to client.
Returns
true if the function fails else false.

◆ check_and_load_resource_group()

static resourcegroups::Resource_group * check_and_load_resource_group ( THD thd,
const LEX_CSTRING resource_group_name 
)
inlinestatic

Check if a resource group specified by a name is present in memory.

Load a resource group from the Data Dictionary if it missed in memory.

Parameters
thdTHD context.
resource_group_nameResource group name.
Returns
nullptr in case of error, else return a pointer to an instance of class resourcegroups::Resource_group.
Note
in case nullptr is returned an error is set in Diagnostics_area.

◆ check_resource_group_set_privilege()

static bool check_resource_group_set_privilege ( Security_context sctx)
static

Check if user has sufficient privilege to exercise SET RESOURCE GROUP.

Parameters
sctxPointer to security context.
Returns
true if sufficient privilege exists for SET RESOURCE GROUP else false.