Commit e6c45f5e authored by Michael Widenius's avatar Michael Widenius

- Reduced memory requirements for mysqltest to 1/4.th This also gave a...

- Reduced memory requirements for mysqltest to 1/4.th  This also gave a speedup for 5x for some tests.
- Reduced memory usage from safe_mutex.
- Fixed problem with failing tests that could not restart mysqld becasue the port was reserved
- More DBUG information
- Fixed bug where bitmap_set_prefix() wrote over buffer area.
- Initialize n_pages_flushed in xtradb which was used uninitialized.

client/mysqltest.cc:
  Reduced memory usage (400K -> 80 for simple test;  400M -> 70M for some other tests)
  - Smaller dynamic arrays at start
  - Made 'st_connection' significantly smaller by allocation 'mysql' on demand in mysql_init() and storing require_file in a mem_root.
  - Fixed that when one does --debug we get information from safemalloc in the trace
  (Most of changes are changing &connect->mysql to connect->mysql
libmysql/libmysql.c:
  Don't call mysql_thread_end() if my_init() was called outside of mysql_server_init()
  This is needed to get information from my_end() into the DBUG log
mysql-test/README:
  Fixed wrong comment
mysql-test/mysql-test-run.pl:
  Reserv 20 ports / mysql-test-run thread.
  (Needed as some tests uses 9 mysqld servers)
mysys/hash.c:
  More DBUG information
mysys/my_bitmap.c:
  Fixed bug where bitmap_set_prefix() wrote over buffer area.
mysys/safemalloc.c:
  More DBUG information
mysys/thr_mutex.c:
  Initialize smaller arrays be default.
sql-common/client.c:
  More DBUG_PRINT
storage/xtradb/srv/srv0srv.c:
  Initialize n_pages_flushed which was used uninitialized.
parent 1c23091c
This diff is collapsed.
......@@ -211,11 +211,19 @@ void STDCALL mysql_server_end()
{
my_end(0);
}
#ifdef NOT_NEEDED
/*
The following is not needed as if the program explicitely called
my_init() then we can assume it will also call my_end().
The reason to not also do it here is in that case we can't get
statistics from my_end() to debug log.
*/
else
{
free_charsets();
mysql_thread_end();
}
#endif
mysql_client_init= org_my_init_done= 0;
#ifdef EMBEDDED_SERVER
......
......@@ -60,7 +60,7 @@ extension. For example:
mysql test < t/test_case_name.test > r/test_case_name.result
mysqltest --record --record-file=r/test_case_name.result < t/test_case_name.test
mysqltest --record --database test --result-file=r/test_case_name.result < t/test_case_name.test
When this is done, take a look at r/test_case_name.result
- If the result is incorrect, you have found a bug. In this case, you should
......
......@@ -1634,16 +1634,16 @@ sub set_build_thread_ports($) {
$ENV{MTR_BUILD_THREAD}= $build_thread;
# Calculate baseport
$baseport= $build_thread * 10 + 10000;
if ( $baseport < 5001 or $baseport + 9 >= 32767 )
$baseport= $build_thread * 20 + 10000;
if ( $baseport < 5001 or $baseport + 19 >= 32767 )
{
mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767",
"($baseport - $baseport + 9)");
"($baseport - $baseport + 19)");
}
mtr_report("Using MTR_BUILD_THREAD $build_thread,",
"with reserved ports $baseport..".($baseport+9));
"with reserved ports $baseport..".($baseport+19));
}
......
......@@ -130,7 +130,8 @@ static inline void my_hash_free_elements(HASH *hash)
void my_hash_free(HASH *hash)
{
DBUG_ENTER("my_hash_free");
DBUG_PRINT("enter",("hash: 0x%lx", (long) hash));
DBUG_PRINT("enter",("hash: 0x%lx elements: %ld",
(long) hash, hash->records));
my_hash_free_elements(hash);
hash->free= 0;
......
......@@ -274,7 +274,10 @@ void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
memset(m, 0xff, prefix_bytes);
m+= prefix_bytes;
if ((prefix_bits= prefix_size & 7))
{
*m++= (1 << prefix_bits)-1;
prefix_bytes++;
}
if ((d= no_bytes_in_map(map)-prefix_bytes))
bzero(m, d);
}
......
......@@ -124,7 +124,8 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
struct st_irem *irem;
uchar *data;
DBUG_ENTER("_mymalloc");
DBUG_PRINT("enter",("Size: %lu", (ulong) size));
DBUG_PRINT("enter",("Size: %lu Total alloc: %lu", (ulong) size,
sf_malloc_cur_memory));
if (!sf_malloc_quick)
(void) _sanity (filename, lineno);
......@@ -316,6 +317,7 @@ void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
sf_malloc_cur_memory-= irem->datasize;
sf_malloc_count--;
pthread_mutex_unlock(&THR_LOCK_malloc);
DBUG_PRINT("info", ("bytes freed: %ld", irem->datasize));
#ifndef HAVE_valgrind
/* Mark this data as free'ed */
......
......@@ -170,16 +170,16 @@ static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp)
pthread_mutex_lock(&THR_LOCK_mutex);
mp->id= ++safe_mutex_id;
pthread_mutex_unlock(&THR_LOCK_mutex);
hash_init(mp->locked_mutex, &my_charset_bin,
1000,
offsetof(safe_mutex_deadlock_t, id),
sizeof(mp->id),
0, 0, HASH_UNIQUE);
hash_init(mp->used_mutex, &my_charset_bin,
1000,
offsetof(safe_mutex_t, id),
sizeof(mp->id),
0, 0, HASH_UNIQUE);
hash_init2(mp->locked_mutex, 64, &my_charset_bin,
128,
offsetof(safe_mutex_deadlock_t, id),
sizeof(mp->id),
0, 0, HASH_UNIQUE);
hash_init2(mp->used_mutex, 64, &my_charset_bin,
128,
offsetof(safe_mutex_t, id),
sizeof(mp->id),
0, 0, HASH_UNIQUE);
return 0;
}
......
......@@ -1590,6 +1590,7 @@ mysql_init(MYSQL *mysql)
*/
mysql->reconnect= 0;
DBUG_PRINT("mysql",("mysql: 0x%lx", (long) mysql));
return mysql;
}
......@@ -2776,6 +2777,8 @@ void mysql_detach_stmt_list(LIST **stmt_list __attribute__((unused)),
void STDCALL mysql_close(MYSQL *mysql)
{
DBUG_ENTER("mysql_close");
DBUG_PRINT("enter", ("mysql: 0x%lx", (long) mysql));
if (mysql) /* Some simple safety */
{
/* If connection is still up, send a QUIT message */
......
......@@ -2742,6 +2742,8 @@ loop:
n_ios_very_old = log_sys->n_log_ios + buf_pool->stat.n_pages_read
+ buf_pool->stat.n_pages_written;
n_pages_flushed= 0;
mutex_enter(&kernel_mutex);
/* Store the user activity counter at the start of this loop */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment