Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-01-27 22:49:31-05:00, cmiller@stripped +38 -0
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community--bug24795
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-testing-profiling
MERGE: 1.2294.47.3
configure.in@stripped, 2007-01-27 22:49:23-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.407.4.1
include/my_dbug.h@stripped, 2007-01-27 22:49:23-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.20.1.1
libmysqld/Makefile.am@stripped, 2007-01-27 22:49:23-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.70.1.3
myisam/mi_open.c@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.98.1.1
ndb/src/ndbapi/DictCache.cpp@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.19.1.1
sql/Makefile.am@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.128.1.3
sql/ha_archive.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.78.1.2
sql/ha_myisam.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.170.1.2
sql/ha_myisammrg.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.85.1.1
sql/ha_ndbcluster.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.291.1.1
sql/item_cmpfunc.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.224.3.1
sql/item_func.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.316.2.2
sql/lex.h@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.144.1.3
sql/lock.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.90.1.2
sql/log_event.cc@stripped, 2007-01-27 22:49:24-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.216.1.2
sql/mysql_priv.h@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.423.1.4
sql/mysqld.cc@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.577.2.6
sql/repl_failsafe.cc@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.61.1.2
sql/set_var.cc@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.173.1.1
sql/set_var.h@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.78.1.1
sql/slave.cc@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.286.1.2
sql/sp_head.cc@stripped, 2007-01-27 22:49:25-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.226.1.2
sql/sql_base.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.356.1.4
sql/sql_cache.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.96.1.2
sql/sql_class.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.254.2.3
sql/sql_class.h@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.310.4.3
sql/sql_delete.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.187.1.2
sql/sql_insert.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.206.2.2
sql/sql_lex.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.206.4.3
sql/sql_lex.h@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.233.1.3
sql/sql_parse.cc@stripped, 2007-01-27 22:49:26-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.590.3.3
sql/sql_repl.cc@stripped, 2007-01-27 22:49:27-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.153.1.2
sql/sql_select.cc@stripped, 2007-01-27 22:49:27-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.475.3.2
sql/sql_show.cc@stripped, 2007-01-27 22:49:27-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.333.1.2
sql/sql_table.cc@stripped, 2007-01-27 22:49:27-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.325.1.3
sql/sql_update.cc@stripped, 2007-01-27 22:49:27-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.205.1.2
sql/sql_view.cc@stripped, 2007-01-27 22:49:27-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.100.1.2
sql/sql_yacc.yy@stripped, 2007-01-27 22:49:28-05:00, cmiller@stripped +0 -0
Auto merged
MERGE: 1.498.1.3
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: cmiller
# Host: zippy.cornsilk.net
# Root: /home/cmiller/work/mysql/mysql-5.0-community-testing-profiling/RESYNC
--- 1.420/configure.in 2007-01-27 22:49:38 -05:00
+++ 1.421/configure.in 2007-01-27 22:49:38 -05:00
@@ -667,6 +667,21 @@ else
AC_MSG_RESULT([no])
fi
+# Add query profiler
+AC_ARG_ENABLE(profiling,
+ [ --disable-profiling Build a version without query profiling code],
+ [ ENABLED_PROFILING=$enableval],
+ [ ENABLED_PROFILING=no])
+
+AC_DEFINE([ENABLED_PROFILING], [1],
+ [If SHOW PROFILE should be enabled by default])
+
+if test "$ENABLED_PROFILING" = "yes"
+then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
# Use this to set the place used for unix socket used to local communication.
AC_ARG_WITH(unix-socket-path,
--- 1.21/include/my_dbug.h 2007-01-27 22:49:38 -05:00
+++ 1.22/include/my_dbug.h 2007-01-27 22:49:38 -05:00
@@ -50,12 +50,12 @@ extern void _db_unlock_file(void);
&_db_framep_)
#define DBUG_LEAVE \
(_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
-#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
-#define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
+#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
+#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
#define DBUG_EXECUTE(keyword,a1) \
- {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
+ do {if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}} while(0)
#define DBUG_PRINT(keyword,arglist) \
- {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
+ do {if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}} while(0)
#define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ ()
#define DBUG_PROCESS(a1) (_db_process_ = a1)
@@ -63,7 +63,7 @@ extern void _db_unlock_file(void);
#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
#define DBUG_DUMP(keyword,a1,a2)\
- {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
+ do {if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}} while(0)
#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
#define DEBUGGER_OFF _no_db_=1;_db_on_=0;
#define DEBUGGER_ON _no_db_=0
@@ -73,7 +73,7 @@ extern void _db_unlock_file(void);
#define DBUG_OUTPUT(A) { _db_output_(A); }
#define DBUG_ASSERT(A) assert(A)
#define DBUG_EXECUTE_IF(keyword,a1) \
- {if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
+ do {if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}} while(0)
#else /* No debugger */
#define DBUG_ENTER(a1)
--- 1.102/myisam/mi_open.c 2007-01-27 22:49:38 -05:00
+++ 1.103/myisam/mi_open.c 2007-01-27 22:49:38 -05:00
@@ -196,7 +196,7 @@ MI_INFO *mi_open(const char *name, int m
if (len != MI_BASE_INFO_SIZE)
{
DBUG_PRINT("warning",("saved_base_info_length: %d base_info_length: %d",
- len,MI_BASE_INFO_SIZE))
+ len,MI_BASE_INFO_SIZE));
}
disk_pos= (char*)
my_n_base_info_read((uchar*) disk_cache + base_pos, &share->base);
--- 1.173/sql/ha_myisam.cc 2007-01-27 22:49:38 -05:00
+++ 1.174/sql/ha_myisam.cc 2007-01-27 22:49:38 -05:00
@@ -339,7 +339,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_
MYISAM_SHARE* share = file->s;
const char *old_proc_info=thd->proc_info;
- THD_PROC_INFO(thd, "Checking table");
+ thd_proc_info(thd, "Checking table");
myisamchk_init(¶m);
param.thd = thd;
param.op_name = "check";
@@ -413,7 +413,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
}
- THD_PROC_INFO(thd, old_proc_info);
+ thd_proc_info(thd, old_proc_info);
return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
}
@@ -679,22 +679,22 @@ int ha_myisam::repair(THD *thd, MI_CHECK
char buf[40];
/* TODO: respect myisam_repair_threads variable */
my_snprintf(buf, 40, "Repair with %d threads", my_count_bits(key_map));
- THD_PROC_INFO(thd, buf);
+ thd_proc_info(thd, buf);
error = mi_repair_parallel(¶m, file, fixed_name,
param.testflag & T_QUICK);
- THD_PROC_INFO(thd, "Repair done"); // to reset proc_info, as
+ thd_proc_info(thd, "Repair done"); // to reset proc_info, as
// it was pointing to local buffer
}
else
{
- THD_PROC_INFO(thd, "Repair by sorting");
+ thd_proc_info(thd, "Repair by sorting");
error = mi_repair_by_sort(¶m, file, fixed_name,
param.testflag & T_QUICK);
}
}
else
{
- THD_PROC_INFO(thd, "Repair with keycache");
+ thd_proc_info(thd, "Repair with keycache");
param.testflag &= ~T_REP_BY_SORT;
error= mi_repair(¶m, file, fixed_name,
param.testflag & T_QUICK);
@@ -708,7 +708,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK
(share->state.changed & STATE_NOT_SORTED_PAGES))
{
optimize_done=1;
- THD_PROC_INFO(thd, "Sorting index");
+ thd_proc_info(thd, "Sorting index");
error=mi_sort_index(¶m,file,fixed_name);
}
if (!statistics_done && (local_testflag & T_STATISTICS))
@@ -716,14 +716,14 @@ int ha_myisam::repair(THD *thd, MI_CHECK
if (share->state.changed & STATE_NOT_ANALYZED)
{
optimize_done=1;
- THD_PROC_INFO(thd, "Analyzing");
+ thd_proc_info(thd, "Analyzing");
error = chk_key(¶m, file);
}
else
local_testflag&= ~T_STATISTICS; // Don't update statistics
}
}
- THD_PROC_INFO(thd, "Saving state");
+ thd_proc_info(thd, "Saving state");
if (!error)
{
if ((share->state.changed & STATE_CHANGED) || mi_is_crashed(file))
@@ -761,7 +761,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK
file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
update_state_info(¶m, file, 0);
}
- THD_PROC_INFO(thd, old_proc_info);
+ thd_proc_info(thd, old_proc_info);
if (!thd->locked_tables)
mi_lock_database(file,F_UNLCK);
DBUG_RETURN(error ? HA_ADMIN_FAILED :
@@ -986,7 +986,7 @@ int ha_myisam::enable_indexes(uint mode)
THD *thd=current_thd;
MI_CHECK param;
const char *save_proc_info=thd->proc_info;
- THD_PROC_INFO(thd, "Creating index");
+ thd_proc_info(thd, "Creating index");
myisamchk_init(¶m);
param.op_name= "recreating_index";
param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
@@ -1011,7 +1011,7 @@ int ha_myisam::enable_indexes(uint mode)
thd->clear_error();
}
info(HA_STATUS_CONST);
- THD_PROC_INFO(thd, save_proc_info);
+ thd_proc_info(thd, save_proc_info);
}
else
{
--- 1.87/sql/ha_myisammrg.cc 2007-01-27 22:49:38 -05:00
+++ 1.88/sql/ha_myisammrg.cc 2007-01-27 22:49:38 -05:00
@@ -96,7 +96,7 @@ int ha_myisammrg::open(const char *name,
DBUG_PRINT("info", ("ha_myisammrg::open exit %d", my_errno));
return (my_errno ? my_errno : -1);
}
- DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."))
+ DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."));
myrg_extrafunc(file, query_cache_invalidate_by_MyISAM_filename_ref);
if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
--- 1.228/sql/item_cmpfunc.cc 2007-01-27 22:49:38 -05:00
+++ 1.229/sql/item_cmpfunc.cc 2007-01-27 22:49:38 -05:00
@@ -3006,7 +3006,7 @@ longlong Item_is_not_null_test::val_int(
}
if (args[0]->is_null())
{
- DBUG_PRINT("info", ("null"))
+ DBUG_PRINT("info", ("null"));
owner->was_null|= 1;
DBUG_RETURN(0);
}
--- 1.323/sql/item_func.cc 2007-01-27 22:49:38 -05:00
+++ 1.324/sql/item_func.cc 2007-01-27 22:49:38 -05:00
@@ -3204,7 +3204,7 @@ void debug_sync_point(const char* lock_n
Structure is now initialized. Try to get the lock.
Set up control struct to allow others to abort locks
*/
- THD_PROC_INFO(thd, "User lock");
+ thd_proc_info(thd, "User lock");
thd->mysys_var->current_mutex= &LOCK_user_locks;
thd->mysys_var->current_cond= &ull->cond;
@@ -3229,7 +3229,7 @@ void debug_sync_point(const char* lock_n
}
pthread_mutex_unlock(&LOCK_user_locks);
pthread_mutex_lock(&thd->mysys_var->mutex);
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
pthread_mutex_unlock(&thd->mysys_var->mutex);
@@ -3310,7 +3310,7 @@ longlong Item_func_get_lock::val_int()
Structure is now initialized. Try to get the lock.
Set up control struct to allow others to abort locks.
*/
- THD_PROC_INFO(thd, "User lock");
+ thd_proc_info(thd, "User lock");
thd->mysys_var->current_mutex= &LOCK_user_locks;
thd->mysys_var->current_cond= &ull->cond;
@@ -3348,7 +3348,7 @@ longlong Item_func_get_lock::val_int()
pthread_mutex_unlock(&LOCK_user_locks);
pthread_mutex_lock(&thd->mysys_var->mutex);
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
pthread_mutex_unlock(&thd->mysys_var->mutex);
--- 1.93/sql/lock.cc 2007-01-27 22:49:38 -05:00
+++ 1.94/sql/lock.cc 2007-01-27 22:49:38 -05:00
@@ -150,7 +150,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,
}
}
- THD_PROC_INFO(thd, "System lock");
+ thd_proc_info(thd, "System lock");
if (lock_external(thd, tables, count))
{
/* Clear the lock type of all lock data to avoid reusage. */
@@ -159,7 +159,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,
sql_lock=0;
break;
}
- THD_PROC_INFO(thd, "Table lock");
+ thd_proc_info(thd, "Table lock");
thd->locked=1;
/* Copy the lock data array. thr_multi_lock() reorders its contens. */
memcpy(sql_lock->locks + sql_lock->lock_count, sql_lock->locks,
@@ -193,7 +193,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,
thd->locked=0;
break;
}
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
/* some table was altered or deleted. reopen tables marked deleted */
mysql_unlock_tables(thd,sql_lock);
@@ -208,7 +208,7 @@ retry:
if (wait_for_tables(thd))
break; // Couldn't open tables
}
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
if (thd->killed)
{
thd->send_kill_message();
--- 1.218/sql/log_event.cc 2007-01-27 22:49:38 -05:00
+++ 1.219/sql/log_event.cc 2007-01-27 22:49:38 -05:00
@@ -4265,7 +4265,7 @@ int Create_file_log_event::exec_event(st
bzero((char*)&file, sizeof(file));
fname_buf= strmov(proc_info, "Making temp file ");
ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
- THD_PROC_INFO(thd, proc_info);
+ thd_proc_info(thd, proc_info);
my_delete(fname_buf, MYF(0)); // old copy may exist already
if ((fd= my_create(fname_buf, CREATE_MODE,
O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW,
@@ -4319,7 +4319,7 @@ err:
end_io_cache(&file);
if (fd >= 0)
my_close(fd, MYF(0));
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
return error ? 1 : Log_event::exec_event(rli);
}
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
@@ -4439,7 +4439,7 @@ int Append_block_log_event::exec_event(s
fname= strmov(proc_info, "Making temp file ");
slave_load_file_stem(fname, file_id, server_id, ".data");
- THD_PROC_INFO(thd, proc_info);
+ thd_proc_info(thd, proc_info);
if (get_create_or_append())
{
my_delete(fname, MYF(0)); // old copy may exist already
@@ -4473,7 +4473,7 @@ int Append_block_log_event::exec_event(s
err:
if (fd >= 0)
my_close(fd, MYF(0));
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
DBUG_RETURN(error ? error : Log_event::exec_event(rli));
}
#endif
--- 1.429/sql/mysql_priv.h 2007-01-27 22:49:38 -05:00
+++ 1.430/sql/mysql_priv.h 2007-01-27 22:49:38 -05:00
@@ -20,6 +20,9 @@
except the part which must be in the server and in the client.
*/
+#ifndef MYSQL_PRIV_H_INCLUDED
+#define MYSQL_PRIV_H_INCLUDED
+
#ifndef MYSQL_CLIENT
#include <my_global.h>
@@ -298,55 +301,57 @@ MY_LOCALE *my_locale_by_name(const char
TODO: separate three contexts above, move them to separate bitfields.
*/
-#define SELECT_DISTINCT (1L << 0) // SELECT, user
-#define SELECT_STRAIGHT_JOIN (1L << 1) // SELECT, user
-#define SELECT_DESCRIBE (1L << 2) // SELECT, user
-#define SELECT_SMALL_RESULT (1L << 3) // SELECT, user
-#define SELECT_BIG_RESULT (1L << 4) // SELECT, user
-#define OPTION_FOUND_ROWS (1L << 5) // SELECT, user
-#define OPTION_TO_QUERY_CACHE (1L << 6) // SELECT, user
-#define SELECT_NO_JOIN_CACHE (1L << 7) // intern
-#define OPTION_BIG_TABLES (1L << 8) // THD, user
-#define OPTION_BIG_SELECTS (1L << 9) // THD, user
-#define OPTION_LOG_OFF (1L << 10) // THD, user
-#define OPTION_UPDATE_LOG (1L << 11) // THD, user, unused
-#define TMP_TABLE_ALL_COLUMNS (1L << 12) // SELECT, intern
-#define OPTION_WARNINGS (1L << 13) // THD, user
-#define OPTION_AUTO_IS_NULL (1L << 14) // THD, user, binlog
-#define OPTION_FOUND_COMMENT (1L << 15) // SELECT, intern, parser
-#define OPTION_SAFE_UPDATES (1L << 16) // THD, user
-#define OPTION_BUFFER_RESULT (1L << 17) // SELECT, user
-#define OPTION_BIN_LOG (1L << 18) // THD, user
-#define OPTION_NOT_AUTOCOMMIT (1L << 19) // THD, user
-#define OPTION_BEGIN (1L << 20) // THD, intern
-#define OPTION_TABLE_LOCK (1L << 21) // THD, intern
-#define OPTION_QUICK (1L << 22) // SELECT (for DELETE)
-#define OPTION_QUOTE_SHOW_CREATE (1L << 23) // THD, user
+#define SELECT_DISTINCT (1ULL << 0) // SELECT, user
+#define SELECT_STRAIGHT_JOIN (1ULL << 1) // SELECT, user
+#define SELECT_DESCRIBE (1ULL << 2) // SELECT, user
+#define SELECT_SMALL_RESULT (1ULL << 3) // SELECT, user
+#define SELECT_BIG_RESULT (1ULL << 4) // SELECT, user
+#define OPTION_FOUND_ROWS (1ULL << 5) // SELECT, user
+#define OPTION_TO_QUERY_CACHE (1ULL << 6) // SELECT, user
+#define SELECT_NO_JOIN_CACHE (1ULL << 7) // intern
+#define OPTION_BIG_TABLES (1ULL << 8) // THD, user
+#define OPTION_BIG_SELECTS (1ULL << 9) // THD, user
+#define OPTION_LOG_OFF (1ULL << 10) // THD, user
+#define OPTION_UPDATE_LOG (1ULL << 11) // THD, user, unused
+#define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern
+#define OPTION_WARNINGS (1ULL << 13) // THD, user
+#define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog
+#define OPTION_FOUND_COMMENT (1ULL << 15) // SELECT, intern, parser
+#define OPTION_SAFE_UPDATES (1ULL << 16) // THD, user
+#define OPTION_BUFFER_RESULT (1ULL << 17) // SELECT, user
+#define OPTION_BIN_LOG (1ULL << 18) // THD, user
+#define OPTION_NOT_AUTOCOMMIT (1ULL << 19) // THD, user
+#define OPTION_BEGIN (1ULL << 20) // THD, intern
+#define OPTION_TABLE_LOCK (1ULL << 21) // THD, intern
+#define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE)
+#define OPTION_QUOTE_SHOW_CREATE (1ULL << 23) // THD, user
/* Thr following is used to detect a conflict with DISTINCT
in the user query has requested */
-#define SELECT_ALL (1L << 24) // SELECT, user, parser
+#define SELECT_ALL (1ULL << 24) // SELECT, user, parser
/* Set if we are updating a non-transaction safe table */
-#define OPTION_STATUS_NO_TRANS_UPDATE (1L << 25) // THD, intern
+#define OPTION_STATUS_NO_TRANS_UPDATE (1ULL << 25) // THD, intern
/* The following can be set when importing tables in a 'wrong order'
to suppress foreign key checks */
-#define OPTION_NO_FOREIGN_KEY_CHECKS (1L << 26) // THD, user, binlog
+#define OPTION_NO_FOREIGN_KEY_CHECKS (1ULL << 26) // THD, user, binlog
/* The following speeds up inserts to InnoDB tables by suppressing unique
key checks in some cases */
-#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27) // THD, user, binlog
-#define SELECT_NO_UNLOCK (1L << 28) // SELECT, intern
-#define OPTION_SCHEMA_TABLE (1L << 29) // SELECT, intern
+#define OPTION_RELAXED_UNIQUE_CHECKS (1ULL << 27) // THD, user, binlog
+#define SELECT_NO_UNLOCK (1ULL << 28) // SELECT, intern
+#define OPTION_SCHEMA_TABLE (1ULL << 29) // SELECT, intern
/* Flag set if setup_tables already done */
-#define OPTION_SETUP_TABLES_DONE (1L << 30) // intern
+#define OPTION_SETUP_TABLES_DONE (1ULL << 30) // intern
/* If not set then the thread will ignore all warnings with level notes. */
-#define OPTION_SQL_NOTES (1UL << 31) // THD, user
+#define OPTION_SQL_NOTES (1ULL << 31) // THD, user
/*
Force the used temporary table to be a MyISAM table (because we will use
fulltext functions when reading from it.
*/
-#define TMP_TABLE_FORCE_MYISAM (LL(1) << 32)
+#define TMP_TABLE_FORCE_MYISAM (1ULL << 32)
+#define OPTION_PROFILING (1ULL << 33)
+
/*
Maximum length of time zone name that we support
@@ -1239,6 +1244,9 @@ extern ulong binlog_cache_size, max_binl
extern ulong max_binlog_size, max_relay_log_size;
extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong back_log;
+#ifdef ENABLED_PROFILING
+extern ulong profiling_history_size;
+#endif
extern ulong specialflag, current_pid;
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
@@ -1686,3 +1694,5 @@ inline void kill_delayed_threads(void) {
#endif
#endif /* MYSQL_CLIENT */
+
+#endif
--- 1.588/sql/mysqld.cc 2007-01-27 22:49:38 -05:00
+++ 1.589/sql/mysqld.cc 2007-01-27 22:49:38 -05:00
@@ -399,6 +399,9 @@ ulong query_buff_size, slow_launch_time,
ulong open_files_limit, max_binlog_size, max_relay_log_size;
ulong slave_net_timeout, slave_trans_retries;
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
+#ifdef ENABLED_PROFILING
+ulong profiling_history_size=10;
+#endif
ulong query_cache_size=0;
ulong refresh_version, flush_version; /* Increments on each reload */
query_id_t query_id;
@@ -1657,7 +1660,7 @@ void end_thread(THD *thd, bool put_in_ca
! abort_loop && !kill_cached_threads)
{
/* Don't kill the thread, just put it in cache for reuse */
- DBUG_PRINT("info", ("Adding thread to cache"))
+ DBUG_PRINT("info", ("Adding thread to cache"));
cached_thread_count++;
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
(void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count);
--- 1.288/sql/slave.cc 2007-01-27 22:49:39 -05:00
+++ 1.289/sql/slave.cc 2007-01-27 22:49:39 -05:00
@@ -2924,9 +2924,9 @@ static int init_slave_thread(THD* thd, S
#endif
if (thd_type == SLAVE_THD_SQL)
- THD_PROC_INFO(thd, "Waiting for the next event in relay log");
+ thd_proc_info(thd, "Waiting for the next event in relay log");
else
- THD_PROC_INFO(thd, "Waiting for master update");
+ thd_proc_info(thd, "Waiting for master update");
thd->version=refresh_version;
thd->set_time();
DBUG_RETURN(0);
@@ -3545,7 +3545,7 @@ dump");
}
mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT;
- THD_PROC_INFO(thd, "Waiting to reconnect after a failed binlog dump request");
+ thd_proc_info(thd, "Waiting to reconnect after a failed binlog dump request");
#ifdef SIGNAL_WITH_VIO_CLOSE
thd->clear_active_vio();
#endif
--- 1.362/sql/sql_base.cc 2007-01-27 22:49:39 -05:00
+++ 1.363/sql/sql_base.cc 2007-01-27 22:49:39 -05:00
@@ -306,7 +306,7 @@ bool close_cached_tables(THD *thd, bool
*/
thd->mysys_var->current_mutex= &LOCK_open;
thd->mysys_var->current_cond= &COND_refresh;
- THD_PROC_INFO(thd, "Flushing tables");
+ thd_proc_info(thd, "Flushing tables");
close_old_data_files(thd,thd->open_tables,1,1);
mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL,
@@ -348,7 +348,7 @@ bool close_cached_tables(THD *thd, bool
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
pthread_mutex_unlock(&thd->mysys_var->mutex);
}
DBUG_RETURN(result);
@@ -1070,7 +1070,7 @@ void wait_for_refresh(THD *thd)
thd->mysys_var->current_mutex= &LOCK_open;
thd->mysys_var->current_cond= &COND_refresh;
proc_info=thd->proc_info;
- THD_PROC_INFO(thd, "Waiting for table");
+ thd_proc_info(thd, "Waiting for table");
if (!thd->killed)
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
@@ -1078,7 +1078,7 @@ void wait_for_refresh(THD *thd)
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
- THD_PROC_INFO(thd, proc_info);
+ thd_proc_info(thd, proc_info);
pthread_mutex_unlock(&thd->mysys_var->mutex);
DBUG_VOID_RETURN;
}
@@ -1783,7 +1783,7 @@ bool wait_for_tables(THD *thd)
bool result;
DBUG_ENTER("wait_for_tables");
- THD_PROC_INFO(thd, "Waiting for tables");
+ thd_proc_info(thd, "Waiting for tables");
pthread_mutex_lock(&LOCK_open);
while (!thd->killed)
{
@@ -1799,12 +1799,12 @@ bool wait_for_tables(THD *thd)
else
{
/* Now we can open all tables without any interference */
- THD_PROC_INFO(thd, "Reopen tables");
+ thd_proc_info(thd, "Reopen tables");
thd->version= refresh_version;
result=reopen_tables(thd,0,0);
}
pthread_mutex_unlock(&LOCK_open);
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
DBUG_RETURN(result);
}
@@ -2103,7 +2103,7 @@ int open_tables(THD *thd, TABLE_LIST **s
restart:
*counter= 0;
query_tables_last_own= 0;
- THD_PROC_INFO(thd, "Opening tables");
+ thd_proc_info(thd, "Opening tables");
/*
If we are not already executing prelocked statement and don't have
@@ -2283,7 +2283,7 @@ process_view_routines:
}
err:
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
free_root(&new_frm_mem, MYF(0)); // Free pre-alloced block
if (query_tables_last_own)
@@ -2357,7 +2357,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST
bool refresh;
DBUG_ENTER("open_ltable");
- THD_PROC_INFO(thd, "Opening table");
+ thd_proc_info(thd, "Opening table");
thd->current_tablenr= 0;
/* open_ltable can be used only for BASIC TABLEs */
table_list->required_type= FRMTYPE_TABLE;
@@ -2391,7 +2391,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST
table= 0;
}
}
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
DBUG_RETURN(table);
}
@@ -5436,7 +5436,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *s
List_iterator<Item_func_match> li(*(select_lex->ftfunc_list));
Item_func_match *ifm;
DBUG_PRINT("info",("Performing FULLTEXT search"));
- THD_PROC_INFO(thd, "FULLTEXT initialization");
+ thd_proc_info(thd, "FULLTEXT initialization");
while ((ifm=li++))
ifm->init_search(no_order);
--- 1.98/sql/sql_cache.cc 2007-01-27 22:49:39 -05:00
+++ 1.99/sql/sql_cache.cc 2007-01-27 22:49:39 -05:00
@@ -315,13 +315,13 @@ TODO list:
#define MUTEX_UNLOCK(M) {DBUG_PRINT("lock", ("mutex unlock 0x%lx",\
(ulong)(M))); pthread_mutex_unlock(M);}
#define RW_WLOCK(M) {DBUG_PRINT("lock", ("rwlock wlock 0x%lx",(ulong)(M))); \
- if (!rw_wrlock(M)) DBUG_PRINT("lock", ("rwlock wlock ok")) \
+ if (!rw_wrlock(M)) DBUG_PRINT("lock", ("rwlock wlock ok")); \
else DBUG_PRINT("lock", ("rwlock wlock FAILED %d", errno)); }
#define RW_RLOCK(M) {DBUG_PRINT("lock", ("rwlock rlock 0x%lx", (ulong)(M))); \
- if (!rw_rdlock(M)) DBUG_PRINT("lock", ("rwlock rlock ok")) \
+ if (!rw_rdlock(M)) DBUG_PRINT("lock", ("rwlock rlock ok")); \
else DBUG_PRINT("lock", ("rwlock wlock FAILED %d", errno)); }
#define RW_UNLOCK(M) {DBUG_PRINT("lock", ("rwlock unlock 0x%lx",(ulong)(M))); \
- if (!rw_unlock(M)) DBUG_PRINT("lock", ("rwlock unlock ok")) \
+ if (!rw_unlock(M)) DBUG_PRINT("lock", ("rwlock unlock ok")); \
else DBUG_PRINT("lock", ("rwlock unlock FAILED %d", errno)); }
#define STRUCT_LOCK(M) {DBUG_PRINT("lock", ("%d struct lock...",__LINE__)); \
pthread_mutex_lock(M);DBUG_PRINT("lock", ("struct lock OK"));}
@@ -688,7 +688,7 @@ void query_cache_abort(NET *net)
net->query_cache_query);
if (query_block) // Test if changed by other thread
{
- THD_PROC_INFO(thd, "storing result in query cache");
+ thd_proc_info(thd, "storing result in query cache");
DUMP(&query_cache);
BLOCK_LOCK_WR(query_block);
// The following call will remove the lock on query_block
@@ -726,7 +726,7 @@ void query_cache_end_of_result(THD *thd)
query_block= ((Query_cache_block*) thd->net.query_cache_query);
if (query_block)
{
- THD_PROC_INFO(thd, "storing result in query cache");
+ thd_proc_info(thd, "storing result in query cache");
DUMP(&query_cache);
BLOCK_LOCK_WR(query_block);
Query_cache_query *header= query_block->query();
@@ -1091,7 +1091,7 @@ Query_cache::send_result_to_client(THD *
DBUG_PRINT("qcache", ("No active database"));
}
- THD_PROC_INFO(thd, "checking query cache for query");
+ thd_proc_info(thd, "checking query cache for query");
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
@@ -1167,7 +1167,7 @@ sql mode: 0x%lx, sort len: %lu, conncat
}
// Check access;
- THD_PROC_INFO(thd, "checking privileges on cached query");
+ thd_proc_info(thd, "checking privileges on cached query");
block_table= query_block->table(0);
block_table_end= block_table+query_block->n_tables;
for (; block_table != block_table_end; block_table++)
@@ -1260,7 +1260,7 @@ sql mode: 0x%lx, sort len: %lu, conncat
Send cached result to client
*/
#ifndef EMBEDDED_LIBRARY
- THD_PROC_INFO(thd, "sending cached result to client");
+ thd_proc_info(thd, "sending cached result to client");
do
{
DBUG_PRINT("qcache", ("Results (len: %lu used: %lu headers: %lu)",
@@ -1342,7 +1342,7 @@ void Query_cache::invalidate(CHANGED_TAB
DBUG_ENTER("Query_cache::invalidate (changed table list)");
if (tables_used)
{
- THD_PROC_INFO(thd, "invalidating query cache entries (table list)");
+ thd_proc_info(thd, "invalidating query cache entries (table list)");
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size > 0 && !flush_in_progress)
{
@@ -1377,7 +1377,7 @@ void Query_cache::invalidate_locked_for_
DBUG_ENTER("Query_cache::invalidate_locked_for_write");
if (tables_used)
{
- THD_PROC_INFO(thd, "invalidating query cache entries (table)");
+ thd_proc_info(thd, "invalidating query cache entries (table)");
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size > 0 && !flush_in_progress)
{
@@ -1427,7 +1427,7 @@ void Query_cache::invalidate(THD *thd, c
STRUCT_LOCK(&structure_guard_mutex);
if (query_cache_size > 0 && !flush_in_progress)
{
- THD_PROC_INFO(thd, "invalidating query cache entries (key)");
+ thd_proc_info(thd, "invalidating query cache entries (key)");
using_transactions= using_transactions &&
(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN));
if (using_transactions) // used for innodb => has_transactions() is TRUE
--- 1.257/sql/sql_class.cc 2007-01-27 22:49:39 -05:00
+++ 1.258/sql/sql_class.cc 2007-01-27 22:49:39 -05:00
@@ -247,7 +247,9 @@ THD::THD()
init();
/* Initialize sub structures */
init_sql_alloc(&warn_root, WARN_ALLOC_BLOCK_SIZE, WARN_ALLOC_PREALLOC_SIZE);
+#ifdef ENABLED_PROFILING
profiling.set_thd(this);
+#endif
user_connect=(USER_CONN *)0;
hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0,
(hash_get_key) get_var_key,
@@ -330,7 +332,6 @@ void THD::init_for_queries()
variables.trans_alloc_block_size,
variables.trans_prealloc_size);
#endif
- profiling.reset();
transaction.xid_state.xid.null();
transaction.xid_state.in_thd=1;
}
--- 1.315/sql/sql_class.h 2007-01-27 22:49:39 -05:00
+++ 1.316/sql/sql_class.h 2007-01-27 22:49:39 -05:00
@@ -1072,6 +1072,7 @@ public:
};
+
/*
For each client connection we create a separate thread with THD serving as
a thread/connection descriptor
@@ -1154,6 +1155,9 @@ public:
Points to info-string that we show in SHOW PROCESSLIST
You are supposed to update thd->proc_info only if you have coded
a time-consuming piece that MySQL can get stuck in for a long time.
+
+ Set it using the THD_PROC_INFO(THD *thread, const char *message)
+ macro.
*/
const char *proc_info;
@@ -1309,7 +1313,9 @@ public:
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
uint total_warn_count;
+#ifdef ENABLED_PROFILING
PROFILING profiling;
+#endif
/*
Id of current query. Statement can be reused to execute several queries
--- 1.189/sql/sql_delete.cc 2007-01-27 22:49:39 -05:00
+++ 1.190/sql/sql_delete.cc 2007-01-27 22:49:39 -05:00
@@ -54,7 +54,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *
table->file->print_error(error, MYF(0));
DBUG_RETURN(error);
}
- THD_PROC_INFO(thd, "init");
+ thd_proc_info(thd, "init");
table->map=1;
if (mysql_prepare_delete(thd, table_list, &conds))
@@ -205,7 +205,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *
deleted=0L;
init_ftfuncs(thd, select_lex, 1);
- THD_PROC_INFO(thd, "updating");
+ thd_proc_info(thd, "updating");
if (table->triggers)
table->triggers->mark_fields_used(thd, TRG_EVENT_DELETE);
@@ -261,7 +261,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *
}
if (thd->killed && !error)
error= 1; // Aborted
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
end_read_record(&info);
free_io_cache(table); // Will not do any harm
if (options & OPTION_QUICK)
@@ -485,7 +485,7 @@ multi_delete::prepare(List<Item> &values
DBUG_ENTER("multi_delete::prepare");
unit= u;
do_delete= 1;
- THD_PROC_INFO(thd, "deleting from main table");
+ thd_proc_info(thd, "deleting from main table");
DBUG_RETURN(0);
}
@@ -749,7 +749,7 @@ int multi_delete::do_deletes()
bool multi_delete::send_eof()
{
- THD_PROC_INFO(thd, "deleting from reference tables");
+ thd_proc_info(thd, "deleting from reference tables");
/* Does deletes for the last n - 1 tables, returns 0 if ok */
int local_error= do_deletes(); // returns 0 if success
@@ -758,7 +758,7 @@ bool multi_delete::send_eof()
local_error= local_error || error;
/* reset used flags */
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
/*
We must invalidate the query cache before binlog writing and
--- 1.212/sql/sql_insert.cc 2007-01-27 22:49:39 -05:00
+++ 1.213/sql/sql_insert.cc 2007-01-27 22:49:39 -05:00
@@ -397,7 +397,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
if (res || thd->is_fatal_error)
DBUG_RETURN(TRUE);
- THD_PROC_INFO(thd, "init");
+ thd_proc_info(thd, "init");
thd->used_tables=0;
values= its++;
@@ -470,7 +470,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
error=0;
id=0;
- THD_PROC_INFO(thd, "update");
+ thd_proc_info(thd, "update");
if (duplic != DUP_ERROR || ignore)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
if (duplic == DUP_REPLACE)
@@ -676,7 +676,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
thd->lock=0;
}
}
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
table->next_number_field=0;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
thd->next_insert_id=0; // Reset this if wrongly used
@@ -1407,7 +1407,7 @@ I_List<delayed_insert> delayed_threads;
delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
{
- THD_PROC_INFO(thd, "waiting for delay_list");
+ thd_proc_info(thd, "waiting for delay_list");
pthread_mutex_lock(&LOCK_delayed_insert); // Protect master list
I_List_iterator<delayed_insert> it(delayed_threads);
delayed_insert *tmp;
@@ -1444,7 +1444,7 @@ static TABLE *delayed_get_table(THD *thd
*/
if (delayed_insert_threads >= thd->variables.max_insert_delayed_threads)
DBUG_RETURN(0);
- THD_PROC_INFO(thd, "Creating delayed handler");
+ thd_proc_info(thd, "Creating delayed handler");
pthread_mutex_lock(&LOCK_delayed_create);
/*
The first search above was done without LOCK_delayed_create.
@@ -1486,13 +1486,13 @@ static TABLE *delayed_get_table(THD *thd
}
/* Wait until table is open */
- THD_PROC_INFO(thd, "waiting for handler open");
+ thd_proc_info(thd, "waiting for handler open");
while (!tmp->thd.killed && !tmp->table && !thd->killed)
{
pthread_cond_wait(&tmp->cond_client,&tmp->mutex);
}
pthread_mutex_unlock(&tmp->mutex);
- THD_PROC_INFO(thd, "got old table");
+ thd_proc_info(thd, "got old table");
if (tmp->thd.killed)
{
if (tmp->thd.is_fatal_error)
@@ -1552,13 +1552,13 @@ TABLE *delayed_insert::get_local_table(T
tables_in_use++;
if (!thd.lock) // Table is not locked
{
- THD_PROC_INFO(client_thd, "waiting for handler lock");
+ thd_proc_info(client_thd, "waiting for handler lock");
pthread_cond_signal(&cond); // Tell handler to lock table
while (!dead && !thd.lock && ! client_thd->killed)
{
pthread_cond_wait(&cond_client,&mutex);
}
- THD_PROC_INFO(client_thd, "got handler lock");
+ thd_proc_info(client_thd, "got handler lock");
if (client_thd->killed)
goto error;
if (dead)
@@ -1576,7 +1576,7 @@ TABLE *delayed_insert::get_local_table(T
bytes. Since the table copy is used for creating one record only,
the other record buffers and alignment are unnecessary.
*/
- THD_PROC_INFO(client_thd, "allocating local table");
+ thd_proc_info(client_thd, "allocating local table");
copy= (TABLE*) client_thd->alloc(sizeof(*copy)+
(table->s->fields+1)*sizeof(Field**)+
table->s->reclength);
@@ -1656,11 +1656,11 @@ static int write_delayed(THD *thd,TABLE
delayed_insert *di=thd->di;
DBUG_ENTER("write_delayed");
- THD_PROC_INFO(thd, "waiting for handler insert");
+ thd_proc_info(thd, "waiting for handler insert");
pthread_mutex_lock(&di->mutex);
while (di->stacked_inserts >= delayed_queue_size && !thd->killed)
pthread_cond_wait(&di->cond_client,&di->mutex);
- THD_PROC_INFO(thd, "storing row into queue");
+ thd_proc_info(thd, "storing row into queue");
if (thd->killed || !(row= new delayed_row(duplic, ignore, log_on)))
goto err;
@@ -1869,7 +1869,7 @@ pthread_handler_t handle_delayed_insert(
/* Information for pthread_kill */
di->thd.mysys_var->current_mutex= &di->mutex;
di->thd.mysys_var->current_cond= &di->cond;
- THD_PROC_INFO(&(di->thd), "Waiting for INSERT");
+ thd_proc_info(&(di->thd), "Waiting for INSERT");
DBUG_PRINT("info",("Waiting for someone to insert rows"));
while (!thd->killed)
@@ -1904,7 +1904,7 @@ pthread_handler_t handle_delayed_insert(
pthread_mutex_unlock(&di->thd.mysys_var->mutex);
pthread_mutex_lock(&di->mutex);
}
- THD_PROC_INFO(&(di->thd), 0);
+ thd_proc_info(&(di->thd), 0);
if (di->tables_in_use && ! thd->lock)
{
@@ -2023,7 +2023,7 @@ bool delayed_insert::handle_inserts(void
table->next_number_field=table->found_next_number_field;
- THD_PROC_INFO(&thd, "upgrading lock");
+ thd_proc_info(&thd, "upgrading lock");
if (thr_upgrade_write_delay_lock(*thd.lock->locks))
{
/* This can only happen if thread is killed by shutdown */
@@ -2031,7 +2031,7 @@ bool delayed_insert::handle_inserts(void
goto err;
}
- THD_PROC_INFO(&thd, "insert");
+ thd_proc_info(&thd, "insert");
max_rows= delayed_insert_limit;
if (thd.killed || table->s->version != refresh_version)
{
@@ -2149,7 +2149,7 @@ bool delayed_insert::handle_inserts(void
{
if (tables_in_use)
pthread_cond_broadcast(&cond_client); // If waiting clients
- THD_PROC_INFO(&thd, "reschedule");
+ thd_proc_info(&thd, "reschedule");
pthread_mutex_unlock(&mutex);
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
{
@@ -2168,14 +2168,14 @@ bool delayed_insert::handle_inserts(void
if (!using_bin_log)
table->file->extra(HA_EXTRA_WRITE_CACHE);
pthread_mutex_lock(&mutex);
- THD_PROC_INFO(&thd, "insert");
+ thd_proc_info(&thd, "insert");
}
if (tables_in_use)
pthread_cond_broadcast(&cond_client); // If waiting clients
}
}
- THD_PROC_INFO(&thd, 0);
+ thd_proc_info(&thd, 0);
table->next_number_field=0;
pthread_mutex_unlock(&mutex);
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
--- 1.210/sql/sql_lex.cc 2007-01-27 22:49:39 -05:00
+++ 1.211/sql/sql_lex.cc 2007-01-27 22:49:39 -05:00
@@ -173,8 +173,9 @@ void lex_start(THD *thd, uchar *buf,uint
lex->proc_list.first= 0;
lex->escape_used= FALSE;
lex->reset_query_tables_list(FALSE);
+#ifdef ENABLED_PROFILING
lex->profile_options= PROFILE_NONE;
-
+#endif
lex->nest_level=0 ;
lex->allow_sum_func= 0;
lex->in_sum_func= NULL;
--- 1.237/sql/sql_lex.h 2007-01-27 22:49:39 -05:00
+++ 1.238/sql/sql_lex.h 2007-01-27 22:49:39 -05:00
@@ -939,8 +939,10 @@ typedef struct st_lex : public Query_tab
enum enum_var_type option_type;
enum enum_view_create_mode create_view_mode;
enum enum_drop_mode drop_mode;
+ union {
uint profile_options;
uint profile_query_id;
+ };
uint uint_geom_type;
uint grant, grant_tot_col, which_columns;
uint fk_delete_opt, fk_update_opt, fk_match_option;
--- 1.594/sql/sql_parse.cc 2007-01-27 22:49:39 -05:00
+++ 1.595/sql/sql_parse.cc 2007-01-27 22:49:39 -05:00
@@ -1058,7 +1058,7 @@ void execute_init_command(THD *thd, sys_
Vio* save_vio;
ulong save_client_capabilities;
- THD_PROC_INFO(thd, "Execution of init_command");
+ thd_proc_info(thd, "Execution of init_command");
/*
We need to lock init_command_var because
during execution of init_command_var query
@@ -1158,7 +1158,7 @@ pthread_handler_t handle_one_connection(
net->compress=1; // Use compression
thd->version= refresh_version;
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
thd->command= COM_SLEEP;
thd->set_time();
thd->init_for_queries();
@@ -1175,7 +1175,7 @@ pthread_handler_t handle_one_connection(
sctx->host_or_ip, "init_connect command failed");
sql_print_warning("%s", net->last_error);
}
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
thd->set_time();
thd->init_for_queries();
}
@@ -1258,7 +1258,7 @@ pthread_handler_t handle_bootstrap(void
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
thd->version=refresh_version;
thd->security_ctx->priv_user=
thd->security_ctx->user= (char*) my_strdup("boot", MYF(MY_WME));
@@ -2105,7 +2105,7 @@ bool dispatch_command(enum enum_server_c
if (thd->lock || thd->open_tables || thd->derived_tables ||
thd->prelocked_mode)
{
- THD_PROC_INFO(thd, "closing tables");
+ thd_proc_info(thd, "closing tables");
close_thread_tables(thd); /* Free tables */
}
/*
@@ -2128,9 +2128,9 @@ bool dispatch_command(enum enum_server_c
log_slow_statement(thd);
- THD_PROC_INFO(thd, "cleaning up");
+ thd_proc_info(thd, "cleaning up");
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
thd->command=COM_SLEEP;
thd->query=0;
thd->query_length=0;
@@ -2171,7 +2171,7 @@ void log_slow_statement(THD *thd)
/* == SQLCOM_END unless this is a SHOW command */
thd->lex->orig_sql_command == SQLCOM_END)
{
- THD_PROC_INFO(thd, "logging slow query");
+ thd_proc_info(thd, "logging slow query");
thd->status_var.long_query_count++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
}
@@ -2698,16 +2698,40 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_SHOW_PROFILES:
{
+#ifdef ENABLED_PROFILING
thd->profiling.store();
thd->profiling.discard();
res= thd->profiling.show_profiles();
+ if (res)
+ goto error;
+#else
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_FEATURE_DISABLED,
+ "Query profiling", "profiling");
+ goto error;
+#endif
break;
}
case SQLCOM_SHOW_PROFILE:
{
+#ifdef ENABLED_PROFILING
thd->profiling.store();
thd->profiling.discard(); // will get re-enabled by reset()
+ if (thd->lex->profile_query_id != 0)
+ res= thd->profiling.show(lex->profile_options, thd->lex->profile_query_id);
+ else
res= thd->profiling.show_last(lex->profile_options);
+ DBUG_PRINT("chad", ("profiling->show*() returned %d", res));
+ if (res)
+ goto error;
+#else
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "No Query Profiling");
+/*
+ FIXME
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, 0,
+ "Query profiling disabled in server");
+*/
+ goto error;
+#endif
break;
}
case SQLCOM_SHOW_NEW_MASTER:
@@ -3557,7 +3581,7 @@ end_with_restore_list:
if (add_item_to_list(thd, new Item_null()))
goto error;
- THD_PROC_INFO(thd, "init");
+ thd_proc_info(thd, "init");
if ((res= open_and_lock_tables(thd, all_tables)))
break;
@@ -4986,7 +5010,7 @@ create_sp_error:
send_ok(thd);
break;
}
- THD_PROC_INFO(thd, "query end");
+ thd_proc_info(thd, "query end");
/* Two binlog-related cleanups: */
/*
@@ -5157,7 +5181,7 @@ check_access(THD *thd, ulong want_access
else
save_priv= &dummy;
- THD_PROC_INFO(thd, "checking permissions");
+ thd_proc_info(thd, "checking permissions");
if ((!db || !db[0]) && !thd->db && !dont_check_global_grants)
{
@@ -5605,6 +5629,9 @@ mysql_init_query(THD *thd, uchar *buf, u
DBUG_ENTER("mysql_init_query");
lex_start(thd, buf, length);
mysql_reset_thd_for_next_command(thd);
+#ifdef ENABLED_PROFILING
+ thd->profiling.reset();
+#endif
DBUG_VOID_RETURN;
}
@@ -5646,7 +5673,6 @@ void mysql_reset_thd_for_next_command(TH
thd->total_warn_count=0; // Warnings for this query
thd->rand_used= 0;
thd->sent_row_count= thd->examined_row_count= 0;
- thd->profiling.reset();
}
DBUG_VOID_RETURN;
}
@@ -5870,7 +5896,7 @@ void mysql_parse(THD *thd, char *inBuf,
query_cache_abort(&thd->net);
lex->unit.cleanup();
}
- THD_PROC_INFO(thd, "freeing items");
+ thd_proc_info(thd, "freeing items");
thd->end_statement();
thd->cleanup_after_query();
DBUG_ASSERT(thd->change_list.is_empty());
--- 1.479/sql/sql_select.cc 2007-01-27 22:49:39 -05:00
+++ 1.480/sql/sql_select.cc 2007-01-27 22:49:39 -05:00
@@ -598,7 +598,7 @@ JOIN::optimize()
if (thd->lex->orig_sql_command != SQLCOM_SHOW_STATUS)
thd->status_var.last_query_cost= 0.0;
- THD_PROC_INFO(thd, "optimizing");
+ thd_proc_info(thd, "optimizing");
row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
unit->select_limit_cnt);
/* select_limit is used to decide if we are likely to scan the whole table */
@@ -745,7 +745,7 @@ JOIN::optimize()
sort_by_table= get_sort_by_table(order, group_list, select_lex->leaf_tables);
/* Calculate how to do the join */
- THD_PROC_INFO(thd, "statistics");
+ thd_proc_info(thd, "statistics");
if (make_join_statistics(this, select_lex->leaf_tables, conds, &keyuse) ||
thd->is_fatal_error)
{
@@ -755,7 +755,7 @@ JOIN::optimize()
/* Remove distinct if only const tables */
select_distinct= select_distinct && (const_tables != tables);
- THD_PROC_INFO(thd, "preparing");
+ thd_proc_info(thd, "preparing");
if (result->initialize_tables(this))
{
DBUG_PRINT("error",("Error: initialize_tables() failed"));
@@ -1102,10 +1102,9 @@ JOIN::optimize()
join_tab[const_tables].type != JT_REF_OR_NULL &&
(order && simple_order || group_list && simple_group))
{
- if (add_ref_to_table_cond(thd,&join_tab[const_tables])) {
+ if (add_ref_to_table_cond(thd,&join_tab[const_tables]))
DBUG_RETURN(1);
}
- }
if (!(select_options & SELECT_BIG_RESULT) &&
((group_list &&
@@ -1162,7 +1161,7 @@ JOIN::optimize()
if (need_tmp)
{
DBUG_PRINT("info",("Creating tmp table"));
- THD_PROC_INFO(thd, "creating temporary table");
+ thd_proc_info(thd, "creating temporary table");
init_items_ref_array();
@@ -1213,7 +1212,7 @@ JOIN::optimize()
if (group_list && simple_group)
{
DBUG_PRINT("info",("Sorting for group"));
- THD_PROC_INFO(thd, "sorting for group");
+ thd_proc_info(thd, "sorting for group");
if (create_sort_index(thd, this, group_list,
HA_POS_ERROR, HA_POS_ERROR) ||
alloc_group_fields(this, group_list) ||
@@ -1235,7 +1234,7 @@ JOIN::optimize()
if (!group_list && ! exec_tmp_table1->distinct && order && simple_order)
{
DBUG_PRINT("info",("Sorting for order"));
- THD_PROC_INFO(thd, "Sorting for order");
+ thd_proc_info(thd, "Sorting for order");
if (create_sort_index(thd, this, order,
HA_POS_ERROR, HA_POS_ERROR))
{
@@ -1364,7 +1363,7 @@ JOIN::exec()
int tmp_error;
DBUG_ENTER("JOIN::exec");
- THD_PROC_INFO(thd, "executing");
+ thd_proc_info(thd, "executing");
error= 0;
if (procedure)
{
@@ -1504,7 +1503,7 @@ JOIN::exec()
curr_tmp_table= exec_tmp_table1;
/* Copy data to the temporary table */
- THD_PROC_INFO(thd, "Copying to tmp table");
+ thd_proc_info(thd, "Copying to tmp table");
DBUG_PRINT("info", ("%s", thd->proc_info));
if ((tmp_error= do_select(curr_join, (List<Item> *) 0, curr_tmp_table, 0)))
{
@@ -1627,7 +1626,7 @@ JOIN::exec()
}
if (curr_join->group_list)
{
- THD_PROC_INFO(thd, "Creating sort index");
+ thd_proc_info(thd, "Creating sort index");
if (curr_join->join_tab == join_tab && save_join_tab())
{
DBUG_VOID_RETURN;
@@ -1641,7 +1640,7 @@ JOIN::exec()
sortorder= curr_join->sortorder;
}
- THD_PROC_INFO(thd, "Copying to group table");
+ thd_proc_info(thd, "Copying to group table");
DBUG_PRINT("info", ("%s", thd->proc_info));
tmp_error= -1;
if (curr_join != this)
@@ -1697,7 +1696,7 @@ JOIN::exec()
curr_join->join_free(); /* Free quick selects */
if (curr_join->select_distinct && ! curr_join->group_list)
{
- THD_PROC_INFO(thd, "Removing duplicates");
+ thd_proc_info(thd, "Removing duplicates");
if (curr_join->tmp_having)
curr_join->tmp_having->update_used_tables();
if (remove_duplicates(curr_join, curr_tmp_table,
@@ -1758,7 +1757,7 @@ JOIN::exec()
if (curr_join->group_list || curr_join->order)
{
DBUG_PRINT("info",("Sorting for send_fields"));
- THD_PROC_INFO(thd, "Sorting result");
+ thd_proc_info(thd, "Sorting result");
/* If we have already done the group, add HAVING to sorted table */
if (curr_join->tmp_having && ! curr_join->group_list &&
! curr_join->sort_and_group)
@@ -1882,7 +1881,7 @@ JOIN::exec()
}
else
{
- THD_PROC_INFO(thd, "Sending data");
+ thd_proc_info(thd, "Sending data");
DBUG_PRINT("info", ("%s", thd->proc_info));
result->send_fields((procedure ? curr_join->procedure_fields_list :
*curr_fields_list),
@@ -2030,7 +2029,7 @@ mysql_select(THD *thd, Item ***rref_poin
{
if (!(join= new JOIN(thd, fields, select_options, result)))
DBUG_RETURN(TRUE);
- THD_PROC_INFO(thd, "init");
+ thd_proc_info(thd, "init");
thd->used_tables=0; // Updated by setup_fields
if (err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
@@ -2075,9 +2074,9 @@ mysql_select(THD *thd, Item ***rref_poin
err:
if (free_join)
{
- THD_PROC_INFO(thd, "cleaning up");
+ thd_proc_info(thd, "cleaning up");
err|= select_lex->cleanup();
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
DBUG_RETURN(err || thd->net.report_error);
}
DBUG_RETURN(join->error);
@@ -9807,7 +9806,7 @@ free_tmp_table(THD *thd, TABLE *entry)
DBUG_PRINT("enter",("table: %s",entry->alias));
save_proc_info=thd->proc_info;
- THD_PROC_INFO(thd, "removing tmp table");
+ thd_proc_info(thd, "removing tmp table");
if (entry->file)
{
@@ -9835,7 +9834,7 @@ free_tmp_table(THD *thd, TABLE *entry)
bitmap_clear_bit(&temp_pool, entry->temp_pool_slot);
free_root(&own_root, MYF(0)); /* the table is allocated in its own root */
- THD_PROC_INFO(thd, save_proc_info);
+ thd_proc_info(thd, save_proc_info);
DBUG_VOID_RETURN;
}
@@ -9865,7 +9864,7 @@ bool create_myisam_from_heap(THD *thd, T
DBUG_RETURN(1); // End of memory
save_proc_info=thd->proc_info;
- THD_PROC_INFO(thd, "converting HEAP to MyISAM");
+ thd_proc_info(thd, "converting HEAP to MyISAM");
if (create_myisam_tmp_table(&new_table,param,
thd->lex->select_lex.options | thd->options))
@@ -9918,7 +9917,7 @@ bool create_myisam_from_heap(THD *thd, T
table->s= &table->share_not_to_be_used;
table->file->change_table_ptr(table);
if (save_proc_info)
- THD_PROC_INFO(thd, (!strcmp(save_proc_info,"Copying to tmp table") ?
+ thd_proc_info(thd, (!strcmp(save_proc_info,"Copying to tmp table") ?
"Copying to tmp table on disk" : save_proc_info));
DBUG_RETURN(0);
@@ -9931,7 +9930,7 @@ bool create_myisam_from_heap(THD *thd, T
new_table.file->delete_table(new_table.s->table_name);
delete new_table.file;
err2:
- THD_PROC_INFO(thd, save_proc_info);
+ thd_proc_info(thd, save_proc_info);
DBUG_RETURN(1);
}
--- 1.336/sql/sql_show.cc 2007-01-27 22:49:39 -05:00
+++ 1.337/sql/sql_show.cc 2007-01-27 22:49:39 -05:00
@@ -1349,7 +1349,7 @@ void mysqld_list_processes(THD *thd,cons
#if !defined(DONT_USE_THR_ALARM) && ! defined(SCO)
if (pthread_kill(tmp->real_id,0))
- THD_PROC_INFO(tmp, "*** DEAD ***"); // This shouldn't happen
+ thd_proc_info(tmp, "*** DEAD ***"); // This shouldn't happen
#endif
#ifdef EXTRA_DEBUG
thd_info->start_time= tmp->time_after_lock;
--- 1.330/sql/sql_table.cc 2007-01-27 22:49:39 -05:00
+++ 1.331/sql/sql_table.cc 2007-01-27 22:49:39 -05:00
@@ -1729,7 +1729,7 @@ bool mysql_create_table(THD *thd,const c
}
}
- 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 c
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 *
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 *
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 *ne
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();
--- 1.208/sql/sql_update.cc 2007-01-27 22:49:39 -05:00
+++ 1.209/sql/sql_update.cc 2007-01-27 22:49:39 -05:00
@@ -166,7 +166,7 @@ int mysql_update(THD *thd,
mysql_handle_derived(thd->lex, &mysql_derived_filling)))
DBUG_RETURN(1);
- THD_PROC_INFO(thd, "init");
+ thd_proc_info(thd, "init");
table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@@ -358,7 +358,7 @@ int mysql_update(THD *thd,
else
init_read_record_idx(&info, thd, table, 1, used_index);
- THD_PROC_INFO(thd, "Searching rows for update");
+ thd_proc_info(thd, "Searching rows for update");
uint tmp_limit= limit;
while (!(error=info.read_record(&info)) && !thd->killed)
@@ -423,7 +423,7 @@ int mysql_update(THD *thd,
updated= found= 0;
thd->count_cuted_fields= CHECK_FIELD_WARN; /* calc cuted fields */
thd->cuted_fields=0L;
- THD_PROC_INFO(thd, "Updating");
+ thd_proc_info(thd, "Updating");
query_id=thd->query_id;
transactional_table= table->file->has_transactions();
@@ -511,7 +511,7 @@ int mysql_update(THD *thd,
end_read_record(&info);
free_io_cache(table); // If ORDER BY
delete select;
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
VOID(table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY));
/*
@@ -959,7 +959,7 @@ int multi_update::prepare(List<Item> &no
thd->count_cuted_fields= CHECK_FIELD_WARN;
thd->cuted_fields=0L;
- THD_PROC_INFO(thd, "updating main table");
+ thd_proc_info(thd, "updating main table");
tables_to_update= get_table_map(fields);
@@ -1511,11 +1511,11 @@ err2:
bool multi_update::send_eof()
{
char buff[STRING_BUFFER_USUAL_SIZE];
- THD_PROC_INFO(thd, "updating reference tables");
+ thd_proc_info(thd, "updating reference tables");
/* Does updates for the last n - 1 tables, returns 0 if ok */
int local_error = (table_count) ? do_updates(0) : 0;
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
/* We must invalidate the query cache before binlog writing and
ha_autocommit_... */
--- 1.501/sql/sql_yacc.yy 2007-01-27 22:49:39 -05:00
+++ 1.502/sql/sql_yacc.yy 2007-01-27 22:49:39 -05:00
@@ -928,7 +928,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
union_opt select_derived_init option_type2
%type <ulong_num>
- ulong_num raid_types merge_insert_types opt_profile_query_arg
+ ulong_num raid_types merge_insert_types
%type <ulonglong_number>
ulonglong_num
@@ -6678,36 +6678,74 @@ profile_defs:
profile_def:
CPU_SYM
- { Lex->profile_options|= PROFILE_CPU; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_CPU;
+#endif
+ }
| MEMORY_SYM
- { Lex->profile_options|= PROFILE_MEMORY; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_MEMORY;
+#endif
+ }
| BLOCK_SYM IO_SYM
- { Lex->profile_options|= PROFILE_BLOCK_IO; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_BLOCK_IO;
+#endif
+ }
| CONTEXT_SYM SWITCHES_SYM
- { Lex->profile_options|= PROFILE_CONTEXT; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_CONTEXT;
+#endif
+ }
| PAGE_SYM FAULTS_SYM
- { Lex->profile_options|= PROFILE_PAGE_FAULTS; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_PAGE_FAULTS;
+#endif
+ }
| IPC_SYM
- { Lex->profile_options|= PROFILE_IPC; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_IPC;
+#endif
+ }
| SWAPS_SYM
- { Lex->profile_options|= PROFILE_SWAPS; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_SWAPS;
+#endif
+ }
| SOURCE_SYM
- { Lex->profile_options|= PROFILE_SOURCE; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_SOURCE;
+#endif
+ }
| ALL
- { Lex->profile_options|= PROFILE_ALL; }
- ;
-
-opt_profile_query_arg:
- /* empty */
- { $$= 0; }
- | QUERY_SYM NUM
- { $$= atoi($2.str); }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_options|= PROFILE_ALL;
+#endif
+ }
;
opt_profile_args:
/* empty */
- | FOR_SYM opt_profile_query_arg
- { Lex->profile_query_id = $2; }
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_query_id= 0;
+#endif
+ }
+ | FOR_SYM QUERY_SYM ulong_num
+ {
+#ifdef ENABLE_PROFILING
+ Lex->profile_query_id= $3;
+#endif
+ }
;
/* Show things */
--- 1.102/sql/sql_view.cc 2007-01-27 22:49:39 -05:00
+++ 1.103/sql/sql_view.cc 2007-01-27 22:49:39 -05:00
@@ -588,7 +588,7 @@ bool mysql_create_view(THD *thd, TABLE_L
DBUG_RETURN(0);
err:
- THD_PROC_INFO(thd, "end");
+ thd_proc_info(thd, "end");
lex->link_first_table_back(view, link_to_local);
unit->cleanup();
DBUG_RETURN(res || thd->net.report_error);
--- 1.80/sql/ha_archive.cc 2007-01-27 22:49:39 -05:00
+++ 1.81/sql/ha_archive.cc 2007-01-27 22:49:39 -05:00
@@ -1205,7 +1205,7 @@ int ha_archive::check(THD* thd, HA_CHECK
ha_rows count= share->rows_recorded;
DBUG_ENTER("ha_archive::check");
- THD_PROC_INFO(thd, "Checking table");
+ thd_proc_info(thd, "Checking table");
/* Flush any waiting data */
gzflush(share->archive_write, Z_SYNC_FLUSH);
@@ -1229,7 +1229,7 @@ int ha_archive::check(THD* thd, HA_CHECK
my_free((char*)buf, MYF(0));
- THD_PROC_INFO(thd, old_proc_info);
+ thd_proc_info(thd, old_proc_info);
if ((rc && rc != HA_ERR_END_OF_FILE) || count)
{
--- 1.20/ndb/src/ndbapi/DictCache.cpp 2007-01-27 22:49:39 -05:00
+++ 1.21/ndb/src/ndbapi/DictCache.cpp 2007-01-27 22:49:39 -05:00
@@ -284,7 +284,7 @@ GlobalDictCache::drop(NdbTableImpl * tab
ver.m_refCount--;
ver.m_status = DROPPED;
if(ver.m_refCount == 0){
- DBUG_PRINT("info", ("refCount is zero, deleting m_impl"))
+ DBUG_PRINT("info", ("refCount is zero, deleting m_impl"));
delete ver.m_impl;
vers->erase(i);
}
--- 1.292/sql/ha_ndbcluster.cc 2007-01-27 22:49:39 -05:00
+++ 1.293/sql/ha_ndbcluster.cc 2007-01-27 22:49:39 -05:00
@@ -5821,14 +5821,14 @@ ha_ndbcluster::register_query_cache_tabl
if (!is_autocommit)
{
- DBUG_PRINT("exit", ("Can't register table during transaction"))
+ DBUG_PRINT("exit", ("Can't register table during transaction"));
DBUG_RETURN(FALSE);
}
if (ndb_get_commitcount(thd, m_dbname, m_tabname, &commit_count))
{
*engine_data= 0;
- DBUG_PRINT("exit", ("Error, could not get commitcount"))
+ DBUG_PRINT("exit", ("Error, could not get commitcount"));
DBUG_RETURN(FALSE);
}
*engine_data= commit_count;
--- 1.175/sql/set_var.cc 2007-01-27 22:49:39 -05:00
+++ 1.176/sql/set_var.cc 2007-01-27 22:49:39 -05:00
@@ -545,6 +545,12 @@ static sys_var_thd_bit sys_unique_checks
set_option_bit,
OPTION_RELAXED_UNIQUE_CHECKS,
1);
+#ifdef ENABLED_PROFILING
+static sys_var_thd_bit sys_profiling("profiling", NULL, set_option_bit,
+ ulonglong(OPTION_PROFILING));
+sys_var_long_ptr sys_profiling_history_size("profiling_history_size",
+ &profiling_history_size);
+#endif
/* Local state variables */
@@ -696,6 +702,10 @@ sys_var *sys_variables[]=
&sys_optimizer_prune_level,
&sys_optimizer_search_depth,
&sys_preload_buff_size,
+#ifdef ENABLED_PROFILING
+ &sys_profiling,
+ &sys_profiling_history_size,
+#endif
&sys_pseudo_thread_id,
&sys_query_alloc_block_size,
&sys_query_cache_size,
@@ -1003,6 +1013,10 @@ struct show_var_st init_vars[]= {
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
{"port", (char*) &mysqld_port, SHOW_INT},
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
+#ifdef ENABLED_PROFILING
+ {sys_profiling.name, (char*) &sys_profiling, SHOW_SYS},
+ {sys_profiling_history_size.name, (char*) &sys_profiling_history_size, SHOW_SYS},
+#endif
{"protocol_version", (char*) &protocol_version, SHOW_INT},
{sys_query_alloc_block_size.name, (char*) &sys_query_alloc_block_size,
SHOW_SYS},
--- 1.80/sql/set_var.h 2007-01-27 22:49:39 -05:00
+++ 1.81/sql/set_var.h 2007-01-27 22:49:39 -05:00
@@ -457,11 +457,11 @@ class sys_var_thd_bit :public sys_var_th
sys_check_func check_func;
sys_update_func update_func;
public:
- ulong bit_flag;
+ ulonglong bit_flag;
bool reverse;
sys_var_thd_bit(const char *name_arg,
sys_check_func c_func, sys_update_func u_func,
- ulong bit, bool reverse_arg=0)
+ ulonglong bit, bool reverse_arg=0)
:sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
bit_flag(bit), reverse(reverse_arg)
{}
--- 1.229/sql/sp_head.cc 2007-01-27 22:49:39 -05:00
+++ 1.230/sql/sp_head.cc 2007-01-27 22:49:39 -05:00
@@ -2387,9 +2387,9 @@ sp_lex_keeper::reset_lex_and_exec_core(T
m_lex->unit.cleanup();
- THD_PROC_INFO(thd, "closing tables");
+ thd_proc_info(thd, "closing tables");
close_thread_tables(thd);
- THD_PROC_INFO(thd, 0);
+ thd_proc_info(thd, 0);
if (m_lex->query_tables_own_last)
{
--- 1.64/sql/repl_failsafe.cc 2007-01-27 22:49:39 -05:00
+++ 1.65/sql/repl_failsafe.cc 2007-01-27 22:49:39 -05:00
@@ -91,7 +91,7 @@ static int init_failsafe_rpl_thread(THD*
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
- THD_PROC_INFO(thd, "Thread initialized");
+ thd_proc_info(thd, "Thread initialized");
thd->version=refresh_version;
thd->set_time();
DBUG_RETURN(0);
@@ -597,7 +597,7 @@ pthread_handler_t handle_failsafe_rpl(vo
{
bool break_req_chain = 0;
pthread_cond_wait(&COND_rpl_status, &LOCK_rpl_status);
- THD_PROC_INFO(thd, "Processing request");
+ thd_proc_info(thd, "Processing request");
while (!break_req_chain)
{
switch (rpl_status) {
@@ -941,7 +941,7 @@ bool load_master_data(THD* thd)
goto err;
}
}
- THD_PROC_INFO(thd, "purging old relay logs");
+ thd_proc_info(thd, "purging old relay logs");
if (purge_relay_logs(&active_mi->rli,thd,
0 /* not only reset, but also reinit */,
&errmsg))
--- 1.156/sql/sql_repl.cc 2007-01-27 22:49:39 -05:00
+++ 1.157/sql/sql_repl.cc 2007-01-27 22:49:39 -05:00
@@ -1196,7 +1196,7 @@ bool change_master(THD* thd, MASTER_INFO
if (need_relay_log_purge)
{
relay_log_purge= 1;
- THD_PROC_INFO(thd, "Purging old relay logs");
+ thd_proc_info(thd, "Purging old relay logs");
if (purge_relay_logs(&mi->rli, thd,
0 /* not only reset, but also reinit */,
&errmsg))
| Thread |
|---|
| • bk commit into 5.0 tree (cmiller:1.2383) | Chad MILLER | 28 Jan |