33 #include "my_global.h"
35 #include "sql_class.h"
38 #include "mysql_com.h"
41 #include <thr_alarm.h>
46 #include "rpl_info_factory.h"
47 #include "transaction.h"
60 #include "table_cache.h"
63 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
64 #include "../storage/perfschema/pfs_server.h"
67 TYPELIB bool_typelib={ array_elements(bool_values)-1,
"", bool_values, 0 };
74 extern void close_thread_tables(THD *thd);
77 static bool update_buffer_size(THD *thd,
KEY_CACHE *key_cache,
78 ptrdiff_t
offset, ulonglong new_value)
81 DBUG_ASSERT(offset == offsetof(
KEY_CACHE, param_buff_size));
85 if (key_cache == dflt_key_cache)
87 my_error(ER_WARN_CANT_DROP_DEFAULT_KEYCACHE, MYF(0));
91 if (key_cache->key_cache_inited)
97 key_cache->in_init= 1;
99 key_cache->param_buff_size= 0;
107 key_cache->in_init= 0;
112 key_cache->param_buff_size= new_value;
115 key_cache->in_init= 1;
118 if (!key_cache->key_cache_inited)
124 key_cache->in_init= 0;
129 static bool update_keycache_param(THD *thd,
KEY_CACHE *key_cache,
130 ptrdiff_t offset, ulonglong new_value)
133 DBUG_ASSERT(offset != offsetof(
KEY_CACHE, param_buff_size));
135 keycache_var(key_cache, offset)= new_value;
137 key_cache->in_init= 1;
142 key_cache->in_init= 0;
155 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
156 #ifndef EMBEDDED_LIBRARY
158 #define PFS_TRAILING_PROPERTIES \
159 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL), ON_UPDATE(NULL), \
160 NULL, sys_var::PARSE_EARLY
163 "performance_schema",
164 "Enable the performance schema.",
167 PFS_TRAILING_PROPERTIES);
170 "performance_schema_instrument",
171 "Default startup value for a performance schema instrument.",
173 CMD_LINE(OPT_ARG, OPT_PFS_INSTRUMENT),
176 PFS_TRAILING_PROPERTIES);
179 "performance_schema_consumer_events_stages_current",
180 "Default startup value for the events_stages_current consumer.",
183 PFS_TRAILING_PROPERTIES);
186 "performance_schema_consumer_events_stages_history",
187 "Default startup value for the events_stages_history consumer.",
188 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_stages_history_enabled),
190 PFS_TRAILING_PROPERTIES);
192 static Sys_var_mybool Sys_pfs_consumer_events_stages_history_long(
193 "performance_schema_consumer_events_stages_history_long",
194 "Default startup value for the events_stages_history_long consumer.",
195 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_stages_history_long_enabled),
197 PFS_TRAILING_PROPERTIES);
200 "performance_schema_consumer_events_statements_current",
201 "Default startup value for the events_statements_current consumer.",
202 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_statements_current_enabled),
204 PFS_TRAILING_PROPERTIES);
207 "performance_schema_consumer_events_statements_history",
208 "Default startup value for the events_statements_history consumer.",
209 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_statements_history_enabled),
211 PFS_TRAILING_PROPERTIES);
213 static Sys_var_mybool Sys_pfs_consumer_events_statements_history_long(
214 "performance_schema_consumer_events_statements_history_long",
215 "Default startup value for the events_statements_history_long consumer.",
216 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_statements_history_long_enabled),
218 PFS_TRAILING_PROPERTIES);
221 "performance_schema_consumer_events_waits_current",
222 "Default startup value for the events_waits_current consumer.",
223 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_waits_current_enabled),
225 PFS_TRAILING_PROPERTIES);
228 "performance_schema_consumer_events_waits_history",
229 "Default startup value for the events_waits_history consumer.",
230 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_waits_history_enabled),
232 PFS_TRAILING_PROPERTIES);
235 "performance_schema_consumer_events_waits_history_long",
236 "Default startup value for the events_waits_history_long consumer.",
237 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_events_waits_history_long_enabled),
239 PFS_TRAILING_PROPERTIES);
242 "performance_schema_consumer_global_instrumentation",
243 "Default startup value for the global_instrumentation consumer.",
244 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_global_instrumentation_enabled),
246 PFS_TRAILING_PROPERTIES);
249 "performance_schema_consumer_thread_instrumentation",
250 "Default startup value for the thread_instrumentation consumer.",
251 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_thread_instrumentation_enabled),
253 PFS_TRAILING_PROPERTIES);
256 "performance_schema_consumer_statements_digest",
257 "Default startup value for the statements_digest consumer.",
258 READ_ONLY NOT_VISIBLE GLOBAL_VAR(
pfs_param.m_consumer_statement_digest_enabled),
260 PFS_TRAILING_PROPERTIES);
262 static Sys_var_long Sys_pfs_events_waits_history_long_size(
263 "performance_schema_events_waits_history_long_size",
264 "Number of rows in EVENTS_WAITS_HISTORY_LONG."
265 " Use 0 to disable, -1 for automated sizing.",
267 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
269 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
272 "performance_schema_events_waits_history_size",
273 "Number of rows per thread in EVENTS_WAITS_HISTORY."
274 " Use 0 to disable, -1 for automated sizing.",
276 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
278 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
281 "performance_schema_max_cond_classes",
282 "Maximum number of condition instruments.",
284 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
285 DEFAULT(PFS_MAX_COND_CLASS),
286 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
289 "performance_schema_max_cond_instances",
290 "Maximum number of instrumented condition objects."
291 " Use 0 to disable, -1 for automated sizing.",
293 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
295 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
298 "performance_schema_max_file_classes",
299 "Maximum number of file instruments.",
301 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
302 DEFAULT(PFS_MAX_FILE_CLASS),
303 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
306 "performance_schema_max_file_handles",
307 "Maximum number of opened instrumented files.",
309 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
310 DEFAULT(PFS_MAX_FILE_HANDLE),
311 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
314 "performance_schema_max_file_instances",
315 "Maximum number of instrumented files."
316 " Use 0 to disable, -1 for automated sizing.",
318 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
320 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
323 "performance_schema_max_socket_instances",
324 "Maximum number of opened instrumented sockets."
325 " Use 0 to disable, -1 for automated sizing.",
327 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
329 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
332 "performance_schema_max_socket_classes",
333 "Maximum number of socket instruments.",
335 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
336 DEFAULT(PFS_MAX_SOCKET_CLASS),
337 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
340 "performance_schema_max_mutex_classes",
341 "Maximum number of mutex instruments.",
343 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
344 DEFAULT(PFS_MAX_MUTEX_CLASS),
345 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
348 "performance_schema_max_mutex_instances",
349 "Maximum number of instrumented MUTEX objects."
350 " Use 0 to disable, -1 for automated sizing.",
352 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
354 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
357 "performance_schema_max_rwlock_classes",
358 "Maximum number of rwlock instruments.",
360 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
361 DEFAULT(PFS_MAX_RWLOCK_CLASS),
362 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
365 "performance_schema_max_rwlock_instances",
366 "Maximum number of instrumented RWLOCK objects."
367 " Use 0 to disable, -1 for automated sizing.",
369 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
371 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
374 "performance_schema_max_table_handles",
375 "Maximum number of opened instrumented tables."
376 " Use 0 to disable, -1 for automated sizing.",
378 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
380 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
383 "performance_schema_max_table_instances",
384 "Maximum number of instrumented tables."
385 " Use 0 to disable, -1 for automated sizing.",
387 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
389 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
392 "performance_schema_max_thread_classes",
393 "Maximum number of thread instruments.",
395 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
396 DEFAULT(PFS_MAX_THREAD_CLASS),
397 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
400 "performance_schema_max_thread_instances",
401 "Maximum number of instrumented threads."
402 " Use 0 to disable, -1 for automated sizing.",
404 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
406 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
409 "performance_schema_setup_actors_size",
410 "Maximum number of rows in SETUP_ACTORS.",
412 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
413 DEFAULT(PFS_MAX_SETUP_ACTOR),
414 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
417 "performance_schema_setup_objects_size",
418 "Maximum number of rows in SETUP_OBJECTS.",
420 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
421 DEFAULT(PFS_MAX_SETUP_OBJECT),
422 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
425 "performance_schema_accounts_size",
426 "Maximum number of instrumented user@host accounts."
427 " Use 0 to disable, -1 for automated sizing.",
429 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
431 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
434 "performance_schema_hosts_size",
435 "Maximum number of instrumented hosts."
436 " Use 0 to disable, -1 for automated sizing.",
438 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
440 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
443 "performance_schema_users_size",
444 "Maximum number of instrumented users."
445 " Use 0 to disable, -1 for automated sizing.",
447 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
449 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
452 "performance_schema_max_stage_classes",
453 "Maximum number of stage instruments.",
455 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
456 DEFAULT(PFS_MAX_STAGE_CLASS),
457 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
459 static Sys_var_long Sys_pfs_events_stages_history_long_size(
460 "performance_schema_events_stages_history_long_size",
461 "Number of rows in EVENTS_STAGES_HISTORY_LONG."
462 " Use 0 to disable, -1 for automated sizing.",
464 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
466 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
469 "performance_schema_events_stages_history_size",
470 "Number of rows per thread in EVENTS_STAGES_HISTORY."
471 " Use 0 to disable, -1 for automated sizing.",
473 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
475 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
488 "performance_schema_max_statement_classes",
489 "Maximum number of statement instruments.",
491 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
492 DEFAULT((ulong) SQLCOM_END + (ulong) COM_END + 4),
493 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
495 static Sys_var_long Sys_pfs_events_statements_history_long_size(
496 "performance_schema_events_statements_history_long_size",
497 "Number of rows in EVENTS_STATEMENTS_HISTORY_LONG."
498 " Use 0 to disable, -1 for automated sizing.",
500 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
502 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
504 static Sys_var_long Sys_pfs_events_statements_history_size(
505 "performance_schema_events_statements_history_size",
506 "Number of rows per thread in EVENTS_STATEMENTS_HISTORY."
507 " Use 0 to disable, -1 for automated sizing.",
509 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
511 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
514 "performance_schema_digests_size",
515 "Size of the statement digest."
516 " Use 0 to disable, -1 for automated sizing.",
518 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
520 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
523 "performance_schema_session_connect_attrs_size",
524 "Size of session attribute string buffer per thread."
525 " Use 0 to disable, -1 for automated sizing.",
527 CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
529 BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
535 "auto_increment_increment",
536 "Auto-increment columns are incremented by this",
537 SESSION_VAR(auto_increment_increment),
539 VALID_RANGE(1, 65535), DEFAULT(1), BLOCK_SIZE(1),
540 NO_MUTEX_GUARD, IN_BINLOG);
543 "auto_increment_offset",
544 "Offset added to Auto-increment columns. Used when "
545 "auto-increment-increment != 1",
546 SESSION_VAR(auto_increment_offset),
548 VALID_RANGE(1, 65535), DEFAULT(1), BLOCK_SIZE(1),
549 NO_MUTEX_GUARD, IN_BINLOG);
552 "automatic_sp_privileges",
553 "Creating and dropping stored procedures alters ACLs",
554 GLOBAL_VAR(sp_automatic_privileges),
558 "back_log",
"The number of outstanding connection requests "
559 "MySQL can have. This comes into play when the main MySQL thread "
560 "gets very many connection requests in a very short time",
561 READ_ONLY GLOBAL_VAR(back_log),
CMD_LINE(REQUIRED_ARG),
562 VALID_RANGE(0, 65535), DEFAULT(0), BLOCK_SIZE(1));
565 "basedir",
"Path to installation directory. All paths are "
566 "usually resolved relative to this",
567 READ_ONLY GLOBAL_VAR(mysql_home_ptr),
CMD_LINE(REQUIRED_ARG,
'b'),
568 IN_FS_CHARSET, DEFAULT(0));
571 "bind_address",
"IP address to bind to.",
572 READ_ONLY GLOBAL_VAR(my_bind_addr_str),
CMD_LINE(REQUIRED_ARG),
573 IN_FS_CHARSET, DEFAULT(MY_BIND_ALL_ADDRESSES));
575 static bool fix_binlog_cache_size(
sys_var *
self, THD *thd, enum_var_type
type)
581 static bool fix_binlog_stmt_cache_size(
sys_var *
self, THD *thd, enum_var_type
type)
588 "binlog_cache_size",
"The size of the transactional cache for "
589 "updates to transactional engines for the binary log. "
590 "If you often use transactions containing many statements, "
591 "you can increase this to get more performance",
592 GLOBAL_VAR(binlog_cache_size),
594 VALID_RANGE(IO_SIZE, ULONG_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE),
595 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
596 ON_UPDATE(fix_binlog_cache_size));
599 "binlog_stmt_cache_size",
"The size of the statement cache for "
600 "updates to non-transactional engines for the binary log. "
601 "If you often use statements updating a great number of rows, "
602 "you can increase this to get more performance",
603 GLOBAL_VAR(binlog_stmt_cache_size),
605 VALID_RANGE(IO_SIZE, ULONG_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE),
606 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
607 ON_UPDATE(fix_binlog_stmt_cache_size));
610 "binlog_max_flush_queue_time",
611 "The maximum time that the binary log group commit will keep reading"
612 " transactions before it flush the transactions to the binary log (and"
613 " optionally sync, depending on the value of sync_binlog).",
614 GLOBAL_VAR(opt_binlog_max_flush_queue_time),
616 VALID_RANGE(0, 100000), DEFAULT(0), BLOCK_SIZE(1),
617 NO_MUTEX_GUARD, NOT_IN_BINLOG);
619 static bool check_has_super(
sys_var *
self, THD *thd,
set_var *var)
621 DBUG_ASSERT(self->scope() != sys_var::GLOBAL);
622 #ifndef NO_EMBEDDED_ACCESS_CHECKS
623 if (!(thd->security_ctx->master_access & SUPER_ACL))
625 my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0),
"SUPER");
632 #if defined(HAVE_GTID_NEXT_LIST) || defined(NON_DISABLED_GTID) || defined(HAVE_REPLICATION)
633 static bool check_top_level_stmt(
sys_var *
self, THD *thd,
set_var *var)
635 if (thd->in_sub_stmt)
637 my_error(ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER, MYF(0), var->
var->name.str);
643 static bool check_top_level_stmt_and_super(
sys_var *
self, THD *thd,
set_var *var)
645 return (check_has_super(
self, thd, var) ||
646 check_top_level_stmt(
self, thd, var));
650 #if defined(HAVE_GTID_NEXT_LIST) || defined(HAVE_REPLICATION)
651 static bool check_outside_transaction(
sys_var *
self, THD *thd,
set_var *var)
653 if (thd->in_active_multi_stmt_transaction())
655 my_error(ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION, MYF(0), var->
var->name.str);
660 static bool check_outside_sp(
sys_var *
self, THD *thd,
set_var *var)
662 if (thd->lex->sphead)
664 my_error(ER_VARIABLE_NOT_SETTABLE_IN_SP, MYF(0), var->
var->name.str);
671 static bool binlog_format_check(
sys_var *
self, THD *thd,
set_var *var)
673 if (check_has_super(
self, thd, var))
676 if (var->type == OPT_GLOBAL)
689 if (thd->temporary_tables && var->type == OPT_SESSION &&
691 ((thd->variables.binlog_format == BINLOG_FORMAT_MIXED &&
692 thd->is_current_stmt_binlog_format_row()) ||
693 thd->variables.binlog_format == BINLOG_FORMAT_ROW))
695 my_error(ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR, MYF(0));
702 if (thd->in_sub_stmt)
704 my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT, MYF(0));
710 if (thd->in_active_multi_stmt_transaction())
712 my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT, MYF(0));
719 static bool fix_binlog_format_after_update(
sys_var *
self, THD *thd,
722 if (type == OPT_SESSION)
723 thd->reset_current_stmt_binlog_format_row();
728 "core_file",
"write a core-file on crashes", TEST_CORE_ON_SIGNAL);
731 "binlog_format",
"What form of binary logging the master will "
732 "use: either ROW for row-based binary logging, STATEMENT "
733 "for statement-based binary logging, or MIXED. MIXED is statement-"
734 "based binary logging except for those statements where only row-"
735 "based is correct: those which involve user-defined functions (i.e. "
736 "UDFs) or the UUID() function; for those, row-based binary logging is "
737 "automatically used. If NDBCLUSTER is enabled and binlog-format is "
738 "MIXED, the format switches to row-based and back implicitly per each "
739 "query accessing an NDBCLUSTER table",
740 SESSION_VAR(binlog_format),
CMD_LINE(REQUIRED_ARG, OPT_BINLOG_FORMAT),
741 binlog_format_names, DEFAULT(BINLOG_FORMAT_STMT),
742 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_format_check),
743 ON_UPDATE(fix_binlog_format_after_update));
745 static const char *binlog_row_image_names[]= {
"MINIMAL",
"NOBLOB",
"FULL", NullS};
748 "Controls whether rows should be logged in 'FULL', 'NOBLOB' or "
749 "'MINIMAL' formats. 'FULL', means that all columns in the before "
750 "and after image are logged. 'NOBLOB', means that mysqld avoids logging "
751 "blob columns whenever possible (eg, blob column was not changed or "
752 "is not part of primary key). 'MINIMAL', means that a PK equivalent (PK "
753 "columns or full row if there is no PK in the table) is logged in the "
754 "before image, and only changed columns are logged in the after image. "
756 SESSION_VAR(binlog_row_image),
CMD_LINE(REQUIRED_ARG),
757 binlog_row_image_names, DEFAULT(BINLOG_ROW_IMAGE_FULL),
758 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
761 static bool binlog_direct_check(
sys_var *
self, THD *thd,
set_var *var)
763 if (check_has_super(
self, thd, var))
766 if (var->type == OPT_GLOBAL)
773 if (thd->in_sub_stmt)
775 my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
782 if (thd->in_active_multi_stmt_transaction())
784 my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
792 "binlog_direct_non_transactional_updates",
793 "Causes updates to non-transactional engines using statement format to "
794 "be written directly to binary log. Before using this option make sure "
795 "that there are no dependencies between transactional and "
796 "non-transactional tables such as in the statement INSERT INTO t_myisam "
797 "SELECT * FROM t_innodb; otherwise, slaves may diverge from the master.",
798 SESSION_VAR(binlog_direct_non_trans_update),
800 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
813 "explicit_defaults_for_timestamp",
814 "This option causes CREATE TABLE to create all TIMESTAMP columns "
815 "as NULL with DEFAULT NULL attribute, Without this option, "
816 "TIMESTAMP columns are NOT NULL and have implicit DEFAULT clauses. "
817 "The old behavior is deprecated.",
818 READ_ONLY SESSION_VAR(explicit_defaults_for_timestamp),
821 static bool repository_check(
sys_var *
self, THD *thd,
set_var *var, SLAVE_THD_TYPE thread_mask)
824 #ifndef NO_EMBEDDED_ACCESS_CHECKS
825 if (!(thd->security_ctx->master_access & SUPER_ACL))
827 my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0),
"SUPER");
831 #ifdef HAVE_REPLICATION
833 const char *
msg= NULL;
835 if (active_mi != NULL)
837 lock_slave_threads(active_mi);
838 init_thread_mask(&running, active_mi, FALSE);
844 if (Rpl_info_factory::change_mi_repository(active_mi,
849 my_error(ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE, MYF(0), msg);
853 mts_recovery_groups(active_mi->rli);
854 if (!active_mi->rli->is_mts_recovery())
856 if (Rpl_info_factory::reset_workers(active_mi->rli) ||
857 Rpl_info_factory::change_rli_repository(active_mi->rli,
862 my_error(ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE, MYF(0), msg);
866 sql_print_warning(
"It is not possible to change the type of the "
867 "relay log's repository because there are workers' "
868 "repositories with gaps. Please, fix the gaps first "
869 "before doing such change.");
879 my_error(ER_SLAVE_MUST_STOP, MYF(0));
881 unlock_slave_threads(active_mi);
888 static bool relay_log_info_repository_check(
sys_var *
self, THD *thd,
set_var *var)
890 return repository_check(
self, thd, var, SLAVE_THD_SQL);
893 static bool master_info_repository_check(
sys_var *
self, THD *thd,
set_var *var)
895 return repository_check(
self, thd, var, SLAVE_THD_IO);
898 static const char *repository_names[]=
907 ulong opt_mi_repository_id= INFO_REPOSITORY_FILE;
909 "master_info_repository",
910 "Defines the type of the repository for the master information."
911 ,GLOBAL_VAR(opt_mi_repository_id),
CMD_LINE(REQUIRED_ARG),
912 repository_names, DEFAULT(INFO_REPOSITORY_FILE), NO_MUTEX_GUARD,
913 NOT_IN_BINLOG, ON_CHECK(master_info_repository_check),
916 ulong opt_rli_repository_id= INFO_REPOSITORY_FILE;
918 "relay_log_info_repository",
919 "Defines the type of the repository for the relay log information "
920 "and associated workers."
921 ,GLOBAL_VAR(opt_rli_repository_id),
CMD_LINE(REQUIRED_ARG),
922 repository_names, DEFAULT(INFO_REPOSITORY_FILE), NO_MUTEX_GUARD,
923 NOT_IN_BINLOG, ON_CHECK(relay_log_info_repository_check),
927 "binlog_rows_query_log_events",
928 "Allow writing of Rows_query_log events into binary log.",
929 SESSION_VAR(binlog_rows_query_log_events),
933 "binlog_order_commits",
934 "Issue internal commit calls in the same order as transactions are"
935 " written to the binary log. Default is to order commits.",
936 GLOBAL_VAR(opt_binlog_order_commits),
940 "bulk_insert_buffer_size",
"Size of tree cache used in bulk "
941 "insert optimisation. Note that this is a limit per thread!",
942 SESSION_VAR(bulk_insert_buff_size),
CMD_LINE(REQUIRED_ARG),
943 VALID_RANGE(0, ULONG_MAX), DEFAULT(8192*1024), BLOCK_SIZE(1));
946 "character_sets_dir",
"Directory where character sets are",
947 READ_ONLY GLOBAL_VAR(charsets_dir),
CMD_LINE(REQUIRED_ARG),
948 IN_FS_CHARSET, DEFAULT(0));
959 char buff[STRING_BUFFER_USUAL_SIZE];
960 if (var->
value->result_type() == STRING_RESULT)
962 String str(buff,
sizeof(buff), system_charset_info), *res;
963 if (!(res= var->
value->val_str(&str)))
964 var->save_result.
ptr= NULL;
968 if (!(var->save_result.
ptr= get_charset_by_csname(err.ptr(),
971 !(var->save_result.
ptr= get_old_charset_by_name(err.ptr())))
973 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), err.ptr());
980 int csno= (int)var->
value->val_int();
981 if (!(var->save_result.
ptr= get_charset(csno, MYF(0))))
983 my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), llstr(csno, buff));
989 static bool check_charset_not_null(
sys_var *
self, THD *thd,
set_var *var)
991 return check_charset(
self, thd, var) || check_not_null(
self, thd, var);
994 "character_set_system",
"The character set used by the server "
995 "for storing identifiers",
996 READ_ONLY GLOBAL_VAR(system_charset_info), NO_CMD_LINE,
1000 "character_set_server",
"The default character set",
1001 SESSION_VAR(collation_server), NO_CMD_LINE,
1002 offsetof(
CHARSET_INFO, csname), DEFAULT(&default_charset_info),
1003 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null));
1005 static bool check_charset_db(
sys_var *
self, THD *thd,
set_var *var)
1007 if (check_charset_not_null(
self, thd, var))
1010 var->save_result.
ptr= thd->db_charset;
1014 "character_set_database",
1015 " The character set used by the default database",
1016 SESSION_VAR(collation_database), NO_CMD_LINE,
1017 offsetof(
CHARSET_INFO, csname), DEFAULT(&default_charset_info),
1018 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_db));
1020 static bool check_cs_client(
sys_var *
self, THD *thd,
set_var *var)
1022 if (check_charset_not_null(
self, thd, var))
1031 static bool fix_thd_charset(
sys_var *
self, THD *thd, enum_var_type type)
1033 if (type == OPT_SESSION)
1034 thd->update_charset();
1038 "character_set_client",
"The character set for statements "
1039 "that arrive from the client",
1040 SESSION_VAR(character_set_client), NO_CMD_LINE,
1041 offsetof(
CHARSET_INFO, csname), DEFAULT(&default_charset_info),
1042 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_cs_client),
1043 ON_UPDATE(fix_thd_charset));
1046 "character_set_connection",
"The character set used for "
1047 "literals that do not have a character set introducer and for "
1048 "number-to-string conversion",
1049 SESSION_VAR(collation_connection), NO_CMD_LINE,
1050 offsetof(
CHARSET_INFO, csname), DEFAULT(&default_charset_info),
1051 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null),
1052 ON_UPDATE(fix_thd_charset));
1055 "character_set_results",
"The character set used for returning "
1056 "query results to the client",
1057 SESSION_VAR(character_set_results), NO_CMD_LINE,
1058 offsetof(
CHARSET_INFO, csname), DEFAULT(&default_charset_info),
1059 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset));
1062 "character_set_filesystem",
"The filesystem character set",
1063 SESSION_VAR(character_set_filesystem), NO_CMD_LINE,
1064 offsetof(
CHARSET_INFO, csname), DEFAULT(&character_set_filesystem),
1065 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset_not_null),
1066 ON_UPDATE(fix_thd_charset));
1068 static const char *completion_type_names[]= {
"NO_CHAIN",
"CHAIN",
"RELEASE", 0};
1070 "completion_type",
"The transaction completion type, one of "
1071 "NO_CHAIN, CHAIN, RELEASE",
1072 SESSION_VAR(completion_type),
CMD_LINE(REQUIRED_ARG),
1073 completion_type_names, DEFAULT(0));
1075 static bool check_collation_not_null(
sys_var *
self, THD *thd,
set_var *var)
1080 char buff[STRING_BUFFER_USUAL_SIZE];
1081 if (var->
value->result_type() == STRING_RESULT)
1083 String str(buff,
sizeof(buff), system_charset_info), *res;
1084 if (!(res= var->
value->val_str(&str)))
1085 var->save_result.
ptr= NULL;
1089 if (!(var->save_result.
ptr= get_charset_by_name(err.ptr(), MYF(0))))
1091 my_error(ER_UNKNOWN_COLLATION, MYF(0), err.ptr());
1098 int csno= (int)var->
value->val_int();
1099 if (!(var->save_result.
ptr= get_charset(csno, MYF(0))))
1101 my_error(ER_UNKNOWN_COLLATION, MYF(0), llstr(csno, buff));
1105 return check_not_null(
self, thd, var);
1108 "collation_connection",
"The collation of the connection "
1110 SESSION_VAR(collation_connection), NO_CMD_LINE,
1112 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_not_null),
1113 ON_UPDATE(fix_thd_charset));
1115 static bool check_collation_db(
sys_var *
self, THD *thd,
set_var *var)
1117 if (check_collation_not_null(
self, thd, var))
1120 var->save_result.
ptr= thd->db_charset;
1124 "collation_database",
"The collation of the database "
1126 SESSION_VAR(collation_database), NO_CMD_LINE,
1128 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_db));
1131 "collation_server",
"The server default collation",
1132 SESSION_VAR(collation_server), NO_CMD_LINE,
1134 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_collation_not_null));
1136 static const char *concurrent_insert_names[]= {
"NEVER",
"AUTO",
"ALWAYS", 0};
1138 "concurrent_insert",
"Use concurrent insert with MyISAM. Possible "
1139 "values are NEVER, AUTO, ALWAYS",
1140 GLOBAL_VAR(myisam_concurrent_insert),
CMD_LINE(OPT_ARG),
1141 concurrent_insert_names, DEFAULT(1));
1145 "The number of seconds the mysqld server is waiting for a connect "
1146 "packet before responding with 'Bad handshake'",
1147 GLOBAL_VAR(connect_timeout),
CMD_LINE(REQUIRED_ARG),
1148 VALID_RANGE(2, LONG_TIMEOUT), DEFAULT(CONNECT_TIMEOUT), BLOCK_SIZE(1));
1151 "datadir",
"Path to the database root directory",
1152 READ_ONLY GLOBAL_VAR(mysql_real_data_home_ptr),
1153 CMD_LINE(REQUIRED_ARG,
'h'), IN_FS_CHARSET, DEFAULT(mysql_real_data_home));
1157 "debug",
"Debug log", sys_var::SESSION,
1158 CMD_LINE(OPT_ARG,
'#'), DEFAULT(
""), NO_MUTEX_GUARD, NOT_IN_BINLOG,
1159 ON_CHECK(check_has_super));
1170 switch (delay_key_write_options) {
1171 case DELAY_KEY_WRITE_NONE:
1172 myisam_delay_key_write=0;
1174 case DELAY_KEY_WRITE_ON:
1175 myisam_delay_key_write=1;
1177 case DELAY_KEY_WRITE_ALL:
1178 myisam_delay_key_write=1;
1179 ha_open_options|= HA_OPEN_DELAY_KEY_WRITE;
1184 static const char *delay_key_write_names[]= {
"OFF",
"ON",
"ALL", NullS };
1186 "delay_key_write",
"Type of DELAY_KEY_WRITE",
1187 GLOBAL_VAR(delay_key_write_options),
CMD_LINE(OPT_ARG),
1188 delay_key_write_names, DEFAULT(DELAY_KEY_WRITE_ON),
1189 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1193 "delayed_insert_limit",
1194 "After inserting delayed_insert_limit rows, the INSERT DELAYED "
1195 "handler will check if there are any SELECT statements pending. "
1196 "If so, it allows these to execute before continuing. "
1197 "This variable is deprecated along with INSERT DELAYED.",
1198 GLOBAL_VAR(delayed_insert_limit),
CMD_LINE(REQUIRED_ARG),
1199 VALID_RANGE(1, ULONG_MAX), DEFAULT(
DELAYED_LIMIT), BLOCK_SIZE(1),
1200 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
1204 "delayed_insert_timeout",
1205 "How long a INSERT DELAYED thread should wait for INSERT statements "
1206 "before terminating."
1207 "This variable is deprecated along with INSERT DELAYED.",
1208 GLOBAL_VAR(delayed_insert_timeout),
CMD_LINE(REQUIRED_ARG),
1210 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1211 ON_UPDATE(0), DEPRECATED(
""));
1214 "delayed_queue_size",
1215 "What size queue (in rows) should be allocated for handling INSERT "
1216 "DELAYED. If the queue becomes full, any client that does INSERT "
1217 "DELAYED will wait until there is room in the queue again."
1218 "This variable is deprecated along with INSERT DELAYED.",
1219 GLOBAL_VAR(delayed_queue_size),
CMD_LINE(REQUIRED_ARG),
1220 VALID_RANGE(1, ULONG_MAX), DEFAULT(DELAYED_QUEUE_SIZE), BLOCK_SIZE(1),
1221 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
1224 #ifdef HAVE_EVENT_SCHEDULER
1225 static const char *event_scheduler_names[]= {
"OFF",
"ON",
"DISABLED", NullS };
1226 static bool event_scheduler_check(
sys_var *
self, THD *thd,
set_var *var)
1238 if (Events::opt_event_scheduler == Events::EVENTS_DISABLED)
1240 my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
1241 "--event-scheduler=DISABLED or --skip-grant-tables");
1246 static bool event_scheduler_update(
sys_var *
self, THD *thd, enum_var_type type)
1249 uint opt_event_scheduler_value= Events::opt_event_scheduler;
1267 bool ret= opt_event_scheduler_value == Events::EVENTS_ON
1268 ? Events::start(&err_no)
1273 Events::opt_event_scheduler= Events::EVENTS_OFF;
1274 my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), err_no);
1280 "event_scheduler",
"Enable the event scheduler. Possible values are "
1281 "ON, OFF, and DISABLED (keep the event scheduler completely "
1282 "deactivated, it cannot be activated run-time)",
1283 GLOBAL_VAR(Events::opt_event_scheduler),
CMD_LINE(OPT_ARG),
1284 event_scheduler_names, DEFAULT(Events::EVENTS_OFF),
1285 NO_MUTEX_GUARD, NOT_IN_BINLOG,
1286 ON_CHECK(event_scheduler_check), ON_UPDATE(event_scheduler_update));
1291 "If non-zero, binary logs will be purged after expire_logs_days "
1292 "days; possible purges happen at startup and at binary log rotation",
1293 GLOBAL_VAR(expire_logs_days),
1294 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 99), DEFAULT(0), BLOCK_SIZE(1));
1297 "flush",
"Flush MyISAM tables to disk between SQL commands",
1298 GLOBAL_VAR(myisam_flush),
1299 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1303 "A dedicated thread is created to flush all tables at the "
1305 GLOBAL_VAR(flush_time),
1306 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT),
1307 DEFAULT(0), BLOCK_SIZE(1));
1309 static bool check_ftb_syntax(
sys_var *
self, THD *thd,
set_var *var)
1311 return ft_boolean_check_syntax_string((uchar*)
1314 static bool query_cache_flush(
sys_var *
self, THD *thd, enum_var_type type)
1316 #ifdef HAVE_QUERY_CACHE
1317 query_cache.flush();
1323 "ft_boolean_syntax",
"List of operators for "
1324 "MATCH ... AGAINST ( ... IN BOOLEAN MODE)",
1325 GLOBAL_VAR(ft_boolean_syntax),
1326 CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET,
1327 DEFAULT(DEFAULT_FTB_SYNTAX), NO_MUTEX_GUARD,
1328 NOT_IN_BINLOG, ON_CHECK(check_ftb_syntax), ON_UPDATE(query_cache_flush));
1332 "The maximum length of the word to be included in a FULLTEXT index. "
1333 "Note: FULLTEXT indexes must be rebuilt after changing this variable",
1334 READ_ONLY GLOBAL_VAR(ft_max_word_len),
CMD_LINE(REQUIRED_ARG),
1335 VALID_RANGE(10, HA_FT_MAXCHARLEN), DEFAULT(HA_FT_MAXCHARLEN),
1340 "The minimum length of the word to be included in a FULLTEXT index. "
1341 "Note: FULLTEXT indexes must be rebuilt after changing this variable",
1342 READ_ONLY GLOBAL_VAR(ft_min_word_len),
CMD_LINE(REQUIRED_ARG),
1343 VALID_RANGE(1, HA_FT_MAXCHARLEN), DEFAULT(4), BLOCK_SIZE(1));
1347 "ft_query_expansion_limit",
1348 "Number of best matches to use for query expansion",
1349 READ_ONLY GLOBAL_VAR(ft_query_expansion_limit),
1351 VALID_RANGE(0, 1000), DEFAULT(20), BLOCK_SIZE(1));
1355 "Use stopwords from this file instead of built-in list",
1356 READ_ONLY GLOBAL_VAR(ft_stopword_file),
CMD_LINE(REQUIRED_ARG),
1357 IN_FS_CHARSET, DEFAULT(0));
1360 "ignore_builtin_innodb",
1361 "IGNORED. This option will be removed in future releases. "
1362 "Disable initialization of builtin InnoDB plugin",
1363 READ_ONLY GLOBAL_VAR(opt_ignore_builtin_innodb),
1364 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1366 static bool check_init_string(
sys_var *
self, THD *thd,
set_var *var)
1370 var->save_result.
string_value.str=
const_cast<char*
>(
"");
1375 static PolyLock_rwlock PLock_sys_init_connect(&LOCK_sys_init_connect);
1377 "init_connect",
"Command(s) that are executed for each "
1378 "new connection", GLOBAL_VAR(opt_init_connect),
1379 CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET,
1380 DEFAULT(
""), &PLock_sys_init_connect, NOT_IN_BINLOG,
1381 ON_CHECK(check_init_string));
1384 "init_file",
"Read SQL commands from this file at startup",
1385 READ_ONLY GLOBAL_VAR(opt_init_file),
1386 #ifdef DISABLE_GRANT_OPTIONS
1391 IN_FS_CHARSET, DEFAULT(0));
1395 "init_slave",
"Command(s) that are executed by a slave server "
1396 "each time the SQL thread starts", GLOBAL_VAR(opt_init_slave),
1397 CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET,
1398 DEFAULT(
""), &PLock_sys_init_slave,
1399 NOT_IN_BINLOG, ON_CHECK(check_init_string));
1402 "interactive_timeout",
1403 "The number of seconds the server waits for activity on an interactive "
1404 "connection before closing it",
1405 SESSION_VAR(net_interactive_timeout),
1407 VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
1411 "The size of the buffer that is used for full joins",
1412 SESSION_VAR(join_buff_size),
CMD_LINE(REQUIRED_ARG),
1413 VALID_RANGE(128, ULONG_MAX), DEFAULT(256 * 1024), BLOCK_SIZE(128));
1416 "key_buffer_size",
"The size of the buffer used for "
1417 "index blocks for MyISAM tables. Increase this to get better index "
1418 "handling (for all reads and multiple writes) to as much as you can "
1420 KEYCACHE_VAR(param_buff_size),
1421 CMD_LINE(REQUIRED_ARG, OPT_KEY_BUFFER_SIZE),
1422 VALID_RANGE(0, SIZE_T_MAX), DEFAULT(KEY_CACHE_SIZE),
1423 BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1424 ON_UPDATE(update_buffer_size));
1427 "key_cache_block_size",
"The default size of key cache blocks",
1428 KEYCACHE_VAR(param_block_size),
1429 CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_BLOCK_SIZE),
1430 VALID_RANGE(512, 1024*16), DEFAULT(KEY_CACHE_BLOCK_SIZE),
1431 BLOCK_SIZE(512), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1432 ON_UPDATE(update_keycache_param));
1435 "key_cache_division_limit",
1436 "The minimum percentage of warm blocks in key cache",
1437 KEYCACHE_VAR(param_division_limit),
1438 CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_DIVISION_LIMIT),
1439 VALID_RANGE(1, 100), DEFAULT(100),
1440 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1441 ON_UPDATE(update_keycache_param));
1444 "key_cache_age_threshold",
"This characterizes the number of "
1445 "hits a hot block has to be untouched until it is considered aged "
1446 "enough to be downgraded to a warm block. This specifies the "
1447 "percentage ratio of that number of hits to the total number of "
1448 "blocks in key cache",
1449 KEYCACHE_VAR(param_age_threshold),
1450 CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_AGE_THRESHOLD),
1451 VALID_RANGE(100, ULONG_MAX), DEFAULT(300),
1452 BLOCK_SIZE(100), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1453 ON_UPDATE(update_keycache_param));
1456 "large_files_support",
1457 "Whether mysqld was compiled with options for large file support",
1458 READ_ONLY GLOBAL_VAR(opt_large_files),
1459 NO_CMD_LINE, DEFAULT(
sizeof(my_off_t) > 4));
1463 "If large page support is enabled, this shows the size of memory pages",
1464 READ_ONLY GLOBAL_VAR(opt_large_page_size), NO_CMD_LINE,
1465 VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
1468 "large_pages",
"Enable support for large pages",
1469 READ_ONLY GLOBAL_VAR(opt_large_pages),
1470 IF_WIN(NO_CMD_LINE,
CMD_LINE(OPT_ARG)), DEFAULT(FALSE));
1473 "lc_messages_dir",
"Directory where error messages are",
1474 READ_ONLY GLOBAL_VAR(lc_messages_dir_ptr),
1475 CMD_LINE(REQUIRED_ARG, OPT_LC_MESSAGES_DIRECTORY),
1476 IN_FS_CHARSET, DEFAULT(0));
1479 "local_infile",
"Enable LOAD DATA LOCAL INFILE",
1480 GLOBAL_VAR(opt_local_infile),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
1483 "lock_wait_timeout",
1484 "Timeout in seconds to wait for a lock before returning an error.",
1485 SESSION_VAR(lock_wait_timeout),
CMD_LINE(REQUIRED_ARG),
1486 VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(LONG_TIMEOUT), BLOCK_SIZE(1));
1488 #ifdef HAVE_MLOCKALL
1491 "Whether mysqld was locked in memory with --memlock",
1492 READ_ONLY GLOBAL_VAR(locked_in_memory), NO_CMD_LINE, DEFAULT(FALSE));
1497 "log_bin",
"Whether the binary log is enabled",
1498 READ_ONLY GLOBAL_VAR(opt_bin_log), NO_CMD_LINE, DEFAULT(FALSE));
1501 "rpl_stop_slave_timeout",
1502 "Timeout in seconds to wait for slave to stop before returning a "
1504 GLOBAL_VAR(rpl_stop_slave_timeout),
CMD_LINE(REQUIRED_ARG),
1505 VALID_RANGE(2, LONG_TIMEOUT), DEFAULT(LONG_TIMEOUT), BLOCK_SIZE(1));
1508 "log_bin_trust_function_creators",
1509 "If set to FALSE (the default), then when --log-bin is used, creation "
1510 "of a stored function (or trigger) is allowed only to users having the "
1511 "SUPER privilege and only if this stored function (trigger) may not "
1512 "break binary logging. Note that if ALL connections to this server "
1513 "ALWAYS use row-based binary logging, the security issues do not "
1514 "exist and the binary logging cannot break, so you can safely set "
1516 GLOBAL_VAR(trust_function_creators),
1517 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1520 "log_bin_use_v1_row_events",
1521 "If equal to 1 then version 1 row events are written to a row based "
1522 "binary log. If equal to 0, then the latest version of events are "
1524 "This option is useful during some upgrades.",
1525 GLOBAL_VAR(log_bin_use_v1_row_events),
1526 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1529 "log_error",
"Error log file",
1530 READ_ONLY GLOBAL_VAR(log_error_file_ptr),
1532 IN_FS_CHARSET, DEFAULT(disabled_my_option));
1535 "log_queries_not_using_indexes",
1536 "Log queries that are executed without benefit of any index to the "
1537 "slow log if it is open",
1538 GLOBAL_VAR(opt_log_queries_not_using_indexes),
1539 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1542 "log_slow_admin_statements",
1543 "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to "
1544 "the slow log if it is open.",
1545 GLOBAL_VAR(opt_log_slow_admin_statements),
1546 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1549 "log_slow_slave_statements",
1550 "Log slow statements executed by slave thread to the slow log if it is open.",
1551 GLOBAL_VAR(opt_log_slow_slave_statements),
1552 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
1554 static bool update_log_throttle_queries_not_using_indexes(
sys_var *
self,
1560 log_throttle_qni.flush(thd);
1564 static Sys_var_ulong Sys_log_throttle_queries_not_using_indexes(
1565 "log_throttle_queries_not_using_indexes",
1566 "Log at most this many 'not using index' warnings per minute to the "
1567 "slow log. Any further warnings will be condensed into a single "
1568 "summary line. A value of 0 disables throttling. "
1569 "Option has no effect unless --log_queries_not_using_indexes is set.",
1570 GLOBAL_VAR(opt_log_throttle_queries_not_using_indexes),
1572 VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1),
1573 NO_MUTEX_GUARD, NOT_IN_BINLOG,
1575 ON_UPDATE(update_log_throttle_queries_not_using_indexes));
1579 "Log some not critical warnings to the log file",
1580 GLOBAL_VAR(log_warnings),
1582 VALID_RANGE(0, ULONG_MAX), DEFAULT(1), BLOCK_SIZE(1));
1584 static bool update_cached_long_query_time(
sys_var *
self, THD *thd,
1587 if (type == OPT_SESSION)
1588 thd->variables.long_query_time=
1589 double2ulonglong(thd->variables.long_query_time_double * 1e6);
1591 global_system_variables.long_query_time=
1592 double2ulonglong(global_system_variables.long_query_time_double * 1e6);
1598 "Log all queries that have taken more than long_query_time seconds "
1599 "to execute to file. The argument will be treated as a decimal value "
1600 "with microsecond precision",
1601 SESSION_VAR(long_query_time_double),
1602 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(10),
1603 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1604 ON_UPDATE(update_cached_long_query_time));
1606 static bool fix_low_prio_updates(
sys_var *
self, THD *thd, enum_var_type type)
1608 if (type == OPT_SESSION)
1609 thd->update_lock_default= (thd->variables.low_priority_updates ?
1610 TL_WRITE_LOW_PRIORITY : TL_WRITE);
1612 thr_upgraded_concurrent_insert_lock=
1613 (global_system_variables.low_priority_updates ?
1614 TL_WRITE_LOW_PRIORITY : TL_WRITE);
1618 "low_priority_updates",
1619 "INSERT/DELETE/UPDATE has lower priority than selects",
1620 SESSION_VAR(low_priority_updates),
1622 DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1623 ON_UPDATE(fix_low_prio_updates));
1626 "lower_case_file_system",
1627 "Case sensitivity of file names on the file system where the "
1628 "data directory is located",
1629 READ_ONLY GLOBAL_VAR(lower_case_file_system), NO_CMD_LINE,
1633 "lower_case_table_names",
1634 "If set to 1 table names are stored in lowercase on disk and table "
1635 "names will be case-insensitive. Should be set to 2 if you are using "
1636 "a case insensitive file system",
1637 READ_ONLY GLOBAL_VAR(lower_case_table_names),
1638 CMD_LINE(OPT_ARG, OPT_LOWER_CASE_TABLE_NAMES),
1640 #ifdef FN_NO_CASE_SENSE
1647 static bool session_readonly(
sys_var *
self, THD *thd,
set_var *var)
1649 if (var->type == OPT_GLOBAL)
1651 my_error(ER_VARIABLE_IS_READONLY, MYF(0),
"SESSION",
1652 self->name.str,
"GLOBAL");
1660 if (session_readonly(
self, thd, var))
1664 if (val < (longlong) global_system_variables.net_buffer_length)
1666 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
1667 WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
1668 "max_allowed_packet",
"net_buffer_length");
1675 "max_allowed_packet",
1676 "Max packet length to send to or receive from the server",
1677 SESSION_VAR(max_allowed_packet),
CMD_LINE(REQUIRED_ARG),
1678 VALID_RANGE(1024, 1024 * 1024 * 1024), DEFAULT(4096 * 1024),
1679 BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
1680 ON_CHECK(check_max_allowed_packet));
1683 "slave_max_allowed_packet",
1684 "The maximum packet length to sent successfully from the master to slave.",
1685 GLOBAL_VAR(slave_max_allowed_packet),
CMD_LINE(REQUIRED_ARG),
1686 VALID_RANGE(1024, MAX_MAX_ALLOWED_PACKET),
1687 DEFAULT(MAX_MAX_ALLOWED_PACKET),
1691 "max_binlog_cache_size",
1692 "Sets the total size of the transactional cache",
1693 GLOBAL_VAR(max_binlog_cache_size),
CMD_LINE(REQUIRED_ARG),
1694 VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
1695 DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
1696 BLOCK_SIZE(IO_SIZE),
1697 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1698 ON_UPDATE(fix_binlog_cache_size));
1701 "max_binlog_stmt_cache_size",
1702 "Sets the total size of the statement cache",
1703 GLOBAL_VAR(max_binlog_stmt_cache_size),
CMD_LINE(REQUIRED_ARG),
1704 VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
1705 DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
1706 BLOCK_SIZE(IO_SIZE),
1707 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1708 ON_UPDATE(fix_binlog_stmt_cache_size));
1710 static bool fix_max_binlog_size(
sys_var *
self, THD *thd, enum_var_type type)
1712 mysql_bin_log.set_max_size(max_binlog_size);
1713 #ifdef HAVE_REPLICATION
1714 if (active_mi != NULL && !max_relay_log_size)
1715 active_mi->rli->relay_log.set_max_size(max_binlog_size);
1721 "Binary log will be rotated automatically when the size exceeds this "
1722 "value. Will also apply to relay logs if max_relay_log_size is 0",
1723 GLOBAL_VAR(max_binlog_size),
CMD_LINE(REQUIRED_ARG),
1724 VALID_RANGE(IO_SIZE, 1024*1024L*1024L), DEFAULT(1024*1024L*1024L),
1725 BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1726 ON_UPDATE(fix_max_binlog_size));
1728 static bool fix_max_connections(
sys_var *
self, THD *thd, enum_var_type type)
1730 #ifndef EMBEDDED_LIBRARY
1731 resize_thr_alarm(max_connections +
1732 global_system_variables.max_insert_delayed_threads + 10);
1738 "max_connections",
"The number of simultaneous clients allowed",
1739 GLOBAL_VAR(max_connections),
CMD_LINE(REQUIRED_ARG),
1740 VALID_RANGE(1, 100000),
1746 ON_UPDATE(fix_max_connections),
1749 sys_var::PARSE_EARLY);
1752 "max_connect_errors",
1753 "If there is more than this number of interrupted connections from "
1754 "a host this host will be blocked from further connections",
1755 GLOBAL_VAR(max_connect_errors),
CMD_LINE(REQUIRED_ARG),
1756 VALID_RANGE(1, ULONG_MAX), DEFAULT(100),
1759 static bool check_max_delayed_threads(
sys_var *
self, THD *thd,
set_var *var)
1761 return var->type != OPT_GLOBAL &&
1764 global_system_variables.max_insert_delayed_threads;
1769 "max_insert_delayed_threads",
1770 "Don't start more than this number of threads to handle INSERT "
1771 "DELAYED statements. If set to zero INSERT DELAYED will be not used."
1772 "This variable is deprecated along with INSERT DELAYED.",
1773 SESSION_VAR(max_insert_delayed_threads),
1774 NO_CMD_LINE, VALID_RANGE(0, 16384), DEFAULT(20),
1775 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
1776 ON_CHECK(check_max_delayed_threads), ON_UPDATE(fix_max_connections),
1780 "max_delayed_threads",
1781 "Don't start more than this number of threads to handle INSERT "
1782 "DELAYED statements. If set to zero INSERT DELAYED will be not used."
1783 "This variable is deprecated along with INSERT DELAYED.",
1784 SESSION_VAR(max_insert_delayed_threads),
1785 CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 16384), DEFAULT(20),
1786 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
1787 ON_CHECK(check_max_delayed_threads), ON_UPDATE(fix_max_connections),
1792 "Max number of errors/warnings to store for a statement",
1793 SESSION_VAR(max_error_count),
CMD_LINE(REQUIRED_ARG),
1794 VALID_RANGE(0, 65535), DEFAULT(DEFAULT_ERROR_COUNT), BLOCK_SIZE(1));
1797 "max_heap_table_size",
1798 "Don't allow creation of heap tables bigger than this",
1799 SESSION_VAR(max_heap_table_size),
CMD_LINE(REQUIRED_ARG),
1800 VALID_RANGE(16384, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
1804 "metadata_locks_cache_size",
"Size of unused metadata locks cache",
1805 READ_ONLY GLOBAL_VAR(mdl_locks_cache_size),
CMD_LINE(REQUIRED_ARG),
1806 VALID_RANGE(1, 1024*1024), DEFAULT(MDL_LOCKS_CACHE_SIZE_DEFAULT),
1810 "metadata_locks_hash_instances",
"Number of metadata locks hash instances",
1811 READ_ONLY GLOBAL_VAR(mdl_locks_hash_partitions),
CMD_LINE(REQUIRED_ARG),
1812 VALID_RANGE(1, 1024), DEFAULT(MDL_LOCKS_HASH_PARTITIONS_DEFAULT),
1817 "This variable is for internal server use",
1818 SESSION_ONLY(pseudo_thread_id),
1819 NO_CMD_LINE, VALID_RANGE(0, ULONG_MAX), DEFAULT(0),
1820 BLOCK_SIZE(1), NO_MUTEX_GUARD, IN_BINLOG,
1821 ON_CHECK(check_has_super));
1823 static bool fix_max_join_size(
sys_var *
self, THD *thd, enum_var_type type)
1825 SV *sv= type == OPT_GLOBAL ? &global_system_variables : &thd->variables;
1826 if (sv->max_join_size == HA_POS_ERROR)
1834 "Joins that are probably going to read more than max_join_size "
1835 "records return an error",
1836 SESSION_VAR(max_join_size),
CMD_LINE(REQUIRED_ARG),
1837 VALID_RANGE(1, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1),
1838 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1839 ON_UPDATE(fix_max_join_size));
1842 "max_seeks_for_key",
1843 "Limit assumed max number of seeks when looking up rows based on a key",
1844 SESSION_VAR(max_seeks_for_key),
CMD_LINE(REQUIRED_ARG),
1845 VALID_RANGE(1, ULONG_MAX), DEFAULT(ULONG_MAX), BLOCK_SIZE(1));
1848 "max_length_for_sort_data",
1849 "Max number of bytes in sorted records",
1850 SESSION_VAR(max_length_for_sort_data),
CMD_LINE(REQUIRED_ARG),
1851 VALID_RANGE(4, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
1853 static PolyLock_mutex PLock_prepared_stmt_count(&LOCK_prepared_stmt_count);
1855 "max_prepared_stmt_count",
1856 "Maximum number of prepared statements in the server",
1857 GLOBAL_VAR(max_prepared_stmt_count),
CMD_LINE(REQUIRED_ARG),
1858 VALID_RANGE(0, 1024*1024), DEFAULT(16382), BLOCK_SIZE(1),
1859 &PLock_prepared_stmt_count);
1861 static bool fix_max_relay_log_size(
sys_var *
self, THD *thd, enum_var_type type)
1863 #ifdef HAVE_REPLICATION
1864 if (active_mi != NULL)
1865 active_mi->rli->relay_log.set_max_size(max_relay_log_size ?
1866 max_relay_log_size: max_binlog_size);
1871 "max_relay_log_size",
1872 "If non-zero: relay log will be rotated automatically when the "
1873 "size exceeds this value; if zero: when the size "
1874 "exceeds max_binlog_size",
1875 GLOBAL_VAR(max_relay_log_size),
CMD_LINE(REQUIRED_ARG),
1876 VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE),
1877 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1878 ON_UPDATE(fix_max_relay_log_size));
1882 "The number of bytes to use when sorting BLOB or TEXT values (only "
1883 "the first max_sort_length bytes of each value are used; the rest "
1885 SESSION_VAR(max_sort_length),
CMD_LINE(REQUIRED_ARG),
1886 VALID_RANGE(4, 8192*1024L), DEFAULT(1024), BLOCK_SIZE(1));
1889 "max_sp_recursion_depth",
1890 "Maximum stored procedure recursion depth",
1891 SESSION_VAR(max_sp_recursion_depth),
CMD_LINE(OPT_ARG),
1892 VALID_RANGE(0, 255), DEFAULT(0), BLOCK_SIZE(1));
1896 "max_user_connections",
1897 "The maximum number of active connections for a single user "
1899 SESSION_VAR(max_user_connections),
CMD_LINE(REQUIRED_ARG),
1900 VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
1901 NOT_IN_BINLOG, ON_CHECK(session_readonly));
1905 "Maximum number of temporary tables a client can keep open at a time",
1906 SESSION_VAR(max_tmp_tables),
CMD_LINE(REQUIRED_ARG),
1907 VALID_RANGE(1, ULONG_MAX), DEFAULT(32), BLOCK_SIZE(1), NO_MUTEX_GUARD,
1908 NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), DEPRECATED(
""));
1911 "max_write_lock_count",
1912 "After this many write locks, allow some read locks to run in between",
1913 GLOBAL_VAR(max_write_lock_count),
CMD_LINE(REQUIRED_ARG),
1914 VALID_RANGE(1, ULONG_MAX), DEFAULT(ULONG_MAX), BLOCK_SIZE(1));
1917 "min_examined_row_limit",
1918 "Don't write queries to slow log that examine fewer rows "
1920 SESSION_VAR(min_examined_row_limit),
CMD_LINE(REQUIRED_ARG),
1921 VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
1925 "named_pipe",
"Enable the named pipe (NT)",
1926 READ_ONLY GLOBAL_VAR(opt_enable_named_pipe),
CMD_LINE(OPT_ARG),
1935 if (session_readonly(
self, thd, var))
1939 if (val > (longlong) global_system_variables.max_allowed_packet)
1941 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
1942 WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
1943 "max_allowed_packet",
"net_buffer_length");
1948 "net_buffer_length",
1949 "Buffer length for TCP/IP and socket communication",
1950 SESSION_VAR(net_buffer_length),
CMD_LINE(REQUIRED_ARG),
1951 VALID_RANGE(1024, 1024*1024), DEFAULT(16384), BLOCK_SIZE(1024),
1952 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_net_buffer_length));
1954 static bool fix_net_read_timeout(
sys_var *
self, THD *thd, enum_var_type type)
1956 if (type != OPT_GLOBAL)
1957 my_net_set_read_timeout(&thd->net, thd->variables.net_read_timeout);
1962 "Number of seconds to wait for more data from a connection before "
1963 "aborting the read",
1964 SESSION_VAR(net_read_timeout),
CMD_LINE(REQUIRED_ARG),
1965 VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_READ_TIMEOUT), BLOCK_SIZE(1),
1966 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1967 ON_UPDATE(fix_net_read_timeout));
1969 static bool fix_net_write_timeout(
sys_var *
self, THD *thd, enum_var_type type)
1971 if (type != OPT_GLOBAL)
1972 my_net_set_write_timeout(&thd->net, thd->variables.net_write_timeout);
1976 "net_write_timeout",
1977 "Number of seconds to wait for a block to be written to a connection "
1978 "before aborting the write",
1979 SESSION_VAR(net_write_timeout),
CMD_LINE(REQUIRED_ARG),
1980 VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(NET_WRITE_TIMEOUT), BLOCK_SIZE(1),
1981 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1982 ON_UPDATE(fix_net_write_timeout));
1984 static bool fix_net_retry_count(
sys_var *
self, THD *thd, enum_var_type type)
1986 if (type != OPT_GLOBAL)
1987 thd->net.retry_count=thd->variables.net_retry_count;
1992 "If a read on a communication port is interrupted, retry this "
1993 "many times before giving up",
1994 SESSION_VAR(net_retry_count),
CMD_LINE(REQUIRED_ARG),
1996 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
1997 ON_UPDATE(fix_net_retry_count));
2000 "new",
"Use very new possible \"unsafe\" functions",
2001 SESSION_VAR(new_mode),
CMD_LINE(OPT_ARG,
'n'), DEFAULT(FALSE));
2004 "old",
"Use compatible behavior",
2005 READ_ONLY GLOBAL_VAR(old_mode),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
2008 "old_alter_table",
"Use old, non-optimized alter table",
2009 SESSION_VAR(old_alter_table),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
2013 "Determine which hash algorithm to use when generating passwords using "
2014 "the PASSWORD() function",
2015 SESSION_VAR(old_passwords),
CMD_LINE(REQUIRED_ARG),
2016 VALID_RANGE(0, 2), DEFAULT(0), BLOCK_SIZE(1));
2020 "If this is not 0, then mysqld will use this value to reserve file "
2021 "descriptors to use with setrlimit(). If this value is 0 then mysqld "
2022 "will reserve max_connections*5 or max_connections + table_cache*2 "
2023 "(whichever is larger) number of file descriptors",
2024 READ_ONLY GLOBAL_VAR(open_files_limit),
CMD_LINE(REQUIRED_ARG),
2025 VALID_RANGE(0, OS_FILE_LIMIT), DEFAULT(0), BLOCK_SIZE(1),
2026 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL), ON_UPDATE(NULL),
2029 sys_var::PARSE_EARLY);
2033 "optimizer_prune_level",
2034 "Controls the heuristic(s) applied during query optimization to prune "
2035 "less-promising partial plans from the optimizer search space. "
2036 "Meaning: 0 - do not apply any heuristic, thus perform exhaustive "
2037 "search; 1 - prune plans based on number of retrieved rows",
2038 SESSION_VAR(optimizer_prune_level),
CMD_LINE(REQUIRED_ARG),
2039 VALID_RANGE(0, 1), DEFAULT(1), BLOCK_SIZE(1));
2042 "optimizer_search_depth",
2043 "Maximum depth of search performed by the query optimizer. Values "
2044 "larger than the number of relations in a query result in better "
2045 "query plans, but take longer to compile a query. Values smaller "
2046 "than the number of tables in a relation result in faster "
2047 "optimization, but may produce very bad query plans. If set to 0, "
2048 "the system will automatically pick a reasonable value",
2049 SESSION_VAR(optimizer_search_depth),
CMD_LINE(REQUIRED_ARG),
2052 static const char *optimizer_switch_names[]=
2054 "index_merge",
"index_merge_union",
"index_merge_sort_union",
2055 "index_merge_intersection",
"engine_condition_pushdown",
2056 "index_condition_pushdown" ,
"mrr",
"mrr_cost_based",
2057 "block_nested_loop",
"batched_key_access",
2058 #ifdef OPTIMIZER_SWITCH_ALL
2059 "materialization",
"semijoin",
"loosescan",
"firstmatch",
2060 "subquery_materialization_cost_based",
2062 "use_index_extensions",
"default", NullS
2065 static bool fix_optimizer_switch(
sys_var *
self, THD *thd,
2068 SV *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables;
2069 sv->engine_condition_pushdown=
2070 test(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
2076 "optimizer_switch=option=val[,option=val...], where option is one of "
2077 "{index_merge, index_merge_union, index_merge_sort_union, "
2078 "index_merge_intersection, engine_condition_pushdown, "
2079 "index_condition_pushdown, mrr, mrr_cost_based"
2081 ", materialization, semijoin, loosescan, firstmatch,"
2082 " subquery_materialization_cost_based"
2084 ", block_nested_loop, batched_key_access, use_index_extensions"
2085 "} and val is one of {on, off, default}",
2086 SESSION_VAR(optimizer_switch),
CMD_LINE(REQUIRED_ARG),
2087 optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT),
2088 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
2089 ON_UPDATE(fix_optimizer_switch));
2092 "end_markers_in_json",
2093 "In JSON output (\"EXPLAIN FORMAT=JSON\" and optimizer trace), "
2094 "if variable is set to 1, repeats the structure's key (if it has one) "
2095 "near the closing bracket",
2096 SESSION_VAR(end_markers_in_json),
CMD_LINE(OPT_ARG),
2099 #ifdef OPTIMIZER_TRACE
2103 "Controls tracing of the Optimizer:"
2104 " optimizer_trace=option=val[,option=val...], where option is one of"
2105 " {enabled, one_line}"
2106 " and val is one of {on, default}",
2107 SESSION_VAR(optimizer_trace),
CMD_LINE(REQUIRED_ARG),
2108 Opt_trace_context::flag_names,
2109 DEFAULT(Opt_trace_context::FLAG_DEFAULT));
2111 export
sys_var *Sys_optimizer_trace_ptr= &Sys_optimizer_trace;
2118 "optimizer_trace_features",
2119 "Enables/disables tracing of selected features of the Optimizer:"
2120 " optimizer_trace_features=option=val[,option=val...], where option is one of"
2121 " {greedy_search, range_optimizer, dynamic_range, repeated_subselect}"
2122 " and val is one of {on, off, default}",
2123 SESSION_VAR(optimizer_trace_features),
CMD_LINE(REQUIRED_ARG),
2124 Opt_trace_context::feature_names,
2125 DEFAULT(Opt_trace_context::default_features));
2128 static bool optimizer_trace_update(
sys_var *
self, THD *thd,
2131 thd->opt_trace.reset();
2136 "optimizer_trace_offset",
2137 "Offset of first optimizer trace to show; see manual",
2138 SESSION_VAR(optimizer_trace_offset),
CMD_LINE(REQUIRED_ARG),
2139 VALID_RANGE(LONG_MIN, LONG_MAX), DEFAULT(-1), BLOCK_SIZE(1),
2140 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
2141 ON_UPDATE(optimizer_trace_update));
2144 "optimizer_trace_limit",
2145 "Maximum number of shown optimizer traces",
2146 SESSION_VAR(optimizer_trace_limit),
CMD_LINE(REQUIRED_ARG),
2147 VALID_RANGE(0, LONG_MAX), DEFAULT(1), BLOCK_SIZE(1),
2148 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
2149 ON_UPDATE(optimizer_trace_update));
2152 "optimizer_trace_max_mem_size",
2153 "Maximum allowed cumulated size of stored optimizer traces",
2154 SESSION_VAR(optimizer_trace_max_mem_size),
CMD_LINE(REQUIRED_ARG),
2155 VALID_RANGE(0, ULONG_MAX), DEFAULT(1024*16), BLOCK_SIZE(1));
2160 "pid_file",
"Pid file used by safe_mysqld",
2161 READ_ONLY GLOBAL_VAR(pidfile_name_ptr),
CMD_LINE(REQUIRED_ARG),
2162 IN_FS_CHARSET, DEFAULT(0));
2165 "plugin_dir",
"Directory for plugins",
2166 READ_ONLY GLOBAL_VAR(opt_plugin_dir_ptr),
CMD_LINE(REQUIRED_ARG),
2167 IN_FS_CHARSET, DEFAULT(0));
2171 "Port number to use for connection or 0 to default to, "
2172 "my.cnf, $MYSQL_TCP_PORT, "
2173 #
if MYSQL_PORT_DEFAULT == 0
2176 "built-in default (" STRINGIFY_ARG(MYSQL_PORT)
"), whatever comes first",
2177 READ_ONLY GLOBAL_VAR(mysqld_port),
CMD_LINE(REQUIRED_ARG,
'P'),
2178 VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
2181 "preload_buffer_size",
2182 "The size of the buffer that is allocated when preloading indexes",
2183 SESSION_VAR(preload_buff_size),
CMD_LINE(REQUIRED_ARG),
2184 VALID_RANGE(1024, 1024*1024*1024), DEFAULT(32768), BLOCK_SIZE(1));
2188 "The version of the client/server protocol used by the MySQL server",
2189 READ_ONLY GLOBAL_VAR(protocol_version), NO_CMD_LINE,
2190 VALID_RANGE(0, ~0), DEFAULT(PROTOCOL_VERSION), BLOCK_SIZE(1));
2193 "proxy_user",
"The proxy user account name used when logging in",
2197 "external_user",
"The external user account used when logging in",
2202 "Each thread that does a sequential scan allocates a buffer of "
2203 "this size for each table it scans. If you do many sequential scans, "
2204 "you may want to increase this value",
2205 SESSION_VAR(read_buff_size),
CMD_LINE(REQUIRED_ARG),
2206 VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024),
2207 BLOCK_SIZE(IO_SIZE));
2209 static bool check_read_only(
sys_var *
self, THD *thd,
set_var *var)
2212 if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction())
2214 my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
2219 static bool fix_read_only(
sys_var *
self, THD *thd, enum_var_type type)
2222 my_bool new_read_only= read_only;
2223 DBUG_ENTER(
"sys_var_opt_readonly::update");
2225 if (read_only == FALSE || read_only == opt_readonly)
2227 opt_readonly= read_only;
2231 if (check_read_only(
self, thd, 0))
2234 if (thd->global_read_lock.is_acquired())
2242 opt_readonly= read_only;
2258 read_only= opt_readonly;
2261 if (thd->global_read_lock.lock_global_read_lock(thd))
2262 goto end_with_mutex_unlock;
2264 if ((result= thd->global_read_lock.make_global_read_lock_block_commit(thd)))
2265 goto end_with_read_lock;
2268 opt_readonly= new_read_only;
2273 thd->global_read_lock.unlock_global_read_lock(thd);
2274 end_with_mutex_unlock:
2277 read_only= opt_readonly;
2278 DBUG_RETURN(result);
2292 "Make all non-temporary tables read-only, with the exception for "
2293 "replication (slave) threads and users with the SUPER privilege",
2294 GLOBAL_VAR(read_only),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
2295 NO_MUTEX_GUARD, NOT_IN_BINLOG,
2296 ON_CHECK(check_read_only), ON_UPDATE(fix_read_only));
2300 "read_rnd_buffer_size",
2301 "When reading rows in sorted order after a sort, the rows are read "
2302 "through this buffer to avoid a disk seeks",
2303 SESSION_VAR(read_rnd_buff_size),
CMD_LINE(REQUIRED_ARG),
2304 VALID_RANGE(1, INT_MAX32), DEFAULT(256*1024), BLOCK_SIZE(1));
2307 "div_precision_increment",
"Precision of the result of '/' "
2308 "operator will be increased on that value",
2309 SESSION_VAR(div_precincrement),
CMD_LINE(REQUIRED_ARG),
2310 VALID_RANGE(0, DECIMAL_MAX_SCALE), DEFAULT(4), BLOCK_SIZE(1));
2313 "eq_range_index_dive_limit",
2314 "The optimizer will use existing index statistics instead of "
2315 "doing index dives for equality ranges if the number of equality "
2316 "ranges for the index is larger than or equal to this number. "
2317 "If set to 0, index dives are always used.",
2318 SESSION_VAR(eq_range_index_dive_limit),
CMD_LINE(REQUIRED_ARG),
2319 VALID_RANGE(0, UINT_MAX32), DEFAULT(10), BLOCK_SIZE(1));
2322 "range_alloc_block_size",
2323 "Allocation block size for storing ranges during optimization",
2324 SESSION_VAR(range_alloc_block_size),
CMD_LINE(REQUIRED_ARG),
2325 VALID_RANGE(RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX),
2326 DEFAULT(RANGE_ALLOC_BLOCK_SIZE), BLOCK_SIZE(1024));
2329 "multi_range_count",
2330 "Number of key ranges to request at once. "
2331 "This variable has no effect, and is deprecated. "
2332 "It will be removed in a future release.",
2333 SESSION_VAR(multi_range_count),
CMD_LINE(REQUIRED_ARG),
2334 VALID_RANGE(1, ULONG_MAX), DEFAULT(256), BLOCK_SIZE(1),
2335 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
2338 static bool fix_thd_mem_root(
sys_var *
self, THD *thd, enum_var_type type)
2340 if (type != OPT_GLOBAL)
2341 reset_root_defaults(thd->mem_root,
2342 thd->variables.query_alloc_block_size,
2343 thd->variables.query_prealloc_size);
2347 "query_alloc_block_size",
2348 "Allocation block size for query parsing and execution",
2349 SESSION_VAR(query_alloc_block_size),
CMD_LINE(REQUIRED_ARG),
2350 VALID_RANGE(1024, ULONG_MAX), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
2351 BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
2352 ON_UPDATE(fix_thd_mem_root));
2355 "query_prealloc_size",
2356 "Persistent buffer for query parsing and execution",
2357 SESSION_VAR(query_prealloc_size),
CMD_LINE(REQUIRED_ARG),
2358 VALID_RANGE(QUERY_ALLOC_PREALLOC_SIZE, ULONG_MAX),
2359 DEFAULT(QUERY_ALLOC_PREALLOC_SIZE),
2360 BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
2361 ON_UPDATE(fix_thd_mem_root));
2365 "shared_memory",
"Enable the shared memory",
2366 READ_ONLY GLOBAL_VAR(opt_enable_shared_memory),
CMD_LINE(OPT_ARG),
2370 "shared_memory_base_name",
"Base name of shared memory",
2371 READ_ONLY GLOBAL_VAR(shared_memory_base_name),
CMD_LINE(REQUIRED_ARG),
2372 IN_FS_CHARSET, DEFAULT(0));
2377 "skip_external_locking",
"Don't use system (external) locking",
2378 READ_ONLY GLOBAL_VAR(my_disable_locking), NO_CMD_LINE, DEFAULT(TRUE));
2381 "skip_networking",
"Don't allow connection with TCP/IP",
2382 READ_ONLY GLOBAL_VAR(opt_disable_networking),
CMD_LINE(OPT_ARG),
2386 "skip_name_resolve",
2387 "Don't resolve hostnames. All hostnames are IP's or 'localhost'.",
2388 READ_ONLY GLOBAL_VAR(opt_skip_name_resolve),
2389 CMD_LINE(OPT_ARG, OPT_SKIP_RESOLVE),
2393 "skip_show_database",
"Don't allow 'SHOW DATABASE' commands",
2394 READ_ONLY GLOBAL_VAR(opt_skip_show_db),
CMD_LINE(OPT_ARG),
2398 "socket",
"Socket file to use for connection",
2399 READ_ONLY GLOBAL_VAR(mysqld_unix_port),
CMD_LINE(REQUIRED_ARG),
2400 IN_FS_CHARSET, DEFAULT(0));
2408 "thread_concurrency",
2409 "Permits the application to give the threads system a hint for "
2410 "the desired number of threads that should be run at the same time. "
2411 "This variable has no effect, and is deprecated. "
2412 "It will be removed in a future release. ",
2413 READ_ONLY GLOBAL_VAR(concurrency),
CMD_LINE(REQUIRED_ARG),
2414 VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1),
2415 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
2419 "thread_stack",
"The stack size for each thread",
2420 READ_ONLY GLOBAL_VAR(my_thread_stack_size),
CMD_LINE(REQUIRED_ARG),
2421 VALID_RANGE(128*1024, ULONG_MAX), DEFAULT(DEFAULT_THREAD_STACK),
2425 "tmpdir",
"Path for temporary files. Several paths may "
2426 "be specified, separated by a "
2427 #
if defined(__WIN__)
2432 ", in this case they are used in a round-robin fashion",
2433 READ_ONLY GLOBAL_VAR(opt_mysql_tmpdir),
CMD_LINE(REQUIRED_ARG,
't'),
2434 IN_FS_CHARSET, DEFAULT(0));
2436 static bool fix_trans_mem_root(
sys_var *
self, THD *thd, enum_var_type type)
2438 if (type != OPT_GLOBAL)
2439 reset_root_defaults(&thd->transaction.mem_root,
2440 thd->variables.trans_alloc_block_size,
2441 thd->variables.trans_prealloc_size);
2445 "transaction_alloc_block_size",
2446 "Allocation block size for transactions to be stored in binary log",
2447 SESSION_VAR(trans_alloc_block_size),
CMD_LINE(REQUIRED_ARG),
2448 VALID_RANGE(1024, ULONG_MAX), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
2449 BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
2450 ON_UPDATE(fix_trans_mem_root));
2453 "transaction_prealloc_size",
2454 "Persistent buffer for transactions to be stored in binary log",
2455 SESSION_VAR(trans_prealloc_size),
CMD_LINE(REQUIRED_ARG),
2456 VALID_RANGE(1024, ULONG_MAX), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
2457 BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
2458 ON_UPDATE(fix_trans_mem_root));
2460 static const char *thread_handling_names[]=
2462 "one-thread-per-connection",
"no-threads",
"loaded-dynamically",
2467 "Define threads usage for handling queries, one of "
2468 "one-thread-per-connection, no-threads, loaded-dynamically"
2469 , READ_ONLY GLOBAL_VAR(thread_handling),
CMD_LINE(REQUIRED_ARG),
2470 thread_handling_names, DEFAULT(0));
2472 #ifdef HAVE_QUERY_CACHE
2473 static bool fix_query_cache_size(
sys_var *
self, THD *thd, enum_var_type type)
2475 ulong new_cache_size= query_cache.resize(query_cache_size);
2480 if (query_cache_size != new_cache_size)
2481 push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
2482 ER_WARN_QC_RESIZE, ER(ER_WARN_QC_RESIZE),
2483 query_cache_size, new_cache_size);
2485 query_cache_size= new_cache_size;
2490 "The memory allocated to store results from old queries",
2491 GLOBAL_VAR(query_cache_size),
CMD_LINE(REQUIRED_ARG),
2492 VALID_RANGE(0, ULONG_MAX), DEFAULT(1024
U*1024
U), BLOCK_SIZE(1024),
2493 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
2494 ON_UPDATE(fix_query_cache_size));
2497 "query_cache_limit",
2498 "Don't cache results that are bigger than this",
2499 GLOBAL_VAR(query_cache.query_cache_limit),
CMD_LINE(REQUIRED_ARG),
2500 VALID_RANGE(0, ULONG_MAX), DEFAULT(1024*1024), BLOCK_SIZE(1));
2502 static bool fix_qcache_min_res_unit(
sys_var *
self, THD *thd, enum_var_type type)
2504 query_cache_min_res_unit=
2505 query_cache.set_min_res_unit(query_cache_min_res_unit);
2509 "query_cache_min_res_unit",
2510 "The minimum size for blocks allocated by the query cache",
2511 GLOBAL_VAR(query_cache_min_res_unit),
CMD_LINE(REQUIRED_ARG),
2512 VALID_RANGE(0, ULONG_MAX), DEFAULT(QUERY_CACHE_MIN_RESULT_DATA_SIZE),
2513 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
2514 ON_UPDATE(fix_qcache_min_res_unit));
2516 static const char *query_cache_type_names[]= {
"OFF",
"ON",
"DEMAND", 0 };
2517 static bool check_query_cache_type(
sys_var *
self, THD *thd,
set_var *var)
2519 if (query_cache.is_disabled())
2521 my_error(ER_QUERY_CACHE_DISABLED, MYF(0));
2528 "OFF = Don't cache or retrieve results. ON = Cache all results "
2529 "except SELECT SQL_NO_CACHE ... queries. DEMAND = Cache only "
2530 "SELECT SQL_CACHE ... queries",
2531 SESSION_VAR(query_cache_type),
CMD_LINE(REQUIRED_ARG),
2532 query_cache_type_names, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
2533 ON_CHECK(check_query_cache_type));
2536 "query_cache_wlock_invalidate",
2537 "Invalidate queries in query cache on LOCK for write",
2538 SESSION_VAR(query_cache_wlock_invalidate),
CMD_LINE(OPT_ARG),
2547 WARN_DEPRECATED(thd,
"pre-4.1 password hash",
"post-4.1 password hash");
2554 "Disallow authentication for accounts that have old (pre-4.1) "
2556 GLOBAL_VAR(opt_secure_auth),
CMD_LINE(OPT_ARG, OPT_SECURE_AUTH),
2558 NO_MUTEX_GUARD, NOT_IN_BINLOG,
2559 ON_CHECK(on_check_opt_secure_auth)
2564 "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
2565 "within specified directory",
2566 READ_ONLY GLOBAL_VAR(opt_secure_file_priv),
2567 CMD_LINE(REQUIRED_ARG), IN_FS_CHARSET, DEFAULT(0));
2569 static bool fix_server_id(
sys_var *
self, THD *thd, enum_var_type type)
2571 server_id_supplied = 1;
2572 thd->server_id= server_id;
2577 "Uniquely identifies the server instance in the community of "
2578 "replication partners",
2579 GLOBAL_VAR(server_id),
CMD_LINE(REQUIRED_ARG, OPT_SERVER_ID),
2580 VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
2581 NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_server_id));
2585 "Uniquely identifies the server instance in the universe",
2586 READ_ONLY GLOBAL_VAR(server_uuid_ptr),
2587 NO_CMD_LINE, IN_FS_CHARSET, DEFAULT(server_uuid));
2591 "Set number of significant bits in server-id",
2592 GLOBAL_VAR(opt_server_id_bits),
CMD_LINE(REQUIRED_ARG),
2593 VALID_RANGE(0, 32), DEFAULT(32), BLOCK_SIZE(1));
2596 "slave_compressed_protocol",
2597 "Use compression on master/slave protocol",
2598 GLOBAL_VAR(opt_slave_compressed_protocol),
CMD_LINE(OPT_ARG),
2601 #ifdef HAVE_REPLICATION
2602 static const char *slave_exec_mode_names[]=
2603 {
"STRICT",
"IDEMPOTENT", 0};
2606 "Modes for how replication events should be executed. Legal values "
2607 "are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, "
2608 "replication will not stop for operations that are idempotent. "
2609 "In STRICT mode, replication will stop on any unexpected difference "
2610 "between the master and the slave",
2611 GLOBAL_VAR(slave_exec_mode_options),
CMD_LINE(REQUIRED_ARG),
2612 slave_exec_mode_names, DEFAULT(SLAVE_EXEC_MODE_STRICT));
2613 const char *slave_type_conversions_name[]=
2614 {
"ALL_LOSSY",
"ALL_NON_LOSSY",
"ALL_UNSIGNED",
"ALL_SIGNED", 0};
2616 "slave_type_conversions",
2617 "Set of slave type conversions that are enabled. Legal values are:"
2618 " ALL_LOSSY to enable lossy conversions,"
2619 " ALL_NON_LOSSY to enable non-lossy conversions,"
2620 " ALL_UNSIGNED to treat all integer column type data to be unsigned values, and"
2621 " ALL_SIGNED to treat all integer column type data to be signed values."
2622 " Default treatment is ALL_SIGNED. If ALL_SIGNED and ALL_UNSIGNED both are"
2623 " specifed, ALL_SIGNED will take high priority than ALL_UNSIGNED."
2624 " If the variable is assigned the empty set, no conversions are"
2625 " allowed and it is expected that the types match exactly.",
2626 GLOBAL_VAR(slave_type_conversions_options),
CMD_LINE(REQUIRED_ARG),
2627 slave_type_conversions_name,
2631 "slave_sql_verify_checksum",
2632 "Force checksum verification of replication events after reading them "
2633 "from relay log. Note: Events are always checksum-verified by slave on "
2634 "receiving them from the network before writing them to the relay "
2635 "log. Enabled by default.",
2636 GLOBAL_VAR(opt_slave_sql_verify_checksum),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
2638 static bool slave_rows_search_algorithms_check(
sys_var *
self, THD *thd,
set_var *var)
2642 if (check_not_null(
self, thd, var))
2646 res= var->
value? var->
value->val_str(&str) : NULL;
2647 if (res && res->is_empty())
2653 static const char *slave_rows_search_algorithms_names[]= {
"TABLE_SCAN",
"INDEX_SCAN",
"HASH_SCAN", 0};
2655 "slave_rows_search_algorithms",
2656 "Set of searching algorithms that the slave will use while "
2657 "searching for records from the storage engine to either "
2658 "updated or deleted them. Possible values are: INDEX_SCAN, "
2659 "TABLE_SCAN and HASH_SCAN. Any combination is allowed, and "
2660 "the slave will always pick the most suitable algorithm for "
2661 "any given scenario. "
2662 "(Default: INDEX_SCAN, TABLE_SCAN).",
2663 GLOBAL_VAR(slave_rows_search_algorithms_options),
CMD_LINE(REQUIRED_ARG),
2664 slave_rows_search_algorithms_names,
2665 DEFAULT(SLAVE_ROWS_INDEX_SCAN | SLAVE_ROWS_TABLE_SCAN), NO_MUTEX_GUARD,
2666 NOT_IN_BINLOG, ON_CHECK(slave_rows_search_algorithms_check), ON_UPDATE(NULL));
2669 bool Sys_var_enum_binlog_checksum::global_update(THD *thd,
set_var *var)
2671 bool check_purge=
false;
2674 if(mysql_bin_log.is_open())
2679 mysql_bin_log.checksum_alg_reset= (uint8) var->save_result.
ulonglong_value;
2680 mysql_bin_log.
rotate(
true, &check_purge);
2682 mysql_bin_log.checksum_alg_reset= BINLOG_CHECKSUM_ALG_UNDEF;
2688 DBUG_ASSERT((ulong) binlog_checksum_options == var->save_result.
ulonglong_value);
2689 DBUG_ASSERT(mysql_bin_log.checksum_alg_reset == BINLOG_CHECKSUM_ALG_UNDEF);
2693 mysql_bin_log.
purge();
2699 "binlog_checksum",
"Type of BINLOG_CHECKSUM_ALG. Include checksum for "
2700 "log events in the binary log. Possible values are NONE and CRC32; "
2701 "default is CRC32.",
2702 GLOBAL_VAR(binlog_checksum_options),
CMD_LINE(REQUIRED_ARG),
2703 binlog_checksum_type_names, DEFAULT(BINLOG_CHECKSUM_ALG_CRC32),
2704 NO_MUTEX_GUARD, NOT_IN_BINLOG);
2707 "master_verify_checksum",
2708 "Force checksum verification of logged events in binary log before "
2709 "sending them to slaves or printing them in output of SHOW BINLOG EVENTS. "
2710 "Disabled by default.",
2711 GLOBAL_VAR(opt_master_verify_checksum),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
2715 "If creating the thread takes longer than this value (in seconds), "
2716 "the Slow_launch_threads counter will be incremented",
2717 GLOBAL_VAR(slow_launch_time),
CMD_LINE(REQUIRED_ARG),
2718 VALID_RANGE(0, LONG_TIMEOUT), DEFAULT(2), BLOCK_SIZE(1));
2722 "Each thread that needs to do a sort allocates a buffer of this size",
2723 SESSION_VAR(sortbuff_size),
CMD_LINE(REQUIRED_ARG),
2724 VALID_RANGE(MIN_SORT_MEMORY, ULONG_MAX), DEFAULT(DEFAULT_SORT_MEMORY),
2727 export sql_mode_t expand_sql_mode(sql_mode_t sql_mode)
2729 if (sql_mode & MODE_ANSI)
2739 sql_mode|= (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
2742 if (sql_mode & MODE_ORACLE)
2743 sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
2745 MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
2746 MODE_NO_FIELD_OPTIONS | MODE_NO_AUTO_CREATE_USER);
2747 if (sql_mode & MODE_MSSQL)
2748 sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
2750 MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
2751 MODE_NO_FIELD_OPTIONS);
2752 if (sql_mode & MODE_POSTGRESQL)
2753 sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
2755 MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
2756 MODE_NO_FIELD_OPTIONS);
2757 if (sql_mode & MODE_DB2)
2758 sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
2760 MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
2761 MODE_NO_FIELD_OPTIONS);
2762 if (sql_mode & MODE_MAXDB)
2763 sql_mode|= (MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
2765 MODE_NO_KEY_OPTIONS | MODE_NO_TABLE_OPTIONS |
2766 MODE_NO_FIELD_OPTIONS | MODE_NO_AUTO_CREATE_USER);
2767 if (sql_mode & MODE_MYSQL40)
2768 sql_mode|= MODE_HIGH_NOT_PRECEDENCE;
2769 if (sql_mode & MODE_MYSQL323)
2770 sql_mode|= MODE_HIGH_NOT_PRECEDENCE;
2771 if (sql_mode & MODE_TRADITIONAL)
2772 sql_mode|= (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES |
2773 MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
2774 MODE_ERROR_FOR_DIVISION_BY_ZERO | MODE_NO_AUTO_CREATE_USER |
2775 MODE_NO_ENGINE_SUBSTITUTION);
2778 static bool check_sql_mode(
sys_var *
self, THD *thd,
set_var *var)
2784 static bool fix_sql_mode(
sys_var *
self, THD *thd, enum_var_type type)
2786 if (type != OPT_GLOBAL)
2789 if (thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
2790 thd->server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;
2792 thd->server_status&= ~SERVER_STATUS_NO_BACKSLASH_ESCAPES;
2800 static const char *sql_mode_names[]=
2802 "REAL_AS_FLOAT",
"PIPES_AS_CONCAT",
"ANSI_QUOTES",
"IGNORE_SPACE",
",",
2803 "ONLY_FULL_GROUP_BY",
"NO_UNSIGNED_SUBTRACTION",
"NO_DIR_IN_CREATE",
2804 "POSTGRESQL",
"ORACLE",
"MSSQL",
"DB2",
"MAXDB",
"NO_KEY_OPTIONS",
2805 "NO_TABLE_OPTIONS",
"NO_FIELD_OPTIONS",
"MYSQL323",
"MYSQL40",
"ANSI",
2806 "NO_AUTO_VALUE_ON_ZERO",
"NO_BACKSLASH_ESCAPES",
"STRICT_TRANS_TABLES",
2807 "STRICT_ALL_TABLES",
"NO_ZERO_IN_DATE",
"NO_ZERO_DATE",
2808 "ALLOW_INVALID_DATES",
"ERROR_FOR_DIVISION_BY_ZERO",
"TRADITIONAL",
2809 "NO_AUTO_CREATE_USER",
"HIGH_NOT_PRECEDENCE",
"NO_ENGINE_SUBSTITUTION",
2810 "PAD_CHAR_TO_FULL_LENGTH",
2813 export
bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode,
2816 set_to_string(thd, ls, sql_mode, sql_mode_names);
2817 return ls->str == 0;
2826 "Syntax: sql-mode=mode[,mode[,mode...]]. See the manual for the "
2827 "complete list of valid sql modes",
2828 SESSION_VAR(sql_mode),
CMD_LINE(REQUIRED_ARG),
2829 sql_mode_names, DEFAULT(MODE_NO_ENGINE_SUBSTITUTION), NO_MUTEX_GUARD,
2830 NOT_IN_BINLOG, ON_CHECK(check_sql_mode), ON_UPDATE(fix_sql_mode));
2832 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
2833 #define SSL_OPT(X) CMD_LINE(REQUIRED_ARG,X)
2835 #define SSL_OPT(X) NO_CMD_LINE
2840 "CA file in PEM format (check OpenSSL docs, implies --ssl)",
2841 READ_ONLY GLOBAL_VAR(opt_ssl_ca), SSL_OPT(OPT_SSL_CA),
2842 IN_FS_CHARSET, DEFAULT(0));
2846 "CA directory (check OpenSSL docs, implies --ssl)",
2847 READ_ONLY GLOBAL_VAR(opt_ssl_capath), SSL_OPT(OPT_SSL_CAPATH),
2848 IN_FS_CHARSET, DEFAULT(0));
2851 "ssl_cert",
"X509 cert in PEM format (implies --ssl)",
2852 READ_ONLY GLOBAL_VAR(opt_ssl_cert), SSL_OPT(OPT_SSL_CERT),
2853 IN_FS_CHARSET, DEFAULT(0));
2856 "ssl_cipher",
"SSL cipher to use (implies --ssl)",
2857 READ_ONLY GLOBAL_VAR(opt_ssl_cipher), SSL_OPT(OPT_SSL_CIPHER),
2858 IN_FS_CHARSET, DEFAULT(0));
2861 "ssl_key",
"X509 key in PEM format (implies --ssl)",
2862 READ_ONLY GLOBAL_VAR(opt_ssl_key), SSL_OPT(OPT_SSL_KEY),
2863 IN_FS_CHARSET, DEFAULT(0));
2867 "CRL file in PEM format (check OpenSSL docs, implies --ssl)",
2868 READ_ONLY GLOBAL_VAR(opt_ssl_crl), SSL_OPT(OPT_SSL_CRL),
2869 IN_FS_CHARSET, DEFAULT(0));
2873 "CRL directory (check OpenSSL docs, implies --ssl)",
2874 READ_ONLY GLOBAL_VAR(opt_ssl_crlpath), SSL_OPT(OPT_SSL_CRLPATH),
2875 IN_FS_CHARSET, DEFAULT(0));
2879 static const char *updatable_views_with_limit_names[]= {
"NO",
"YES", 0};
2881 "updatable_views_with_limit",
2882 "YES = Don't issue an error message (warning only) if a VIEW without "
2883 "presence of a key of the underlying table is used in queries with a "
2884 "LIMIT clause for updating. NO = Prohibit update of a VIEW, which "
2885 "does not contain a key of the underlying table and the query uses "
2886 "a LIMIT clause (usually get from GUI tools)",
2887 SESSION_VAR(updatable_views_with_limit),
CMD_LINE(REQUIRED_ARG),
2888 updatable_views_with_limit_names, DEFAULT(TRUE));
2891 "sync_frm",
"Sync .frm files to disk on creation",
2892 GLOBAL_VAR(opt_sync_frm),
CMD_LINE(OPT_ARG),
2895 static char *system_time_zone_ptr;
2897 "system_time_zone",
"The server system time zone",
2898 READ_ONLY GLOBAL_VAR(system_time_zone_ptr), NO_CMD_LINE,
2899 IN_FS_CHARSET, DEFAULT(system_time_zone));
2902 "table_definition_cache",
2903 "The number of cached table definitions",
2904 GLOBAL_VAR(table_def_size),
2905 CMD_LINE(REQUIRED_ARG, OPT_TABLE_DEFINITION_CACHE),
2907 DEFAULT(TABLE_DEF_CACHE_DEFAULT),
2915 sys_var::PARSE_EARLY);
2917 static bool fix_table_cache_size(
sys_var *
self, THD *thd, enum_var_type type)
2924 table_cache_size_per_instance= table_cache_size / table_cache_instances;
2929 "table_open_cache",
"The number of cached open tables "
2930 "(total for all table cache instances)",
2931 GLOBAL_VAR(table_cache_size),
CMD_LINE(REQUIRED_ARG),
2932 VALID_RANGE(1, 512*1024), DEFAULT(TABLE_OPEN_CACHE_DEFAULT),
2933 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
2934 ON_UPDATE(fix_table_cache_size),
2937 sys_var::PARSE_EARLY);
2940 "table_open_cache_instances",
"The number of table cache instances",
2941 READ_ONLY GLOBAL_VAR(table_cache_instances),
CMD_LINE(REQUIRED_ARG),
2943 BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
2944 ON_UPDATE(NULL), NULL,
2951 sys_var::PARSE_EARLY);
2954 "thread_cache_size",
2955 "How many threads we should keep in a cache for reuse",
2956 GLOBAL_VAR(max_blocked_pthreads),
2957 CMD_LINE(REQUIRED_ARG, OPT_THREAD_CACHE_SIZE),
2958 VALID_RANGE(0, 16384), DEFAULT(0), BLOCK_SIZE(1));
2965 static bool check_tx_isolation(
sys_var *
self, THD *thd,
set_var *var)
2967 if (var->type == OPT_DEFAULT && thd->in_active_multi_stmt_transaction())
2969 DBUG_ASSERT(thd->in_multi_stmt_transaction_mode());
2970 my_error(ER_CANT_CHANGE_TX_CHARACTERISTICS, MYF(0));
2977 bool Sys_var_tx_isolation::session_update(THD *thd,
set_var *var)
2979 if (var->type == OPT_SESSION && Sys_var_enum::session_update(thd, var))
2981 if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
2996 thd->tx_isolation= (enum_tx_isolation) var->save_result.
ulonglong_value;
3004 "tx_isolation",
"Default transaction isolation level",
3005 SESSION_VAR(tx_isolation), NO_CMD_LINE,
3006 tx_isolation_names, DEFAULT(ISO_REPEATABLE_READ),
3007 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_isolation));
3015 static bool check_tx_read_only(
sys_var *
self, THD *thd,
set_var *var)
3017 if (var->type == OPT_DEFAULT && thd->in_active_multi_stmt_transaction())
3019 DBUG_ASSERT(thd->in_multi_stmt_transaction_mode());
3020 my_error(ER_CANT_CHANGE_TX_CHARACTERISTICS, MYF(0));
3027 bool Sys_var_tx_read_only::session_update(THD *thd,
set_var *var)
3029 if (var->type == OPT_SESSION && Sys_var_mybool::session_update(thd, var))
3031 if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
3041 "tx_read_only",
"Set default transaction access mode to read only.",
3042 SESSION_VAR(tx_read_only), NO_CMD_LINE, DEFAULT(0),
3043 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_tx_read_only));
3047 "If an internal in-memory temporary table exceeds this size, MySQL "
3048 "will automatically convert it to an on-disk MyISAM table",
3049 SESSION_VAR(tmp_table_size),
CMD_LINE(REQUIRED_ARG),
3050 VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024),
3055 "Specify whether to time mutexes (only InnoDB mutexes are currently "
3057 GLOBAL_VAR(timed_mutexes),
CMD_LINE(OPT_ARG), DEFAULT(0));
3059 static char *server_version_ptr;
3061 "version",
"Server version",
3062 READ_ONLY GLOBAL_VAR(server_version_ptr), NO_CMD_LINE,
3063 IN_SYSTEM_CHARSET, DEFAULT(server_version));
3065 static char *server_version_comment_ptr;
3067 "version_comment",
"version_comment",
3068 READ_ONLY GLOBAL_VAR(server_version_comment_ptr), NO_CMD_LINE,
3069 IN_SYSTEM_CHARSET, DEFAULT(MYSQL_COMPILATION_COMMENT));
3071 static char *server_version_compile_machine_ptr;
3073 "version_compile_machine",
"version_compile_machine",
3074 READ_ONLY GLOBAL_VAR(server_version_compile_machine_ptr), NO_CMD_LINE,
3075 IN_SYSTEM_CHARSET, DEFAULT(MACHINE_TYPE));
3077 static char *server_version_compile_os_ptr;
3079 "version_compile_os",
"version_compile_os",
3080 READ_ONLY GLOBAL_VAR(server_version_compile_os_ptr), NO_CMD_LINE,
3081 IN_SYSTEM_CHARSET, DEFAULT(SYSTEM_TYPE));
3085 "The number of seconds the server waits for activity on a "
3086 "connection before closing it",
3087 SESSION_VAR(net_wait_timeout),
CMD_LINE(REQUIRED_ARG),
3088 VALID_RANGE(1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT)),
3089 DEFAULT(NET_WAIT_TIMEOUT), BLOCK_SIZE(1));
3092 "default_storage_engine",
"The default storage engine for new tables",
3093 SESSION_VAR(table_plugin), NO_CMD_LINE,
3094 MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
3095 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
3098 "default_tmp_storage_engine",
"The default storage engine for new explict temporary tables",
3099 SESSION_VAR(temp_table_plugin), NO_CMD_LINE,
3100 MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_tmp_storage_engine),
3101 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
3105 "storage_engine",
"Alias for @@default_storage_engine. Deprecated",
3106 SESSION_VAR(table_plugin), NO_CMD_LINE,
3107 MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
3108 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null),
3109 ON_UPDATE(NULL), DEPRECATED(
"'@@default_storage_engine'"));
3111 #if defined(ENABLED_DEBUG_SYNC)
3124 static Sys_var_debug_sync Sys_debug_sync(
3125 "debug_sync",
"Debug Sync Facility",
3126 sys_var::ONLY_SESSION, NO_CMD_LINE,
3127 DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
3140 "date_format",
"The DATE format (ignored)",
3141 READ_ONLY GLOBAL_VAR(global_date_format.format.str),
3142 CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET,
3143 DEFAULT(known_date_time_formats[ISO_FORMAT].date_format),
3144 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
3148 "datetime_format",
"The DATETIME format (ignored)",
3149 READ_ONLY GLOBAL_VAR(global_datetime_format.format.str),
3150 CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET,
3151 DEFAULT(known_date_time_formats[ISO_FORMAT].datetime_format),
3152 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
3156 "time_format",
"The TIME format (ignored)",
3157 READ_ONLY GLOBAL_VAR(global_time_format.format.str),
3158 CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET,
3159 DEFAULT(known_date_time_formats[ISO_FORMAT].time_format),
3160 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
3163 static bool fix_autocommit(
sys_var *
self, THD *thd, enum_var_type type)
3165 if (type == OPT_GLOBAL)
3168 global_system_variables.
option_bits&= ~OPTION_NOT_AUTOCOMMIT;
3170 global_system_variables.
option_bits|= OPTION_NOT_AUTOCOMMIT;
3175 thd->variables.option_bits & OPTION_NOT_AUTOCOMMIT)
3178 if (trans_commit_stmt(thd) || trans_commit(thd))
3193 thd->variables.option_bits&=
3194 ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
3195 thd->transaction.all.reset_unsafe_rollback_flags();
3196 thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
3201 !(thd->variables.option_bits & OPTION_NOT_AUTOCOMMIT))
3204 thd->transaction.all.reset_unsafe_rollback_flags();
3205 thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
3206 thd->variables.option_bits|= OPTION_NOT_AUTOCOMMIT;
3213 "autocommit",
"autocommit",
3215 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_autocommit));
3216 export
sys_var *Sys_autocommit_ptr= &Sys_autocommit;
3219 "big_tables",
"Allow big result sets by saving all "
3220 "temporary sets on file (Solves most 'table full' errors)",
3221 SESSION_VAR(big_tables),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
3224 "sql_big_selects",
"sql_big_selects",
3225 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_BIG_SELECTS,
3229 "sql_log_off",
"sql_log_off",
3230 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_LOG_OFF,
3231 DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
3242 static bool fix_sql_log_bin_after_update(
sys_var *
self, THD *thd,
3245 if (type == OPT_SESSION)
3247 if (thd->variables.sql_log_bin)
3248 thd->variables.option_bits |= OPTION_BIN_LOG;
3250 thd->variables.option_bits &= ~OPTION_BIN_LOG;
3267 static bool check_sql_log_bin(
sys_var *
self, THD *thd,
set_var *var)
3269 if (check_has_super(
self, thd, var))
3272 if (var->type == OPT_GLOBAL)
3276 if (thd->in_sub_stmt)
3278 my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN, MYF(0));
3282 if (thd->in_active_multi_stmt_transaction())
3284 my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN, MYF(0));
3292 "sql_log_bin",
"sql_log_bin",
3293 SESSION_VAR(sql_log_bin), NO_CMD_LINE,
3294 DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_sql_log_bin),
3295 ON_UPDATE(fix_sql_log_bin_after_update));
3297 static Sys_var_bit Sys_transaction_allow_batching(
3298 "transaction_allow_batching",
"transaction_allow_batching",
3299 SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_ALLOW_BATCH,
3303 "sql_warnings",
"sql_warnings",
3304 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS,
3308 "sql_notes",
"sql_notes",
3313 "sql_auto_is_null",
"sql_auto_is_null",
3314 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_AUTO_IS_NULL,
3315 DEFAULT(FALSE), NO_MUTEX_GUARD, IN_BINLOG);
3318 "sql_safe_updates",
"sql_safe_updates",
3319 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_SAFE_UPDATES,
3323 "sql_buffer_result",
"sql_buffer_result",
3324 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_BUFFER_RESULT,
3328 "sql_quote_show_create",
"sql_quote_show_create",
3329 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_QUOTE_SHOW_CREATE,
3333 "foreign_key_checks",
"foreign_key_checks",
3334 SESSION_VAR(option_bits), NO_CMD_LINE,
3336 DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
3339 "unique_checks",
"unique_checks",
3340 SESSION_VAR(option_bits), NO_CMD_LINE,
3342 DEFAULT(TRUE), NO_MUTEX_GUARD, IN_BINLOG);
3344 #ifdef ENABLED_PROFILING
3346 "profiling",
"profiling",
3347 SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_PROFILING,
3348 DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
3349 ON_UPDATE(0), DEPRECATED(
""));
3352 "profiling_history_size",
"Limit of query profiling memory",
3353 SESSION_VAR(profiling_history_size),
CMD_LINE(REQUIRED_ARG),
3354 VALID_RANGE(0, 100), DEFAULT(15), BLOCK_SIZE(1), NO_MUTEX_GUARD,
3355 NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), DEPRECATED(
""));
3360 "The maximum number of rows to return from SELECT statements",
3361 SESSION_VAR(select_limit), NO_CMD_LINE,
3362 VALID_RANGE(0, HA_POS_ERROR), DEFAULT(HA_POS_ERROR), BLOCK_SIZE(1));
3364 static bool update_timestamp(THD *thd,
set_var *var)
3370 tmp.tv_sec= (ulonglong) fl;
3372 tmp.tv_usec= (ulonglong) rint((var->save_result.
double_value - fl) * 1000000);
3373 thd->set_time(&tmp);
3377 thd->user_time.tv_sec= 0;
3378 thd->user_time.tv_usec= 0;
3382 static double read_timestamp(THD *thd)
3384 return (
double) thd->start_time.tv_sec +
3385 (double) thd->start_time.tv_usec / 1000000;
3389 static bool check_timestamp(
sys_var *
self, THD *thd,
set_var *var)
3398 (val < TIMESTAMP_MIN_VALUE || val > TIMESTAMP_MAX_VALUE))
3401 my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0),
"timestamp", prm.ptr());
3409 "timestamp",
"Set the time for this client",
3410 sys_var::ONLY_SESSION, NO_CMD_LINE,
3411 VALID_RANGE(0, 0), BLOCK_SIZE(1),
3412 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_timestamp),
3413 ON_UPDATE(update_timestamp), ON_READ(read_timestamp));
3415 static bool update_last_insert_id(THD *thd,
set_var *var)
3419 my_error(ER_NO_DEFAULT, MYF(0), var->
var->name.str);
3422 thd->first_successful_insert_id_in_prev_stmt=
3426 static ulonglong read_last_insert_id(THD *thd)
3428 return (ulonglong) thd->read_first_successful_insert_id_in_prev_stmt();
3431 "last_insert_id",
"The value to be returned from LAST_INSERT_ID()",
3432 sys_var::ONLY_SESSION, NO_CMD_LINE,
3433 VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
3434 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
3435 ON_UPDATE(update_last_insert_id), ON_READ(read_last_insert_id));
3439 "identity",
"Synonym for the last_insert_id variable",
3440 sys_var::ONLY_SESSION, NO_CMD_LINE,
3441 VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
3442 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
3443 ON_UPDATE(update_last_insert_id), ON_READ(read_last_insert_id));
3464 static bool update_insert_id(THD *thd,
set_var *var)
3468 my_error(ER_NO_DEFAULT, MYF(0), var->
var->name.str);
3475 static ulonglong read_insert_id(THD *thd)
3477 return thd->auto_inc_intervals_forced.minimum();
3480 "insert_id",
"The value to be used by the following INSERT "
3481 "or ALTER TABLE statement when inserting an AUTO_INCREMENT value",
3482 sys_var::ONLY_SESSION, NO_CMD_LINE,
3483 VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1),
3484 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
3485 ON_UPDATE(update_insert_id), ON_READ(read_insert_id));
3487 static bool update_rand_seed1(THD *thd,
set_var *var)
3491 my_error(ER_NO_DEFAULT, MYF(0), var->
var->name.str);
3497 static ulonglong read_rand_seed(THD *thd)
3502 "rand_seed1",
"Sets the internal state of the RAND() "
3503 "generator for replication purposes",
3504 sys_var::ONLY_SESSION, NO_CMD_LINE,
3505 VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
3506 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
3507 ON_UPDATE(update_rand_seed1), ON_READ(read_rand_seed));
3509 static bool update_rand_seed2(THD *thd,
set_var *var)
3513 my_error(ER_NO_DEFAULT, MYF(0), var->
var->name.str);
3520 "rand_seed2",
"Sets the internal state of the RAND() "
3521 "generator for replication purposes",
3522 sys_var::ONLY_SESSION, NO_CMD_LINE,
3523 VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
3524 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
3525 ON_UPDATE(update_rand_seed2), ON_READ(read_rand_seed));
3527 static ulonglong read_error_count(THD *thd)
3529 return thd->get_stmt_da()->error_count();
3533 "error_count",
"The number of errors that resulted from the "
3534 "last statement that generated messages",
3535 READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE,
3536 VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1), NO_MUTEX_GUARD,
3537 NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), ON_READ(read_error_count));
3539 static ulonglong read_warning_count(THD *thd)
3541 return thd->get_stmt_da()->warn_count();
3545 "warning_count",
"The number of errors, warnings, and notes "
3546 "that resulted from the last statement that generated messages",
3547 READ_ONLY sys_var::ONLY_SESSION, NO_CMD_LINE,
3548 VALID_RANGE(0, ULONGLONG_MAX), BLOCK_SIZE(1), NO_MUTEX_GUARD,
3549 NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), ON_READ(read_warning_count));
3552 "default_week_format",
3553 "The default week format used by WEEK() functions",
3554 SESSION_VAR(default_week_format),
CMD_LINE(REQUIRED_ARG),
3555 VALID_RANGE(0, 7), DEFAULT(0), BLOCK_SIZE(1));
3558 "group_concat_max_len",
3559 "The maximum length of the result of function GROUP_CONCAT()",
3560 SESSION_VAR(group_concat_max_len),
CMD_LINE(REQUIRED_ARG),
3561 VALID_RANGE(4, ULONG_MAX), DEFAULT(1024), BLOCK_SIZE(1));
3563 static char *glob_hostname_ptr;
3565 "hostname",
"Server host name",
3566 READ_ONLY GLOBAL_VAR(glob_hostname_ptr), NO_CMD_LINE,
3567 IN_FS_CHARSET, DEFAULT(glob_hostname));
3569 #ifndef EMBEDDED_LIBRARY
3572 "Hostname or IP of the slave to be reported to the master during "
3573 "slave registration. Will appear in the output of SHOW SLAVE HOSTS. "
3574 "Leave unset if you do not want the slave to register itself with the "
3575 "master. Note that it is not sufficient for the master to simply read "
3576 "the IP of the slave off the socket once the slave connects. Due to "
3577 "NAT and other routing issues, that IP may not be valid for connecting "
3578 "to the slave from the master or other hosts",
3579 READ_ONLY GLOBAL_VAR(report_host),
CMD_LINE(REQUIRED_ARG),
3580 IN_FS_CHARSET, DEFAULT(0));
3584 "The account user name of the slave to be reported to the master "
3585 "during slave registration",
3586 READ_ONLY GLOBAL_VAR(report_user),
CMD_LINE(REQUIRED_ARG),
3587 IN_FS_CHARSET, DEFAULT(0));
3591 "The account password of the slave to be reported to the master "
3592 "during slave registration",
3593 READ_ONLY GLOBAL_VAR(report_password),
CMD_LINE(REQUIRED_ARG),
3594 IN_FS_CHARSET, DEFAULT(0));
3598 "Port for connecting to slave reported to the master during slave "
3599 "registration. Set it only if the slave is listening on a non-default "
3600 "port or if you have a special tunnel from the master or other clients "
3601 "to the slave. If not sure, leave this option unset",
3602 READ_ONLY GLOBAL_VAR(report_port),
CMD_LINE(REQUIRED_ARG),
3603 VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
3607 "keep_files_on_create",
3608 "Don't overwrite stale .MYD and .MYI even if no directory is specified",
3609 SESSION_VAR(keep_files_on_create),
CMD_LINE(OPT_ARG),
3612 static char *license;
3614 "license",
"The type of license the server has",
3615 READ_ONLY GLOBAL_VAR(license), NO_CMD_LINE, IN_SYSTEM_CHARSET,
3616 DEFAULT(STRINGIFY_ARG(LICENSE)));
3618 static bool check_log_path(
sys_var *
self, THD *thd,
set_var *var)
3628 my_error(ER_PATH_LENGTH, MYF(0), self->name.str);
3632 char path[FN_REFLEN];
3633 size_t path_length= unpack_filename(path, var->save_result.
string_value.str);
3638 if (!is_filename_allowed(var->save_result.
string_value.str,
3641 my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0),
3648 if (my_stat(path, &f_stat, MYF(0)))
3650 if (!MY_S_ISREG(f_stat.st_mode) || !(f_stat.st_mode & MY_S_IWRITE))
3655 (void) dirname_part(path, var->save_result.
string_value.str, &path_length);
3657 if (var->save_result.
string_value.length - path_length >= FN_LEN)
3659 my_error(ER_PATH_LENGTH, MYF(0), self->name.str);
3666 if (my_access(path, (F_OK|W_OK)))
3671 static bool fix_log(
char** logname,
const char* default_logname,
3672 const char*ext,
bool enabled,
void (*reopen)(
char*))
3676 char buff[FN_REFLEN];
3677 *logname= my_strdup(
make_log_name(buff, default_logname, ext),
3678 MYF(MY_FAE+MY_WME));
3682 logger.lock_exclusive();
3690 static void reopen_general_log(
char*
name)
3692 logger.get_log_file_handler()->close(0);
3693 logger.get_log_file_handler()->open_query_log(name);
3695 static bool fix_general_log_file(
sys_var *
self, THD *thd, enum_var_type type)
3697 return fix_log(&opt_logname, default_logfile_name,
".log", opt_log,
3698 reopen_general_log);
3701 "general_log_file",
"Log connections and queries to given file",
3702 GLOBAL_VAR(opt_logname),
CMD_LINE(REQUIRED_ARG),
3703 IN_FS_CHARSET, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
3704 ON_CHECK(check_log_path), ON_UPDATE(fix_general_log_file));
3706 static void reopen_slow_log(
char* name)
3708 logger.get_slow_log_file_handler()->close(0);
3709 logger.get_slow_log_file_handler()->open_slow_log(name);
3711 static bool fix_slow_log_file(
sys_var *
self, THD *thd, enum_var_type type)
3713 return fix_log(&opt_slow_logname, default_logfile_name,
"-slow.log",
3714 opt_slow_log, reopen_slow_log);
3717 "slow_query_log_file",
"Log slow queries to given log file. "
3718 "Defaults logging to hostname-slow.log. Must be enabled to activate "
3719 "other slow log options",
3720 GLOBAL_VAR(opt_slow_logname),
CMD_LINE(REQUIRED_ARG),
3721 IN_FS_CHARSET, DEFAULT(0), NO_MUTEX_GUARD, NOT_IN_BINLOG,
3722 ON_CHECK(check_log_path), ON_UPDATE(fix_slow_log_file));
3725 "have_compress",
"have_compress",
3726 READ_ONLY GLOBAL_VAR(have_compress), NO_CMD_LINE);
3729 "have_crypt",
"have_crypt",
3730 READ_ONLY GLOBAL_VAR(have_crypt), NO_CMD_LINE);
3733 "have_dynamic_loading",
"have_dynamic_loading",
3734 READ_ONLY GLOBAL_VAR(have_dlopen), NO_CMD_LINE);
3737 "have_geometry",
"have_geometry",
3738 READ_ONLY GLOBAL_VAR(have_geometry), NO_CMD_LINE);
3741 "have_openssl",
"have_openssl",
3742 READ_ONLY GLOBAL_VAR(have_ssl), NO_CMD_LINE);
3745 "have_profiling",
"have_profiling",
3746 READ_ONLY GLOBAL_VAR(have_profiling), NO_CMD_LINE, NO_MUTEX_GUARD,
3747 NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), DEPRECATED(
""));
3750 "have_query_cache",
"have_query_cache",
3751 READ_ONLY GLOBAL_VAR(have_query_cache), NO_CMD_LINE);
3754 "have_rtree_keys",
"have_rtree_keys",
3755 READ_ONLY GLOBAL_VAR(have_rtree_keys), NO_CMD_LINE);
3758 "have_ssl",
"have_ssl",
3759 READ_ONLY GLOBAL_VAR(have_ssl), NO_CMD_LINE);
3762 "have_symlink",
"have_symlink",
3763 READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE);
3765 static bool fix_log_state(
sys_var *
self, THD *thd, enum_var_type type);
3767 "general_log",
"Log connections and queries to a table or log file. "
3768 "Defaults logging to a file hostname.log or a table mysql.general_log"
3769 "if --log-output=TABLE is used",
3770 GLOBAL_VAR(opt_log),
CMD_LINE(OPT_ARG),
3771 DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
3772 ON_UPDATE(fix_log_state));
3776 "Log slow queries to a table or log file. Defaults logging to a file "
3777 "hostname-slow.log or a table mysql.slow_log if --log-output=TABLE is "
3778 "used. Must be enabled to activate other slow log options",
3779 GLOBAL_VAR(opt_slow_log),
CMD_LINE(OPT_ARG),
3780 DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
3781 ON_UPDATE(fix_log_state));
3784 static bool fix_log_state(
sys_var *
self, THD *thd, enum_var_type type)
3787 my_bool *UNINIT_VAR(newvalptr), newval, UNINIT_VAR(oldval);
3788 uint UNINIT_VAR(log_type);
3790 if (
self == &Sys_general_log)
3792 newvalptr= &opt_log;
3793 oldval= logger.get_log_file_handler()->is_open();
3794 log_type= QUERY_LOG_GENERAL;
3796 else if (
self == &Sys_slow_query_log)
3798 newvalptr= &opt_slow_log;
3799 oldval= logger.get_slow_log_file_handler()->is_open();
3800 log_type= QUERY_LOG_SLOW;
3806 if (oldval == newval)
3814 logger.deactivate_log_handler(thd, log_type);
3818 res= logger.activate_log_handler(thd, log_type);
3823 static bool check_not_empty_set(
sys_var *
self, THD *thd,
set_var *var)
3827 static bool fix_log_output(
sys_var *
self, THD *thd, enum_var_type type)
3829 logger.lock_exclusive();
3830 logger.init_slow_log(log_output_options);
3831 logger.init_general_log(log_output_options);
3836 static const char *log_output_names[] = {
"NONE",
"FILE",
"TABLE", NULL};
3839 "log_output",
"Syntax: log-output=value[,value...], "
3840 "where \"value\" could be TABLE, FILE or NONE",
3841 GLOBAL_VAR(log_output_options),
CMD_LINE(REQUIRED_ARG),
3842 log_output_names, DEFAULT(LOG_FILE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
3843 ON_CHECK(check_not_empty_set), ON_UPDATE(fix_log_output));
3845 #ifdef HAVE_REPLICATION
3847 "log_slave_updates",
"Tells the slave to log the updates from "
3848 "the slave thread to the binary log. You will need to turn it on if "
3849 "you plan to daisy-chain the slaves",
3850 READ_ONLY GLOBAL_VAR(opt_log_slave_updates),
CMD_LINE(OPT_ARG),
3854 "relay_log",
"The location and name to use for relay logs",
3855 READ_ONLY GLOBAL_VAR(opt_relay_logname),
CMD_LINE(REQUIRED_ARG),
3856 IN_FS_CHARSET, DEFAULT(0));
3864 "relay_log_index",
"The location and name to use for the file "
3865 "that keeps a list of the last relay logs",
3866 READ_ONLY GLOBAL_VAR(relay_log_index), NO_CMD_LINE,
3867 IN_FS_CHARSET, DEFAULT(0));
3875 "log_bin_index",
"File that holds the names for last binary log files.",
3876 READ_ONLY GLOBAL_VAR(log_bin_index), NO_CMD_LINE,
3877 IN_FS_CHARSET, DEFAULT(0));
3880 "relay_log_basename",
3881 "The full path of the relay log file names, excluding the extension.",
3882 READ_ONLY GLOBAL_VAR(relay_log_basename), NO_CMD_LINE,
3883 IN_FS_CHARSET, DEFAULT(0));
3887 "The full path of the binary log file names, excluding the extension.",
3888 READ_ONLY GLOBAL_VAR(log_bin_basename), NO_CMD_LINE,
3889 IN_FS_CHARSET, DEFAULT(0));
3892 "relay_log_info_file",
"The location and name of the file that "
3893 "remembers where the SQL replication thread is in the relay logs",
3894 READ_ONLY GLOBAL_VAR(relay_log_info_file),
CMD_LINE(REQUIRED_ARG),
3895 IN_FS_CHARSET, DEFAULT(0));
3898 "relay_log_purge",
"if disabled - do not purge relay logs. "
3899 "if enabled - purge them as soon as they are no more needed",
3900 GLOBAL_VAR(relay_log_purge),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
3903 "relay_log_recovery",
"Enables automatic relay log recovery "
3904 "right after the database startup, which means that the IO Thread "
3905 "starts re-fetching from the master right after the last transaction "
3907 READ_ONLY GLOBAL_VAR(relay_log_recovery),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
3910 "slave_allow_batching",
"Allow slave to batch requests",
3911 GLOBAL_VAR(opt_slave_allow_batching),
3912 CMD_LINE(OPT_ARG), DEFAULT(FALSE));
3915 "slave_load_tmpdir",
"The location where the slave should put "
3916 "its temporary files when replicating a LOAD DATA INFILE command",
3917 READ_ONLY GLOBAL_VAR(slave_load_tmpdir),
CMD_LINE(REQUIRED_ARG),
3918 IN_FS_CHARSET, DEFAULT(0));
3920 static bool fix_slave_net_timeout(
sys_var *
self, THD *thd, enum_var_type type)
3922 DEBUG_SYNC(thd,
"fix_slave_net_timeout");
3938 DBUG_PRINT(
"info", (
"slave_net_timeout=%u mi->heartbeat_period=%.3f",
3940 (active_mi ? active_mi->heartbeat_period : 0.0)));
3941 if (active_mi != NULL && slave_net_timeout < active_mi->heartbeat_period)
3942 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
3943 ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX,
3944 ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX));
3950 static PolyLock_mutex PLock_slave_net_timeout(&LOCK_slave_net_timeout);
3952 "slave_net_timeout",
"Number of seconds to wait for more data "
3953 "from a master/slave connection before aborting the read",
3954 GLOBAL_VAR(slave_net_timeout),
CMD_LINE(REQUIRED_ARG),
3955 VALID_RANGE(1, LONG_TIMEOUT), DEFAULT(SLAVE_NET_TIMEOUT), BLOCK_SIZE(1),
3956 &PLock_slave_net_timeout, NOT_IN_BINLOG, ON_CHECK(0),
3957 ON_UPDATE(fix_slave_net_timeout));
3959 static bool check_slave_skip_counter(
sys_var *
self, THD *thd,
set_var *var)
3963 if (active_mi != NULL)
3966 if (active_mi->rli->slave_running)
3968 my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
3973 my_message(ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE,
3974 ER(ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE),
3983 static bool fix_slave_skip_counter(
sys_var *
self, THD *thd, enum_var_type type)
3993 if (active_mi != NULL)
4001 if (!active_mi->rli->slave_running)
4004 active_mi->rli->slave_skip_counter= sql_slave_skip_counter;
4014 static PolyLock_mutex PLock_sql_slave_skip_counter(&LOCK_sql_slave_skip_counter);
4016 "sql_slave_skip_counter",
"sql_slave_skip_counter",
4017 GLOBAL_VAR(sql_slave_skip_counter), NO_CMD_LINE,
4018 VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
4019 &PLock_sql_slave_skip_counter, NOT_IN_BINLOG,
4020 ON_CHECK(check_slave_skip_counter), ON_UPDATE(fix_slave_skip_counter));
4023 "slave_skip_errors",
"Tells the slave thread to continue "
4024 "replication when a query event returns an error from the "
4026 READ_ONLY GLOBAL_VAR(opt_slave_skip_errors),
CMD_LINE(REQUIRED_ARG),
4027 IN_SYSTEM_CHARSET, DEFAULT(0));
4030 "relay_log_space_limit",
"Maximum space to use for all relay logs",
4031 READ_ONLY GLOBAL_VAR(relay_log_space_limit),
CMD_LINE(REQUIRED_ARG),
4032 VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
4035 "sync_relay_log",
"Synchronously flush relay log to disk after "
4036 "every #th event. Use 0 to disable synchronous flushing",
4037 GLOBAL_VAR(sync_relaylog_period),
CMD_LINE(REQUIRED_ARG),
4038 VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
4041 "sync_relay_log_info",
"Synchronously flush relay log info "
4042 "to disk after every #th transaction. Use 0 to disable "
4043 "synchronous flushing",
4044 GLOBAL_VAR(sync_relayloginfo_period),
CMD_LINE(REQUIRED_ARG),
4045 VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
4048 "slave_checkpoint_period",
"Gather workers' activities to "
4049 "Update progress status of Multi-threaded slave and flush "
4050 "the relay log info to disk after every #th milli-seconds.",
4051 GLOBAL_VAR(opt_mts_checkpoint_period),
CMD_LINE(REQUIRED_ARG),
4053 VALID_RANGE(0, UINT_MAX), DEFAULT(300), BLOCK_SIZE(1));
4055 VALID_RANGE(1, UINT_MAX), DEFAULT(300), BLOCK_SIZE(1));
4059 "slave_checkpoint_group",
4060 "Maximum number of processed transactions by Multi-threaded slave "
4061 "before a checkpoint operation is called to update progress status.",
4062 GLOBAL_VAR(opt_mts_checkpoint_group),
CMD_LINE(REQUIRED_ARG),
4064 VALID_RANGE(1, MTS_MAX_BITS_IN_GROUP), DEFAULT(512), BLOCK_SIZE(1));
4066 VALID_RANGE(32, MTS_MAX_BITS_IN_GROUP), DEFAULT(512), BLOCK_SIZE(8));
4071 "sync_binlog",
"Synchronously flush binary log to disk after"
4072 " every #th write to the file. Use 0 (default) to disable synchronous"
4074 GLOBAL_VAR(sync_binlog_period),
CMD_LINE(REQUIRED_ARG),
4075 VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
4078 "sync_master_info",
"Synchronously flush master info to disk "
4079 "after every #th event. Use 0 to disable synchronous flushing",
4080 GLOBAL_VAR(sync_masterinfo_period),
CMD_LINE(REQUIRED_ARG),
4081 VALID_RANGE(0, UINT_MAX), DEFAULT(10000), BLOCK_SIZE(1));
4083 #ifdef HAVE_REPLICATION
4085 "slave_transaction_retries",
"Number of times the slave SQL "
4086 "thread will retry a transaction in case it failed with a deadlock "
4087 "or elapsed lock wait timeout, before giving up and stopping",
4088 GLOBAL_VAR(slave_trans_retries),
CMD_LINE(REQUIRED_ARG),
4089 VALID_RANGE(0, ULONG_MAX), DEFAULT(10), BLOCK_SIZE(1));
4092 "slave_parallel_workers",
4093 "Number of worker threads for executing events in parallel ",
4094 GLOBAL_VAR(opt_mts_slave_parallel_workers),
CMD_LINE(REQUIRED_ARG),
4095 VALID_RANGE(0, MTS_MAX_WORKERS), DEFAULT(0), BLOCK_SIZE(1));
4098 "slave_pending_jobs_size_max",
4099 "Max size of Slave Worker queues holding yet not applied events."
4100 "The least possible value must be not less than the master side "
4101 "max_allowed_packet.",
4102 GLOBAL_VAR(opt_mts_pending_jobs_size_max),
CMD_LINE(REQUIRED_ARG),
4103 VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(16 * 1024*1024),
4104 BLOCK_SIZE(1024), ON_CHECK(0));
4113 char buff[STRING_BUFFER_USUAL_SIZE];
4114 if (var->
value->result_type() == INT_RESULT)
4116 int lcno= (int)var->
value->val_int();
4117 if (!(locale= my_locale_by_number(lcno)))
4119 my_error(ER_UNKNOWN_LOCALE, MYF(0), llstr(lcno, buff));
4122 if (check_not_null(
self, thd, var))
4127 String str(buff,
sizeof(buff), system_charset_info), *res;
4128 if (!(res=var->
value->val_str(&str)))
4130 else if (!(locale= my_locale_by_name(res->c_ptr_safe())))
4133 my_error(ER_UNKNOWN_LOCALE, MYF(0), err.ptr());
4138 var->save_result.
ptr= locale;
4140 if (!locale->errmsgs->errmsgs)
4143 if (!locale->errmsgs->errmsgs &&
4144 read_texts(ERRMSG_FILE, locale->errmsgs->language,
4145 &locale->errmsgs->errmsgs,
4146 ER_ERROR_LAST - ER_ERROR_FIRST + 1))
4148 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
4149 "Can't process error message file for locale '%s'",
4159 "lc_messages",
"Set the language used for the error messages",
4160 SESSION_VAR(lc_messages), NO_CMD_LINE,
4161 my_offsetof(
MY_LOCALE, name), DEFAULT(&my_default_lc_messages),
4162 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_locale));
4165 "lc_time_names",
"Set the language used for the month "
4166 "names and the days of the week",
4167 SESSION_VAR(lc_time_names), NO_CMD_LINE,
4168 my_offsetof(
MY_LOCALE, name), DEFAULT(&my_default_lc_time_names),
4169 NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_locale));
4172 "time_zone",
"time_zone",
4173 SESSION_VAR(time_zone), NO_CMD_LINE,
4174 DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG);
4176 static bool fix_host_cache_size(
sys_var *, THD *, enum_var_type)
4184 "How many host names should be cached to avoid resolving.",
4186 CMD_LINE(REQUIRED_ARG, OPT_HOST_CACHE_SIZE), VALID_RANGE(0, 65536),
4187 DEFAULT(HOST_CACHE_SIZE),
4189 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
4190 ON_UPDATE(fix_host_cache_size));
4194 "The list of directories to ignore when collecting database lists",
4195 READ_ONLY GLOBAL_VAR(opt_ignore_db_dirs),
4197 IN_FS_CHARSET, DEFAULT(0));
4203 #ifdef NON_DISABLED_GTID
4204 static bool check_enforce_gtid_consistency(
4207 DBUG_ENTER(
"check_enforce_gtid_consistency");
4209 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
4210 "ENFORCE_GTID_CONSISTENCY");
4213 if (check_top_level_stmt_and_super(
self, thd, var) ||
4214 check_outside_transaction(
self, thd, var))
4216 if (gtid_mode >= 2 && var->
value->val_int() == 0)
4218 my_error(ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON, MYF(0));
4226 "enforce_gtid_consistency",
4227 "Prevents execution of statements that would be impossible to log "
4228 "in a transactionally safe manner. Currently, the disallowed "
4229 "statements include CREATE TEMPORARY TABLE inside transactions, "
4230 "all updates to non-transactional tables, and CREATE TABLE ... SELECT.",
4231 READ_ONLY GLOBAL_VAR(enforce_gtid_consistency),
4233 NO_MUTEX_GUARD, NOT_IN_BINLOG
4234 #ifdef NON_DISABLED_GTID
4235 , ON_CHECK(check_enforce_gtid_consistency));
4241 "stored_program_cache",
4242 "The soft upper limit for number of cached stored routines for "
4244 GLOBAL_VAR(stored_program_cache_size),
CMD_LINE(REQUIRED_ARG),
4245 VALID_RANGE(256, 512 * 1024), DEFAULT(256), BLOCK_SIZE(1));
4247 static bool check_pseudo_slave_mode(
sys_var *
self, THD *thd,
set_var *var)
4249 longlong previous_val= thd->variables.pseudo_slave_mode;
4251 bool rli_fake=
false;
4253 #ifndef EMBEDDED_LIBRARY
4254 rli_fake= thd->rli_fake ?
true :
false;
4261 #ifndef EMBEDDED_LIBRARY
4262 thd->rli_fake->end_info();
4263 delete thd->rli_fake;
4264 thd->rli_fake= NULL;
4267 else if (previous_val && val)
4269 else if (!previous_val && val)
4270 push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
4271 ER_WRONG_VALUE_FOR_VAR,
4272 "'pseudo_slave_mode' is already ON.");
4276 if (!previous_val && !val)
4278 else if (previous_val && !val)
4279 push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
4280 ER_WRONG_VALUE_FOR_VAR,
4281 "Slave applier execution mode not active, "
4282 "statement ineffective.");
4287 push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
4288 ER_WRONG_VALUE_FOR_VAR,
4289 "'pseudo_slave_mode' change was ineffective.");
4295 "pseudo_slave_mode",
4296 "SET pseudo_slave_mode= 0,1 are commands that mysqlbinlog "
4297 "adds to beginning and end of binary log dumps. While zero "
4298 "value indeed disables, the actual enabling of the slave "
4299 "applier execution mode is done implicitly when a "
4300 "Format_description_event is sent through the session.",
4301 SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE),
4302 NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode));
4305 #ifdef HAVE_REPLICATION
4306 static bool check_gtid_next(
sys_var *
self, THD *thd,
set_var *var)
4308 DBUG_ENTER(
"check_gtid_next");
4313 DBUG_PRINT(
"info", (
"thd->in_sub_stmt=%d", thd->in_sub_stmt));
4316 if (check_top_level_stmt_and_super(
self, thd, var))
4320 const Gtid_set *gtid_next_list= thd->get_gtid_next_list_const();
4324 if (thd->in_active_multi_stmt_transaction() && gtid_next_list == NULL)
4326 my_error(ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL, MYF(0));
4332 global_sid_lock->
rdlock();
4337 global_sid_lock->
unlock();
4340 global_sid_lock->
unlock();
4343 if (gtid_mode == 0 && spec.
type == GTID_GROUP)
4344 my_error(ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF, MYF(0));
4345 if (gtid_mode == 3 && spec.
type == ANONYMOUS_GROUP)
4346 my_error(ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON, MYF(0));
4348 if (gtid_next_list != NULL)
4350 #ifdef HAVE_GTID_NEXT_LIST
4354 char buf[Gtid_specification::MAX_TEXT_LENGTH + 1];
4355 global_sid_lock->
rdlock();
4357 global_sid_lock->
unlock();
4358 my_error(ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST, MYF(0), buf);
4363 if (spec.
type == AUTOMATIC_GROUP)
4365 my_error(ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL,
4374 else if(thd->owned_gtid.sidno != 0)
4378 DBUG_ASSERT(thd->owned_gtid.sidno > 0);
4379 global_sid_lock->
wrlock();
4381 thread_owns_anything(thd->thread_id));
4383 global_sid_lock->
rdlock();
4385 thd->owned_gtid.to_string(global_sid_map, buf);
4386 global_sid_lock->
unlock();
4387 my_error(ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID, MYF(0), buf);
4394 static bool update_gtid_next(
sys_var *
self, THD *thd, enum_var_type type)
4396 DBUG_ASSERT(type == OPT_SESSION);
4397 if (thd->variables.gtid_next.type == GTID_GROUP)
4398 return gtid_acquire_ownership_single(thd) != 0 ?
true :
false;
4402 #ifdef HAVE_GTID_NEXT_LIST
4403 static bool check_gtid_next_list(
sys_var *
self, THD *thd,
set_var *var)
4405 DBUG_ENTER(
"check_gtid_next_list");
4406 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"GTID_NEXT_LIST");
4407 if (check_top_level_stmt_and_super(
self, thd, var) ||
4408 check_outside_transaction(
self, thd, var))
4410 if (gtid_mode == 0 && var->save_result.
string_value.str != NULL)
4411 my_error(ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF,
4416 static bool update_gtid_next_list(
sys_var *
self, THD *thd, enum_var_type type)
4418 DBUG_ASSERT(type == OPT_SESSION);
4419 if (thd->get_gtid_next_list() != NULL)
4420 return gtid_acquire_ownership_multiple(thd) != 0 ?
true :
false;
4424 static Sys_var_gtid_set Sys_gtid_next_list(
4426 "Before re-executing a transaction that contains multiple "
4427 "Global Transaction Identifiers, this variable must be set "
4428 "to the set of all re-executed transactions.",
4429 SESSION_ONLY(gtid_next_list), NO_CMD_LINE,
4430 DEFAULT(NULL), NO_MUTEX_GUARD,
4431 NOT_IN_BINLOG, ON_CHECK(check_gtid_next_list),
4432 ON_UPDATE(update_gtid_next_list)
4434 export
sys_var *Sys_gtid_next_list_ptr= &Sys_gtid_next_list;
4439 "Specified the Global Transaction Identifier for the following "
4440 "re-executed statement.",
4441 SESSION_ONLY(gtid_next), NO_CMD_LINE,
4442 DEFAULT(
"AUTOMATIC"), NO_MUTEX_GUARD,
4443 NOT_IN_BINLOG, ON_CHECK(check_gtid_next), ON_UPDATE(update_gtid_next));
4444 export
sys_var *Sys_gtid_next_ptr= &Sys_gtid_next;
4448 "The global variable contains the set of GTIDs in the "
4449 "binary log. The session variable contains the set of GTIDs "
4450 "in the current, ongoing transaction.");
4452 static bool check_gtid_purged(
sys_var *
self, THD *thd,
set_var *var)
4454 DBUG_ENTER(
"check_gtid_purged");
4456 if (!var->
value || check_top_level_stmt(
self, thd, var) ||
4457 check_outside_transaction(
self, thd, var) ||
4458 check_outside_sp(
self, thd, var))
4463 my_error(ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF, MYF(0));
4467 if (var->
value->result_type() != STRING_RESULT ||
4477 "The set of GTIDs that existed in previous, purged binary logs.",
4478 GLOBAL_VAR(gtid_purged), NO_CMD_LINE,
4479 DEFAULT(NULL), NO_MUTEX_GUARD,
4480 NOT_IN_BINLOG, ON_CHECK(check_gtid_purged));
4481 export
sys_var *Sys_gtid_purged_ptr= &Sys_gtid_purged;
4485 "The global variable lists all GTIDs owned by all threads. "
4486 "The session variable lists all GTIDs owned by the current thread.");
4492 #ifdef NON_DISABLED_GTID
4493 static bool check_gtid_mode(
sys_var *
self, THD *thd,
set_var *var)
4495 DBUG_ENTER(
"check_gtid_mode");
4497 my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"GTID_MODE");
4500 if (check_top_level_stmt_and_super(
self, thd, var) ||
4501 check_outside_transaction(
self, thd, var))
4503 uint new_gtid_mode= var->
value->val_int();
4504 if (abs((
long)(new_gtid_mode - gtid_mode)) > 1)
4506 my_error(ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME, MYF(0));
4509 if (new_gtid_mode >= 1)
4511 if (!opt_bin_log || !opt_log_slave_updates)
4513 my_error(ER_GTID_MODE_REQUIRES_BINLOG, MYF(0));
4517 if (new_gtid_mode >= 2)
4529 if (!enforce_gtid_consistency)
4562 "Whether Global Transaction Identifiers (GTIDs) are enabled. Can be "
4564 READ_ONLY GLOBAL_VAR(gtid_mode),
CMD_LINE(REQUIRED_ARG),
4565 gtid_mode_names, DEFAULT(GTID_MODE_OFF),
4566 NO_MUTEX_GUARD, NOT_IN_BINLOG
4567 #ifdef NON_DISABLED_GTID
4568 , ON_CHECK(check_gtid_mode));
4573 #endif // HAVE_REPLICATION
4577 "disconnect_on_expired_password",
4578 "Give clients that don't signal password expiration support execution time error(s) instead of connection error",
4579 READ_ONLY GLOBAL_VAR(disconnect_on_expired_password),
4582 #ifndef NO_EMBEDDED_ACCESS_CHECKS
4584 "validate_user_plugins",
4585 "Turns on additional validation of authentication plugins assigned "
4586 "to user accounts. ",
4587 READ_ONLY NOT_VISIBLE GLOBAL_VAR(validate_user_plugins),
4589 NO_MUTEX_GUARD, NOT_IN_BINLOG);