summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorcmiller@zippy.cornsilk.net <>2007-02-22 10:03:08 -0500
committercmiller@zippy.cornsilk.net <>2007-02-22 10:03:08 -0500
commit6e096ee8d9f5aa2cbe3c2bba4aecde6fceaa888f (patch)
tree1bef9445e8b72c15c47554a6cfa32aef7e32ce69 /sql/sql_table.cc
parentdffdc8118b2af185861eac52f220d96b32c76b37 (diff)
downloadmariadb-git-6e096ee8d9f5aa2cbe3c2bba4aecde6fceaa888f.tar.gz
Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement. --- Bug#24795: SHOW PROFILE Profiling is only partially functional on some architectures. Where there is no getrusage() system call, presently Null values are returned where it would be required. Notably, Windows needs some love applied to make it as useful. Syntax this adds: SHOW PROFILES SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n] where "n" is an integer and "types" is zero or many (comma-separated) of "CPU" "MEMORY" (not presently supported) "BLOCK IO" "CONTEXT SWITCHES" "PAGE FAULTS" "IPC" "SWAPS" "SOURCE" "ALL" It also adds a session variable (boolean) "profiling", set to "no" by default, and (integer) profiling_history_size, set to 15 by default. This patch abstracts setting THDs' "proc_info" behind a macro that can be used as a hook into the profiling code when profiling support is compiled in. All future code in this line should use that mechanism for setting thd->proc_info. --- Tests are now set to omit the statistics. --- Adds an Information_schema table, "profiling" for access to "show profile" data. --- Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795 into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community --- Fix merge problems. --- Fixed one bug in the query_source being NULL. Updated test results. --- Include more thorough profiling tests. Improve support for prepared statements. Use session-specific query IDs, starting at zero. --- Selecting from I_S.profiling is no longer quashed in profiling, as requested by Giuseppe. Limit the size of captured query text. No longer log queries that are zero length.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 43fdd693a4b..dc474c080b4 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1729,7 +1729,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
- THD_PROC_INFO(thd, "creating table");
+ thd_proc_info(thd, "creating table");
create_info->table_existed= 0; // Mark that table is created
if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
@@ -1760,7 +1760,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
end:
VOID(pthread_mutex_unlock(&LOCK_open));
- THD_PROC_INFO(thd, "After create");
+ thd_proc_info(thd, "After create");
DBUG_RETURN(error);
warn:
@@ -2879,7 +2879,7 @@ mysql_discard_or_import_tablespace(THD *thd,
ALTER TABLE
*/
- THD_PROC_INFO(thd, "discard_or_import_tablespace");
+ thd_proc_info(thd, "discard_or_import_tablespace");
discard= test(tablespace_op == DISCARD_TABLESPACE);
@@ -2896,7 +2896,7 @@ mysql_discard_or_import_tablespace(THD *thd,
error=table->file->discard_or_import_tablespace(discard);
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
if (error)
goto err;
@@ -3007,7 +3007,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
frm_type_enum frm_type;
DBUG_ENTER("mysql_alter_table");
- THD_PROC_INFO(thd, "init");
+ thd_proc_info(thd, "init");
table_name=table_list->table_name;
alias= (lower_case_table_names == 2) ? table_list->alias : table_name;
@@ -3142,7 +3142,7 @@ view_err:
DBUG_RETURN(TRUE);
}
- THD_PROC_INFO(thd, "setup");
+ thd_proc_info(thd, "setup");
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
!table->s->tmp_table) // no need to touch frm
{
@@ -3173,7 +3173,7 @@ view_err:
if (!error && (new_name != table_name || new_db != db))
{
- THD_PROC_INFO(thd, "rename");
+ thd_proc_info(thd, "rename");
/* Then do a 'simple' rename of the table */
if (!access(new_name_buff,F_OK))
{
@@ -3627,7 +3627,7 @@ view_err:
/* We don't want update TIMESTAMP fields during ALTER TABLE. */
thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields
thd->cuted_fields=0L;
- THD_PROC_INFO(thd, "copy to tmp table");
+ thd_proc_info(thd, "copy to tmp table");
next_insert_id=thd->next_insert_id; // Remember for logging
copied=deleted=0;
if (new_table && !new_table->s->is_view)
@@ -3711,7 +3711,7 @@ view_err:
from the cache, free all locks, close the old table and remove it.
*/
- THD_PROC_INFO(thd, "rename result table");
+ thd_proc_info(thd, "rename result table");
my_snprintf(old_name, sizeof(old_name), "%s2-%lx-%lx", tmp_file_prefix,
current_pid, thd->thread_id);
if (lower_case_table_names)
@@ -3822,7 +3822,7 @@ view_err:
broadcast_refresh();
goto err;
}
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
if (mysql_bin_log.is_open())
{
thd->clear_error();