mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Updated documentation files to reflect MariaDB and not the Maria storage engine or MySQL
Added (rewritten) patch from Percona to get extended statistics in slow.log: - Added handling of 'set' variables to set_var.cc. Changed sql_mode to use this - Added extra logging to slow log of 'Thread_id, Schema, Query Cache hit, Rows sent and Rows examined' - Added optional logging to slow log, through log_slow_verbosity, of query plan statistics - Added new user variables log_slow_rate_limit, log_slow_verbosity, log_slow_filter - Added log-slow-file as synonym for 'slow-log-file', as most slow-log variables starts with 'log-slow' - Added log-slow-time as synonym for long-query-time Some trivial MyISAM optimizations: - In prepare for drop, flush key blocks - Don't call mi_lock_database if my_disable_locking is used KNOWN_BUGS.txt: Updated file to reflect MariaDB and not the Maria storage engine README: Updated file to reflect MariaDB mysql-test/r/log_slow.result: Test new options for slow query log mysql-test/r/variables.result: Updated result (old version cut of things at 79 characters) mysql-test/t/log_slow.test: Test new options for slow query log sql/Makefile.am: Added log_slow.h sql/event_data_objects.cc: Removed not needed test for enable_slow_log (is done when the flag is tested elsewhere) sql/events.cc: Use the general make_set() function instead of 'symbolic_mode_representation' sql/filesort.cc: Added status for used query plans sql/log.cc: Reset counters if no query_length (from Percona's patch; Not sure if needed, but can do no harm) Added extra logging to slow log of 'Thread_id, Schema, Query Cache hit, Rows sent and Rows examined' Added optional logging to slow log, through log_slow_verbosity, of query plan statistics Fixed wrong test of error condition sql/log_slow.h: Defines and variables for log_slow_verbosity and log_slow_filter sql/mysql_priv.h: Include log_slow.h sql/mysqld.cc: Added new user variables log_slow_rate_limit, log_slow_verbosity, log_slow_filter Added log-slow-file as synonym for 'slow-log-file', as most slow-log variables starts with 'log-slow' Added log-slow-time as synonym for long-query-time Added note that one should use log-slow-filter instead of log-slow-admin-statements Updated comment from 'slow_query_log_file' sql/set_var.cc: Added long_slow_time as synonym for long_query_time Added new user variables log_slow_rate_limit, log_slow_verbosity, log_slow_filter dded handling of 'set' variables to set_var.cc. Changed sql_mode to use this sql/set_var.h: - Added handling of 'set' variables. Changed sql_mode to use this sql/slave.cc: Use global filter also for slaves sql/sp_head.cc: Simplify saving of general_slow_log state Use the general make_set() function instead of 'symbolic_mode_representation' sql/sql_cache.cc: Added status for used query plans sql/sql_class.cc: Remember/restore query_plan_flags over complex statements sql/sql_class.h: Added variables to handle extended slow log statistics sql/sql_parse.cc: Added status for used query plans Added test for filtering slow_query_log sql/sql_select.cc: Added status for used query plans sql/sql_show.cc: Use the general make_set() function instead of 'symbolic_mode_representation' sql/strfunc.cc: Report first error (not last) if something is wrong in a set Removed compiler warning storage/myisam/mi_extra.c: In prepare for drop, flush key blocks (speed optimization) storage/myisam/mi_locking.c: Don't call mi_lock_database if my_disable_locking is used (speed optimization)
This commit is contained in:
@ -1049,6 +1049,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
|
||||
status_var_increment(thd->status_var.com_other);
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
db.str= (char*) thd->alloc(db_len + tbl_len + 2);
|
||||
if (!db.str)
|
||||
{
|
||||
@ -1404,6 +1405,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
|
||||
status_var_increment(thd->status_var.com_other);
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
if (check_global_access(thd, REPL_SLAVE_ACL))
|
||||
break;
|
||||
|
||||
@ -1638,6 +1640,19 @@ void log_slow_statement(THD *thd)
|
||||
if (unlikely(thd->in_sub_stmt))
|
||||
DBUG_VOID_RETURN; // Don't set time for sub stmt
|
||||
|
||||
/* Follow the slow log filter configuration. */
|
||||
DBUG_ASSERT(thd->variables.log_slow_filter != 0);
|
||||
if (!(thd->variables.log_slow_filter & thd->query_plan_flags))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
/*
|
||||
If rate limiting of slow log writes is enabled, decide whether to log
|
||||
this query to the log or not.
|
||||
*/
|
||||
if (thd->variables.log_slow_rate_limit > 1 &&
|
||||
(global_query_id % thd->variables.log_slow_rate_limit) != 0)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
/*
|
||||
Do not log administrative statements unless the appropriate option is
|
||||
set; do not log into slow log if reading from backup.
|
||||
@ -2353,6 +2368,7 @@ mysql_execute_command(THD *thd)
|
||||
check_global_access(thd, FILE_ACL))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res = mysql_backup_table(thd, first_table);
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
@ -2365,6 +2381,7 @@ mysql_execute_command(THD *thd)
|
||||
check_global_access(thd, FILE_ACL))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res = mysql_restore_table(thd, first_table);
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
@ -2750,6 +2767,7 @@ end_with_restore_list:
|
||||
ALTER TABLE.
|
||||
*/
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
|
||||
bzero((char*) &create_info, sizeof(create_info));
|
||||
create_info.db_type= 0;
|
||||
@ -2869,6 +2887,7 @@ end_with_restore_list:
|
||||
}
|
||||
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res= mysql_alter_table(thd, select_lex->db, lex->name.str,
|
||||
&create_info,
|
||||
first_table,
|
||||
@ -2956,6 +2975,7 @@ end_with_restore_list:
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res= mysql_repair_table(thd, first_table, &lex->check_opt);
|
||||
/* ! we write after unlocking the table */
|
||||
if (!res && !lex->no_write_to_binlog)
|
||||
@ -2976,6 +2996,7 @@ end_with_restore_list:
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res = mysql_check_table(thd, first_table, &lex->check_opt);
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
@ -2988,6 +3009,7 @@ end_with_restore_list:
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res= mysql_analyze_table(thd, first_table, &lex->check_opt);
|
||||
/* ! we write after unlocking the table */
|
||||
if (!res && !lex->no_write_to_binlog)
|
||||
@ -3009,6 +3031,7 @@ end_with_restore_list:
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
thd->query_plan_flags|= QPLAN_ADMIN;
|
||||
res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
|
||||
mysql_recreate_table(thd, first_table) :
|
||||
mysql_optimize_table(thd, first_table, &lex->check_opt);
|
||||
@ -5658,6 +5681,8 @@ void mysql_reset_thd_for_next_command(THD *thd)
|
||||
thd->total_warn_count=0; // Warnings for this query
|
||||
thd->rand_used= 0;
|
||||
thd->sent_row_count= thd->examined_row_count= 0;
|
||||
thd->query_plan_flags= QPLAN_INIT;
|
||||
thd->query_plan_fsort_passes= 0;
|
||||
|
||||
/*
|
||||
Because we come here only for start of top-statements, binlog format is
|
||||
|
Reference in New Issue
Block a user