Loading mysql-test/r/ps_grant.result +1 −1 Original line number Diff line number Diff line Loading @@ -78,4 +78,4 @@ drop database mysqltest; prepare stmt4 from ' show full processlist '; execute stmt4; Id User Host db Command Time State Info number root localhost test Query time NULL show full processlist number root localhost test Execute time NULL show full processlist sql/mysql_priv.h +4 −2 Original line number Diff line number Diff line Loading @@ -424,8 +424,6 @@ struct Query_cache_query_flags #define query_cache_invalidate_by_MyISAM_filename_ref NULL #endif /*HAVE_QUERY_CACHE*/ #define prepare_execute(A) ((A)->command == COM_EXECUTE) int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); Loading Loading @@ -462,6 +460,7 @@ void mysql_execute_command(THD *thd); bool do_command(THD *thd); bool dispatch_command(enum enum_server_command command, THD *thd, char* packet, uint packet_length); void log_slow_statement(THD *thd); bool check_dup(const char *db, const char *name, TABLE_LIST *tables); bool table_cache_init(void); Loading Loading @@ -899,6 +898,8 @@ extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit; extern ulong max_binlog_size, max_relay_log_size; extern ulong rpl_recovery_rank, thread_cache_size; extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log; extern ulong com_stmt_prepare, com_stmt_execute, com_stmt_send_long_data; extern ulong com_stmt_reset, com_stmt_close; extern ulong specialflag, current_pid; extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter; extern my_bool relay_log_purge, opt_innodb_safe_binlog; Loading @@ -918,6 +919,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_readonly, lower_case_file_system; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; extern my_bool opt_secure_auth; extern my_bool opt_log_slow_admin_statements; extern uint opt_crash_binlog_innodb; extern char *shared_memory_base_name, *mysqld_unix_port; extern bool opt_enable_shared_memory; Loading sql/mysqld.cc +23 −3 Original line number Diff line number Diff line Loading @@ -294,6 +294,7 @@ my_bool opt_sync_bdb_logs, opt_sync_frm, opt_allow_suspicious_udfs; my_bool opt_secure_auth= 0; my_bool opt_short_log_format= 0; my_bool opt_log_queries_not_using_indexes= 0; my_bool opt_log_slow_admin_statements= 0; my_bool lower_case_file_system= 0; my_bool opt_innodb_safe_binlog= 0; volatile bool mqh_used = 0; Loading @@ -315,6 +316,8 @@ ulong slave_net_timeout, slave_trans_retries; ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0; ulong query_cache_size=0; ulong com_stat[(uint) SQLCOM_END], com_other; ulong com_stmt_prepare, com_stmt_execute, com_stmt_send_long_data; ulong com_stmt_close, com_stmt_reset; ulong bytes_sent, bytes_received, net_big_packet_count; ulong refresh_version, flush_version; /* Increments on each reload */ ulong query_id, long_query_count; Loading Loading @@ -4196,7 +4199,8 @@ enum options_mysqld OPT_TIME_FORMAT, OPT_DATETIME_FORMAT, OPT_LOG_QUERIES_NOT_USING_INDEXES, OPT_DEFAULT_TIME_ZONE OPT_DEFAULT_TIME_ZONE, OPT_LOG_SLOW_ADMIN_STATEMENTS }; Loading Loading @@ -4456,7 +4460,7 @@ Disable with --skip-isam.", "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, "Log queries that are executed without benefit of any index.", "Log queries that are executed without benefit of any index to the slow log if it is open.", (gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-short-format", OPT_SHORT_LOG_FORMAT, Loading @@ -4467,8 +4471,13 @@ Disable with --skip-isam.", "Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.", (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS, "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.", (gptr*) &opt_log_slow_admin_statements, (gptr*) &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slow-queries", OPT_SLOW_QUERY_LOG, "Log slow queries to this log file. Defaults logging to hostname-slow.log file.", "Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.", (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-update", OPT_UPDATE_LOG, Loading Loading @@ -5467,6 +5476,11 @@ struct show_var_st status_vars[]= { {"Com_show_warnings", (char*) (com_stat+(uint) SQLCOM_SHOW_WARNS),SHOW_LONG}, {"Com_slave_start", (char*) (com_stat+(uint) SQLCOM_SLAVE_START),SHOW_LONG}, {"Com_slave_stop", (char*) (com_stat+(uint) SQLCOM_SLAVE_STOP),SHOW_LONG}, {"Com_stmt_prepare", (char*) &com_stmt_prepare, SHOW_LONG}, {"Com_stmt_execute", (char*) &com_stmt_execute, SHOW_LONG}, {"Com_stmt_send_long_data", (char*) &com_stmt_send_long_data, SHOW_LONG}, {"Com_stmt_reset", (char*) &com_stmt_reset, SHOW_LONG}, {"Com_stmt_close", (char*) &com_stmt_close, SHOW_LONG}, {"Com_truncate", (char*) (com_stat+(uint) SQLCOM_TRUNCATE),SHOW_LONG}, {"Com_unlock_tables", (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG}, {"Com_update", (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG}, Loading Loading @@ -6084,6 +6098,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_SLOW_QUERY_LOG: opt_slow_log=1; break; case (int) OPT_LOG_SLOW_ADMIN_STATEMENTS: opt_log_slow_admin_statements= 1; break; case (int) OPT_SKIP_NEW: opt_specialflag|= SPECIAL_NO_NEW_FUNC; delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; Loading Loading @@ -6443,6 +6460,9 @@ static void get_options(int argc,char **argv) if (opt_bdb) sql_print_warning("this binary does not contain BDB storage engine"); #endif if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) && !opt_slow_log) sql_print_warning("options --log-slow-admin-statements and --log-queries-not-using-indexes have no effect if --log-slow-queries is not set"); /* Check that the default storage engine is actually available. Loading sql/sql_class.h +1 −1 Original line number Diff line number Diff line Loading @@ -916,7 +916,7 @@ class THD :public ilink, bool query_error, bootstrap, cleanup_done; bool tmp_table_used; bool charset_is_system_charset, charset_is_collation_connection; bool slow_command; bool enable_slow_log; /* enable slow log for current statement */ my_bool volatile killed; /* Loading sql/sql_parse.cc +23 −19 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ static void remove_escape(char *name); static void refresh_status(void); static bool append_file_to_dir(THD *thd, const char **filename_ptr, const char *table_name); static void log_slow_query(THD *thd); const char *any_db="*any*"; // Special symbol for check_access Loading Loading @@ -1342,10 +1341,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->command=command; /* Commands which will always take a long time should be marked with this so that they will not get logged to the slow query log Commands which always take a long time are logged into the slow log only if opt_log_slow_admin_statements is set. */ thd->slow_command=FALSE; thd->enable_slow_log= TRUE; thd->set_time(); VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_id=query_id; Loading Loading @@ -1383,7 +1382,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, uint tbl_len= *(uchar*) (packet + db_len + 1); statistic_increment(com_other, &LOCK_status); thd->slow_command= TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; db= thd->alloc(db_len + tbl_len + 2); tbl_name= strmake(db, packet + 1, db_len)+1; strmake(tbl_name, packet + db_len + 2, tbl_len); Loading Loading @@ -1515,7 +1514,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #endif ulong length= (ulong)(packet_end-packet); log_slow_query(thd); log_slow_statement(thd); /* Remove garbage at start of query */ while (my_isspace(thd->charset(), *packet) && length > 0) Loading Loading @@ -1658,7 +1657,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, uint32 slave_server_id; statistic_increment(com_other,&LOCK_status); thd->slow_command = TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; if (check_global_access(thd, REPL_SLAVE_ACL)) break; Loading Loading @@ -1827,7 +1826,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (thd->is_fatal_error) send_error(thd,0); // End of memory ? log_slow_query(thd); log_slow_statement(thd); thd->proc_info="cleaning up"; VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list Loading @@ -1843,13 +1842,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } static void log_slow_query(THD *thd) void log_slow_statement(THD *thd) { time_t start_of_query=thd->start_time; thd->end_time(); // Set start time /* If not reading from backup and if the query took too long */ if (!thd->slow_command && !thd->user_time) // do not log 'slow_command' queries /* Do not log administrative statements unless the appropriate option is set; do not log into slow log if reading from backup. */ if (thd->enable_slow_log && !thd->user_time) { thd->proc_info="logging slow query"; Loading Loading @@ -2190,6 +2192,8 @@ mysql_execute_command(THD *thd) DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", lex->prepared_stmt_name.length, lex->prepared_stmt_name.str)); /* We account deallocate in the same manner as mysql_stmt_close */ statistic_increment(com_stmt_close, &LOCK_status); if ((stmt= thd->stmt_map.find_by_name(&lex->prepared_stmt_name))) { thd->stmt_map.erase(stmt); Loading Loading @@ -2292,7 +2296,7 @@ mysql_execute_command(THD *thd) check_table_access(thd,SELECT_ACL, tables,0) || check_global_access(thd, FILE_ACL)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_backup_table(thd, tables); break; Loading @@ -2303,7 +2307,7 @@ mysql_execute_command(THD *thd) check_table_access(thd, INSERT_ACL, tables,0) || check_global_access(thd, FILE_ACL)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_restore_table(thd, tables); break; } Loading Loading @@ -2538,7 +2542,7 @@ mysql_execute_command(THD *thd) case SQLCOM_CREATE_INDEX: if (check_one_table_access(thd, INDEX_ACL, tables)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; if (end_active_trans(thd)) res= -1; else Loading Loading @@ -2624,7 +2628,7 @@ mysql_execute_command(THD *thd) res= -1; else { thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res= mysql_alter_table(thd, select_lex->db, lex->name, &lex->create_info, tables, lex->create_list, Loading Loading @@ -2716,7 +2720,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_repair_table(thd, tables, &lex->check_opt); /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) Loading @@ -2736,7 +2740,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_check_table(thd, tables, &lex->check_opt); break; } Loading @@ -2745,7 +2749,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_analyze_table(thd, tables, &lex->check_opt); /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) Loading @@ -2766,7 +2770,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ? mysql_recreate_table(thd, tables, 1) : mysql_optimize_table(thd, tables, &lex->check_opt); Loading Loading
mysql-test/r/ps_grant.result +1 −1 Original line number Diff line number Diff line Loading @@ -78,4 +78,4 @@ drop database mysqltest; prepare stmt4 from ' show full processlist '; execute stmt4; Id User Host db Command Time State Info number root localhost test Query time NULL show full processlist number root localhost test Execute time NULL show full processlist
sql/mysql_priv.h +4 −2 Original line number Diff line number Diff line Loading @@ -424,8 +424,6 @@ struct Query_cache_query_flags #define query_cache_invalidate_by_MyISAM_filename_ref NULL #endif /*HAVE_QUERY_CACHE*/ #define prepare_execute(A) ((A)->command == COM_EXECUTE) int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); Loading Loading @@ -462,6 +460,7 @@ void mysql_execute_command(THD *thd); bool do_command(THD *thd); bool dispatch_command(enum enum_server_command command, THD *thd, char* packet, uint packet_length); void log_slow_statement(THD *thd); bool check_dup(const char *db, const char *name, TABLE_LIST *tables); bool table_cache_init(void); Loading Loading @@ -899,6 +898,8 @@ extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit; extern ulong max_binlog_size, max_relay_log_size; extern ulong rpl_recovery_rank, thread_cache_size; extern ulong com_stat[(uint) SQLCOM_END], com_other, back_log; extern ulong com_stmt_prepare, com_stmt_execute, com_stmt_send_long_data; extern ulong com_stmt_reset, com_stmt_close; extern ulong specialflag, current_pid; extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter; extern my_bool relay_log_purge, opt_innodb_safe_binlog; Loading @@ -918,6 +919,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern my_bool opt_readonly, lower_case_file_system; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; extern my_bool opt_secure_auth; extern my_bool opt_log_slow_admin_statements; extern uint opt_crash_binlog_innodb; extern char *shared_memory_base_name, *mysqld_unix_port; extern bool opt_enable_shared_memory; Loading
sql/mysqld.cc +23 −3 Original line number Diff line number Diff line Loading @@ -294,6 +294,7 @@ my_bool opt_sync_bdb_logs, opt_sync_frm, opt_allow_suspicious_udfs; my_bool opt_secure_auth= 0; my_bool opt_short_log_format= 0; my_bool opt_log_queries_not_using_indexes= 0; my_bool opt_log_slow_admin_statements= 0; my_bool lower_case_file_system= 0; my_bool opt_innodb_safe_binlog= 0; volatile bool mqh_used = 0; Loading @@ -315,6 +316,8 @@ ulong slave_net_timeout, slave_trans_retries; ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0; ulong query_cache_size=0; ulong com_stat[(uint) SQLCOM_END], com_other; ulong com_stmt_prepare, com_stmt_execute, com_stmt_send_long_data; ulong com_stmt_close, com_stmt_reset; ulong bytes_sent, bytes_received, net_big_packet_count; ulong refresh_version, flush_version; /* Increments on each reload */ ulong query_id, long_query_count; Loading Loading @@ -4196,7 +4199,8 @@ enum options_mysqld OPT_TIME_FORMAT, OPT_DATETIME_FORMAT, OPT_LOG_QUERIES_NOT_USING_INDEXES, OPT_DEFAULT_TIME_ZONE OPT_DEFAULT_TIME_ZONE, OPT_LOG_SLOW_ADMIN_STATEMENTS }; Loading Loading @@ -4456,7 +4460,7 @@ Disable with --skip-isam.", "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, "Log queries that are executed without benefit of any index.", "Log queries that are executed without benefit of any index to the slow log if it is open.", (gptr*) &opt_log_queries_not_using_indexes, (gptr*) &opt_log_queries_not_using_indexes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-short-format", OPT_SHORT_LOG_FORMAT, Loading @@ -4467,8 +4471,13 @@ Disable with --skip-isam.", "Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.", (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS, "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.", (gptr*) &opt_log_slow_admin_statements, (gptr*) &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-slow-queries", OPT_SLOW_QUERY_LOG, "Log slow queries to this log file. Defaults logging to hostname-slow.log file.", "Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must be enabled to activate other slow log options.", (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"log-update", OPT_UPDATE_LOG, Loading Loading @@ -5467,6 +5476,11 @@ struct show_var_st status_vars[]= { {"Com_show_warnings", (char*) (com_stat+(uint) SQLCOM_SHOW_WARNS),SHOW_LONG}, {"Com_slave_start", (char*) (com_stat+(uint) SQLCOM_SLAVE_START),SHOW_LONG}, {"Com_slave_stop", (char*) (com_stat+(uint) SQLCOM_SLAVE_STOP),SHOW_LONG}, {"Com_stmt_prepare", (char*) &com_stmt_prepare, SHOW_LONG}, {"Com_stmt_execute", (char*) &com_stmt_execute, SHOW_LONG}, {"Com_stmt_send_long_data", (char*) &com_stmt_send_long_data, SHOW_LONG}, {"Com_stmt_reset", (char*) &com_stmt_reset, SHOW_LONG}, {"Com_stmt_close", (char*) &com_stmt_close, SHOW_LONG}, {"Com_truncate", (char*) (com_stat+(uint) SQLCOM_TRUNCATE),SHOW_LONG}, {"Com_unlock_tables", (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG}, {"Com_update", (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG}, Loading Loading @@ -6084,6 +6098,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_SLOW_QUERY_LOG: opt_slow_log=1; break; case (int) OPT_LOG_SLOW_ADMIN_STATEMENTS: opt_log_slow_admin_statements= 1; break; case (int) OPT_SKIP_NEW: opt_specialflag|= SPECIAL_NO_NEW_FUNC; delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; Loading Loading @@ -6443,6 +6460,9 @@ static void get_options(int argc,char **argv) if (opt_bdb) sql_print_warning("this binary does not contain BDB storage engine"); #endif if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) && !opt_slow_log) sql_print_warning("options --log-slow-admin-statements and --log-queries-not-using-indexes have no effect if --log-slow-queries is not set"); /* Check that the default storage engine is actually available. Loading
sql/sql_class.h +1 −1 Original line number Diff line number Diff line Loading @@ -916,7 +916,7 @@ class THD :public ilink, bool query_error, bootstrap, cleanup_done; bool tmp_table_used; bool charset_is_system_charset, charset_is_collation_connection; bool slow_command; bool enable_slow_log; /* enable slow log for current statement */ my_bool volatile killed; /* Loading
sql/sql_parse.cc +23 −19 Original line number Diff line number Diff line Loading @@ -59,7 +59,6 @@ static void remove_escape(char *name); static void refresh_status(void); static bool append_file_to_dir(THD *thd, const char **filename_ptr, const char *table_name); static void log_slow_query(THD *thd); const char *any_db="*any*"; // Special symbol for check_access Loading Loading @@ -1342,10 +1341,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->command=command; /* Commands which will always take a long time should be marked with this so that they will not get logged to the slow query log Commands which always take a long time are logged into the slow log only if opt_log_slow_admin_statements is set. */ thd->slow_command=FALSE; thd->enable_slow_log= TRUE; thd->set_time(); VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query_id=query_id; Loading Loading @@ -1383,7 +1382,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, uint tbl_len= *(uchar*) (packet + db_len + 1); statistic_increment(com_other, &LOCK_status); thd->slow_command= TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; db= thd->alloc(db_len + tbl_len + 2); tbl_name= strmake(db, packet + 1, db_len)+1; strmake(tbl_name, packet + db_len + 2, tbl_len); Loading Loading @@ -1515,7 +1514,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #endif ulong length= (ulong)(packet_end-packet); log_slow_query(thd); log_slow_statement(thd); /* Remove garbage at start of query */ while (my_isspace(thd->charset(), *packet) && length > 0) Loading Loading @@ -1658,7 +1657,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, uint32 slave_server_id; statistic_increment(com_other,&LOCK_status); thd->slow_command = TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; if (check_global_access(thd, REPL_SLAVE_ACL)) break; Loading Loading @@ -1827,7 +1826,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (thd->is_fatal_error) send_error(thd,0); // End of memory ? log_slow_query(thd); log_slow_statement(thd); thd->proc_info="cleaning up"; VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list Loading @@ -1843,13 +1842,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } static void log_slow_query(THD *thd) void log_slow_statement(THD *thd) { time_t start_of_query=thd->start_time; thd->end_time(); // Set start time /* If not reading from backup and if the query took too long */ if (!thd->slow_command && !thd->user_time) // do not log 'slow_command' queries /* Do not log administrative statements unless the appropriate option is set; do not log into slow log if reading from backup. */ if (thd->enable_slow_log && !thd->user_time) { thd->proc_info="logging slow query"; Loading Loading @@ -2190,6 +2192,8 @@ mysql_execute_command(THD *thd) DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", lex->prepared_stmt_name.length, lex->prepared_stmt_name.str)); /* We account deallocate in the same manner as mysql_stmt_close */ statistic_increment(com_stmt_close, &LOCK_status); if ((stmt= thd->stmt_map.find_by_name(&lex->prepared_stmt_name))) { thd->stmt_map.erase(stmt); Loading Loading @@ -2292,7 +2296,7 @@ mysql_execute_command(THD *thd) check_table_access(thd,SELECT_ACL, tables,0) || check_global_access(thd, FILE_ACL)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_backup_table(thd, tables); break; Loading @@ -2303,7 +2307,7 @@ mysql_execute_command(THD *thd) check_table_access(thd, INSERT_ACL, tables,0) || check_global_access(thd, FILE_ACL)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_restore_table(thd, tables); break; } Loading Loading @@ -2538,7 +2542,7 @@ mysql_execute_command(THD *thd) case SQLCOM_CREATE_INDEX: if (check_one_table_access(thd, INDEX_ACL, tables)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; if (end_active_trans(thd)) res= -1; else Loading Loading @@ -2624,7 +2628,7 @@ mysql_execute_command(THD *thd) res= -1; else { thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res= mysql_alter_table(thd, select_lex->db, lex->name, &lex->create_info, tables, lex->create_list, Loading Loading @@ -2716,7 +2720,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_repair_table(thd, tables, &lex->check_opt); /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) Loading @@ -2736,7 +2740,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd, SELECT_ACL | EXTRA_ACL , tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_check_table(thd, tables, &lex->check_opt); break; } Loading @@ -2745,7 +2749,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res = mysql_analyze_table(thd, tables, &lex->check_opt); /* ! we write after unlocking the table */ if (!res && !lex->no_write_to_binlog) Loading @@ -2766,7 +2770,7 @@ mysql_execute_command(THD *thd) if (check_db_used(thd,tables) || check_table_access(thd,SELECT_ACL | INSERT_ACL, tables,0)) goto error; /* purecov: inspected */ thd->slow_command=TRUE; thd->enable_slow_log= opt_log_slow_admin_statements; res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ? mysql_recreate_table(thd, tables, 1) : mysql_optimize_table(thd, tables, &lex->check_opt); Loading