Commit 2a4e8813 authored by Sergei Golubchik's avatar Sergei Golubchik

GLOBAL_VALUE_ORIGIN=AUTO

parent 3fa8c279
......@@ -412,7 +412,7 @@ The following options may be given as the first argument:
Maximum number of prepared statements in the server
--max-relay-log-size=#
relay log will be rotated automatically when the size
exceeds this value. If 0 are startup, it's set to
exceeds this value. If 0 at startup, it's set to
max_binlog_size
--max-seeks-for-key=#
Limit assumed max number of seeks when looking up rows
......
......@@ -1866,7 +1866,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_LONG_DATA_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 1048576
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
......@@ -3784,7 +3784,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME THREAD_HANDLING
SESSION_VALUE NULL
GLOBAL_VALUE no-threads
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE one-thread-per-connection
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
......
......@@ -2020,7 +2020,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_LONG_DATA_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 1048576
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
......@@ -2048,11 +2048,11 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME MAX_RELAY_LOG_SIZE
SESSION_VALUE 1073741824
GLOBAL_VALUE 1073741824
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 1073741824
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT relay log will be rotated automatically when the size exceeds this value. If 0 are startup, it's set to max_binlog_size
VARIABLE_COMMENT relay log will be rotated automatically when the size exceeds this value. If 0 at startup, it's set to max_binlog_size
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 1073741824
NUMERIC_BLOCK_SIZE 4096
......@@ -3336,7 +3336,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME RELAY_LOG
SESSION_VALUE NULL
GLOBAL_VALUE mysqld-relay-bin
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
......@@ -3350,7 +3350,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME RELAY_LOG_INDEX
SESSION_VALUE NULL
GLOBAL_VALUE mysqld-relay-bin.index
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
......@@ -3560,7 +3560,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME REPORT_PORT
SESSION_VALUE NULL
GLOBAL_VALUE MASTER_MYPORT
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
......@@ -3784,7 +3784,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_LOAD_TMPDIR
SESSION_VALUE NULL
GLOBAL_VALUE PATH
GLOBAL_VALUE_ORIGIN COMPILE-TIME
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
......
This diff is collapsed.
......@@ -964,7 +964,6 @@ static void store_var(Field *field, sys_var *var, enum_var_type scope,
var->value_ptr(field->table->in_use, scope, &null_lex_str));
}
int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
{
char name_buffer[NAME_CHAR_LEN];
......@@ -1010,7 +1009,8 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
{ STRING_WITH_LEN("CONFIG") },
{ STRING_WITH_LEN("AUTO") },
{ STRING_WITH_LEN("SQL") },
{ STRING_WITH_LEN("COMPILE-TIME") }
{ STRING_WITH_LEN("COMPILE-TIME") },
{ STRING_WITH_LEN("ENVIRONMENT") }
};
const LEX_CSTRING *origin= origins + var->value_origin;
fields[3]->store(origin->str, origin->length, scs);
......@@ -1144,3 +1144,30 @@ end:
return res;
}
/*
This is a simple and inefficient helper that sets sys_var::value_origin
for a specific sysvar.
It should *only* be used on server startup, if you need to do this later,
get yourself a pointer to your sysvar (see e.g. Sys_autocommit_ptr)
and update it directly.
*/
void mark_sys_var_value_origin(void *ptr, enum sys_var::where here)
{
bool found= false;
DBUG_ASSERT(!mysqld_server_started); // only to be used during startup
for (uint i= 0; i < system_variable_hash.records; i++)
{
sys_var *var= (sys_var*) my_hash_element(&system_variable_hash, i);
if (var->option.value == ptr)
{
found= true;
var->value_origin= here;
/* don't break early, search for all matches */
}
}
DBUG_ASSERT(found); // variable must have been found
}
......@@ -63,7 +63,7 @@ public:
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 };
enum { NO_GETOPT=-1, GETOPT_ONLY_HELP=-2 };
enum where { CONFIG, AUTO, SQL, COMPILE_TIME };
enum where { CONFIG, AUTO, SQL, COMPILE_TIME, ENV };
/**
Enumeration type to indicate for a system variable whether
......@@ -392,6 +392,14 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond);
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
#define SYSVAR_AUTOSIZE(VAR,VAL) \
do { \
VAR= (VAL); \
mark_sys_var_value_origin(&VAR, sys_var::AUTO); \
} while(0)
void mark_sys_var_value_origin(void *ptr, enum sys_var::where here);
bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type);
ulonglong expand_sql_mode(ulonglong sql_mode);
......
......@@ -1168,6 +1168,8 @@ static bool acl_load(THD *thd, TABLE_LIST *tables)
mysql_mutex_unlock(&LOCK_global_system_variables);
else
{
extern sys_var *Sys_old_passwords_ptr;
Sys_old_passwords_ptr->value_origin= sys_var::AUTO;
global_system_variables.old_passwords= 1;
mysql_mutex_unlock(&LOCK_global_system_variables);
sql_print_warning("mysql.user table is not updated to new password format; "
......
......@@ -2121,6 +2121,7 @@ static Sys_var_mybool Sys_old_passwords(
"Use old password encryption method (needed for 4.0 and older clients)",
SESSION_VAR(old_passwords), CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_old_passwords));
export sys_var *Sys_old_passwords_ptr= &Sys_old_passwords; // for sql_acl.cc
static Sys_var_ulong Sys_open_files_limit(
"open_files_limit",
......@@ -3135,7 +3136,7 @@ static Sys_var_uint Sys_threadpool_size(
"This parameter is roughly equivalent to maximum number of concurrently "
"executing threads (threads in a waiting state do not count as executing).",
GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1, MAX_THREAD_GROUPS), DEFAULT(my_getncpus()), BLOCK_SIZE(1),
VALID_RANGE(1, MAX_THREAD_GROUPS), DEFAULT(8), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_threadpool_size),
ON_UPDATE(fix_threadpool_size)
);
......@@ -4328,7 +4329,7 @@ static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
static Sys_var_multi_source_ulong
Sys_max_relay_log_size( "max_relay_log_size",
"relay log will be rotated automatically when the "
"size exceeds this value. If 0 are startup, it's "
"size exceeds this value. If 0 at startup, it's "
"set to max_binlog_size",
SESSION_VAR(max_relay_log_size),
CMD_LINE(REQUIRED_ARG),
......
......@@ -21,6 +21,7 @@
#include "my_global.h"
#include "sql_const.h"
#include "pfs_server.h"
#include "set_var.h"
#include <algorithm>
using std::min;
......@@ -206,7 +207,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
{
count= handle;
p->m_table_sizing= apply_load_factor(count, h->m_load_factor_volatile);
SYSVAR_AUTOSIZE(p->m_table_sizing,
apply_load_factor(count, h->m_load_factor_volatile));
}
if (p->m_table_share_sizing < 0)
......@@ -214,62 +216,74 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
count= share;
count= max<ulong>(count, h->m_min_number_of_tables);
p->m_table_share_sizing= apply_load_factor(count, h->m_load_factor_static);
SYSVAR_AUTOSIZE(p->m_table_share_sizing,
apply_load_factor(count, h->m_load_factor_static));
}
if (p->m_account_sizing < 0)
{
p->m_account_sizing= h->m_account_sizing;
SYSVAR_AUTOSIZE(p->m_account_sizing,
h->m_account_sizing);
}
if (p->m_user_sizing < 0)
{
p->m_user_sizing= h->m_user_sizing;
SYSVAR_AUTOSIZE(p->m_user_sizing,
h->m_user_sizing);
}
if (p->m_host_sizing < 0)
{
p->m_host_sizing= h->m_host_sizing;
SYSVAR_AUTOSIZE(p->m_host_sizing,
h->m_host_sizing);
}
if (p->m_events_waits_history_sizing < 0)
{
p->m_events_waits_history_sizing= h->m_events_waits_history_sizing;
SYSVAR_AUTOSIZE(p->m_events_waits_history_sizing,
h->m_events_waits_history_sizing);
}
if (p->m_events_waits_history_long_sizing < 0)
{
p->m_events_waits_history_long_sizing= h->m_events_waits_history_long_sizing;
SYSVAR_AUTOSIZE(p->m_events_waits_history_long_sizing,
h->m_events_waits_history_long_sizing);
}
if (p->m_events_stages_history_sizing < 0)
{
p->m_events_stages_history_sizing= h->m_events_stages_history_sizing;
SYSVAR_AUTOSIZE(p->m_events_stages_history_sizing,
h->m_events_stages_history_sizing);
}
if (p->m_events_stages_history_long_sizing < 0)
{
p->m_events_stages_history_long_sizing= h->m_events_stages_history_long_sizing;
SYSVAR_AUTOSIZE(p->m_events_stages_history_long_sizing,
h->m_events_stages_history_long_sizing);
}
if (p->m_events_statements_history_sizing < 0)
{
p->m_events_statements_history_sizing= h->m_events_statements_history_sizing;
SYSVAR_AUTOSIZE(p->m_events_statements_history_sizing,
h->m_events_statements_history_sizing);
}
if (p->m_events_statements_history_long_sizing < 0)
{
p->m_events_statements_history_long_sizing= h->m_events_statements_history_long_sizing;
SYSVAR_AUTOSIZE(p->m_events_statements_history_long_sizing,
h->m_events_statements_history_long_sizing);
}
if (p->m_digest_sizing < 0)
{
p->m_digest_sizing= h->m_digest_sizing;
SYSVAR_AUTOSIZE(p->m_digest_sizing,
h->m_digest_sizing);
}
if (p->m_session_connect_attrs_sizing < 0)
{
p->m_session_connect_attrs_sizing= h->m_session_connect_attrs_sizing;
SYSVAR_AUTOSIZE(p->m_session_connect_attrs_sizing,
h->m_session_connect_attrs_sizing);
}
if (p->m_mutex_sizing < 0)
......@@ -279,7 +293,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+ handle * mutex_per_handle
+ share * mutex_per_share;
p->m_mutex_sizing= apply_load_factor(count, h->m_load_factor_volatile);
SYSVAR_AUTOSIZE(p->m_mutex_sizing,
apply_load_factor(count, h->m_load_factor_volatile));
}
if (p->m_rwlock_sizing < 0)
......@@ -289,7 +304,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+ handle * rwlock_per_handle
+ share * rwlock_per_share;
p->m_rwlock_sizing= apply_load_factor(count, h->m_load_factor_volatile);
SYSVAR_AUTOSIZE(p->m_rwlock_sizing,
apply_load_factor(count, h->m_load_factor_volatile));
}
if (p->m_cond_sizing < 0)
......@@ -300,7 +316,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+ handle * cond_per_handle
+ share * cond_per_share;
p->m_cond_sizing= apply_load_factor(count, h->m_load_factor_volatile);
SYSVAR_AUTOSIZE(p->m_cond_sizing,
apply_load_factor(count, h->m_load_factor_volatile));
}
if (p->m_file_sizing < 0)
......@@ -311,7 +328,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+ share * file_per_share;
count= max<ulong>(count, file);
p->m_file_sizing= apply_load_factor(count, h->m_load_factor_normal);
SYSVAR_AUTOSIZE(p->m_file_sizing,
apply_load_factor(count, h->m_load_factor_normal));
}
if (p->m_socket_sizing < 0)
......@@ -321,7 +339,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+ handle * socket_per_handle
+ share * socket_per_share;
p->m_socket_sizing= apply_load_factor(count, h->m_load_factor_volatile);
SYSVAR_AUTOSIZE(p->m_socket_sizing,
apply_load_factor(count, h->m_load_factor_volatile));
}
if (p->m_thread_sizing < 0)
......@@ -331,7 +350,8 @@ static void apply_heuristic(PFS_global_param *p, PFS_sizing_data *h)
+ handle * thread_per_handle
+ share * thread_per_share;
p->m_thread_sizing= apply_load_factor(count, h->m_load_factor_volatile);
SYSVAR_AUTOSIZE(p->m_thread_sizing,
apply_load_factor(count, h->m_load_factor_volatile));
}
}
......
......@@ -26,3 +26,8 @@ extern "C" void compute_md5_hash(char *, const char *, int)
{
}
struct sys_var { enum where { AUTO }; };
void mark_sys_var_value_origin(void *ptr, enum sys_var::where here)
{
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment