summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2010-06-06 13:19:29 +0200
committerJon Olav Hauglid <jon.hauglid@sun.com>2010-06-06 13:19:29 +0200
commit142a162c665704ce5b4d5b671d05a068661c088a (patch)
treedef1ebab09889a8f09a9fcd074c8a672689376af /sql/sql_test.cc
parentcbf4019a1b3ec82bdcd9a65db114908a920fb01c (diff)
parent60a9d9bbb94ac03159bcc2d75b649abb1c9dc956 (diff)
downloadmariadb-git-142a162c665704ce5b4d5b671d05a068661c088a.tar.gz
manual merge from mysql-trunk-bugfixing
Conflicts: Text conflict in mysql-test/r/archive.result Contents conflict in mysql-test/r/innodb_bug38231.result Text conflict in mysql-test/r/mdl_sync.result Text conflict in mysql-test/suite/binlog/t/disabled.def Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result Text conflict in mysql-test/t/archive.test Contents conflict in mysql-test/t/innodb_bug38231.test Text conflict in mysql-test/t/mdl_sync.test Text conflict in sql/sp_head.cc Text conflict in sql/sql_show.cc Text conflict in sql/table.cc Text conflict in sql/table.h
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 2f3ed0030cd..48fd5f9dff8 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -75,7 +75,7 @@ print_where(COND *cond,const char *info, enum_query_type query_type)
/* This is for debugging purposes */
-void print_cached_tables(void)
+static void print_cached_tables(void)
{
uint idx,count,unused;
TABLE_SHARE *share;
@@ -340,6 +340,11 @@ print_plan(JOIN* join, uint idx, double record_count, double read_time,
#endif
+C_MODE_START
+static int dl_compare(const void *p1, const void *p2);
+static int print_key_cache_status(const char *name, KEY_CACHE *key_cache);
+C_MODE_END
+
typedef struct st_debug_lock
{
ulong thread_id;
@@ -349,8 +354,13 @@ typedef struct st_debug_lock
enum thr_lock_type type;
} TABLE_LOCK_INFO;
-static int dl_compare(TABLE_LOCK_INFO *a,TABLE_LOCK_INFO *b)
+static int dl_compare(const void *p1, const void *p2)
{
+ TABLE_LOCK_INFO *a, *b;
+
+ a= (TABLE_LOCK_INFO *) p1;
+ b= (TABLE_LOCK_INFO *) p2;
+
if (a->thread_id > b->thread_id)
return 1;
if (a->thread_id < b->thread_id)
@@ -400,9 +410,10 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data,
function so that we can easily add this if we ever need this.
*/
-static void display_table_locks(void)
+static void display_table_locks(void)
{
LIST *list;
+ void *saved_base;
DYNAMIC_ARRAY saved_table_locks;
(void) my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO), table_cache_count + 20,50);
@@ -423,13 +434,17 @@ static void display_table_locks(void)
mysql_mutex_unlock(&lock->mutex);
}
mysql_mutex_unlock(&THR_LOCK_lock);
- if (!saved_table_locks.elements) goto end;
-
- qsort((uchar*) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
+
+ if (!saved_table_locks.elements)
+ goto end;
+
+ saved_base= dynamic_element(&saved_table_locks, 0, TABLE_LOCK_INFO *);
+ my_qsort(saved_base, saved_table_locks.elements, sizeof(TABLE_LOCK_INFO),
+ dl_compare);
freeze_size(&saved_table_locks);
puts("\nThread database.table_name Locked/Waiting Lock_type\n");
-
+
unsigned int i;
for (i=0 ; i < saved_table_locks.elements ; i++)
{