Commit 87be629e authored by unknown's avatar unknown

Merge trift2.:/MySQL/M50/mysql-5.0

into  trift2.:/MySQL/M50/push-5.0

parents 7a9892cc 3685d889
...@@ -649,7 +649,7 @@ buf_pool_init( ...@@ -649,7 +649,7 @@ buf_pool_init(
} }
} }
buf_pool->page_hash = hash0_create(2 * max_size); buf_pool->page_hash = hash_create(2 * max_size);
buf_pool->n_pend_reads = 0; buf_pool->n_pend_reads = 0;
......
...@@ -708,13 +708,13 @@ dict_init(void) ...@@ -708,13 +708,13 @@ dict_init(void)
mutex_create(&(dict_sys->mutex)); mutex_create(&(dict_sys->mutex));
mutex_set_level(&(dict_sys->mutex), SYNC_DICT); mutex_set_level(&(dict_sys->mutex), SYNC_DICT);
dict_sys->table_hash = hash0_create(buf_pool_get_max_size() / dict_sys->table_hash = hash_create(buf_pool_get_max_size() /
(DICT_POOL_PER_TABLE_HASH * (DICT_POOL_PER_TABLE_HASH *
UNIV_WORD_SIZE)); UNIV_WORD_SIZE));
dict_sys->table_id_hash = hash0_create(buf_pool_get_max_size() / dict_sys->table_id_hash = hash_create(buf_pool_get_max_size() /
(DICT_POOL_PER_TABLE_HASH * (DICT_POOL_PER_TABLE_HASH *
UNIV_WORD_SIZE)); UNIV_WORD_SIZE));
dict_sys->col_hash = hash0_create(buf_pool_get_max_size() / dict_sys->col_hash = hash_create(buf_pool_get_max_size() /
(DICT_POOL_PER_COL_HASH * (DICT_POOL_PER_COL_HASH *
UNIV_WORD_SIZE)); UNIV_WORD_SIZE));
dict_sys->size = 0; dict_sys->size = 0;
......
...@@ -1294,8 +1294,8 @@ fil_system_create( ...@@ -1294,8 +1294,8 @@ fil_system_create(
mutex_set_level(&(system->mutex), SYNC_ANY_LATCH); mutex_set_level(&(system->mutex), SYNC_ANY_LATCH);
system->spaces = hash0_create(hash_size); system->spaces = hash_create(hash_size);
system->name_hash = hash0_create(hash_size); system->name_hash = hash_create(hash_size);
UT_LIST_INIT(system->LRU); UT_LIST_INIT(system->LRU);
......
...@@ -32,7 +32,7 @@ ha_create( ...@@ -32,7 +32,7 @@ ha_create(
hash_table_t* table; hash_table_t* table;
ulint i; ulint i;
table = hash0_create(n); table = hash_create(n);
if (in_btr_search) { if (in_btr_search) {
table->adaptive = TRUE; table->adaptive = TRUE;
......
...@@ -74,7 +74,7 @@ Creates a hash table with >= n array cells. The actual number of cells is ...@@ -74,7 +74,7 @@ Creates a hash table with >= n array cells. The actual number of cells is
chosen to be a prime number slightly bigger than n. */ chosen to be a prime number slightly bigger than n. */
hash_table_t* hash_table_t*
hash0_create( hash_create(
/*========*/ /*========*/
/* out, own: created table */ /* out, own: created table */
ulint n) /* in: number of array cells */ ulint n) /* in: number of array cells */
......
...@@ -18,12 +18,15 @@ typedef struct hash_cell_struct hash_cell_t; ...@@ -18,12 +18,15 @@ typedef struct hash_cell_struct hash_cell_t;
typedef void* hash_node_t; typedef void* hash_node_t;
/* Fix Bug #13859: symbol collision between imap/mysql */
#define hash_create hash0_create
/***************************************************************** /*****************************************************************
Creates a hash table with >= n array cells. The actual number Creates a hash table with >= n array cells. The actual number
of cells is chosen to be a prime number slightly bigger than n. */ of cells is chosen to be a prime number slightly bigger than n. */
hash_table_t* hash_table_t*
hash0_create( hash_create(
/*========*/ /*========*/
/* out, own: created table */ /* out, own: created table */
ulint n); /* in: number of array cells */ ulint n); /* in: number of array cells */
......
...@@ -584,7 +584,7 @@ lock_sys_create( ...@@ -584,7 +584,7 @@ lock_sys_create(
{ {
lock_sys = mem_alloc(sizeof(lock_sys_t)); lock_sys = mem_alloc(sizeof(lock_sys_t));
lock_sys->rec_hash = hash0_create(n_cells); lock_sys->rec_hash = hash_create(n_cells);
/* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */ /* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */
......
...@@ -148,7 +148,7 @@ recv_sys_init( ...@@ -148,7 +148,7 @@ recv_sys_init(
recv_sys->len = 0; recv_sys->len = 0;
recv_sys->recovered_offset = 0; recv_sys->recovered_offset = 0;
recv_sys->addr_hash = hash0_create(available_memory / 64); recv_sys->addr_hash = hash_create(available_memory / 64);
recv_sys->n_addrs = 0; recv_sys->n_addrs = 0;
recv_sys->apply_log_recs = FALSE; recv_sys->apply_log_recs = FALSE;
...@@ -187,7 +187,7 @@ recv_sys_empty_hash(void) ...@@ -187,7 +187,7 @@ recv_sys_empty_hash(void)
hash_table_free(recv_sys->addr_hash); hash_table_free(recv_sys->addr_hash);
mem_heap_empty(recv_sys->heap); mem_heap_empty(recv_sys->heap);
recv_sys->addr_hash = hash0_create(buf_pool_get_curr_size() / 256); recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
} }
/************************************************************ /************************************************************
......
...@@ -224,7 +224,7 @@ thr_local_init(void) ...@@ -224,7 +224,7 @@ thr_local_init(void)
ut_a(thr_local_hash == NULL); ut_a(thr_local_hash == NULL);
thr_local_hash = hash0_create(OS_THREAD_MAX_N + 100); thr_local_hash = hash_create(OS_THREAD_MAX_N + 100);
mutex_create(&thr_local_mutex); mutex_create(&thr_local_mutex);
mutex_set_level(&thr_local_mutex, SYNC_THR_LOCAL); mutex_set_level(&thr_local_mutex, SYNC_THR_LOCAL);
......
...@@ -21,9 +21,6 @@ use DBI; ...@@ -21,9 +21,6 @@ use DBI;
use Getopt::Long; use Getopt::Long;
$Getopt::Long::ignorecase=0; $Getopt::Long::ignorecase=0;
print "explain_log provided by http://www.mobile.de\n";
print "=========== ================================\n";
my $Param={}; my $Param={};
$Param->{host}=''; $Param->{host}='';
...@@ -32,16 +29,28 @@ $Param->{password}=''; ...@@ -32,16 +29,28 @@ $Param->{password}='';
$Param->{PrintError}=0; $Param->{PrintError}=0;
$Param->{socket}=''; $Param->{socket}='';
if (!GetOptions ('date|d:i' => \$Param->{ViewDate}, my $help;
if (!GetOptions (
'date|d:i' => \$Param->{ViewDate},
'host|h:s' => \$Param->{host}, 'host|h:s' => \$Param->{host},
'user|u:s' => \$Param->{user}, 'user|u:s' => \$Param->{user},
'password|p:s' => \$Param->{password}, 'password|p:s' => \$Param->{password},
'printerror|e:s' => \$Param->{PrintError}, 'printerror|e:s' => \$Param->{PrintError},
'socket|s:s' => \$Param->{socket}, 'socket|s:s' => \$Param->{socket},
'help|h' => \$help,
)) { )) {
ShowOptions(); ShowOptions();
exit(0);
} }
else { if (defined ($help)) {
ShowOptions();
exit(0);
}
print "explain_log provided by http://www.mobile.de\n";
print "=========== ================================\n";
$Param->{UpdateCount} = 0; $Param->{UpdateCount} = 0;
$Param->{SelectCount} = 0; $Param->{SelectCount} = 0;
$Param->{IdxUseCount} = 0; $Param->{IdxUseCount} = 0;
...@@ -245,7 +254,6 @@ else { ...@@ -245,7 +254,6 @@ else {
print "Finished: \t".localtime(time)."\n"; print "Finished: \t".localtime(time)."\n";
} }
}
########################################################################### ###########################################################################
...@@ -323,21 +331,26 @@ sub ShowOptions { ...@@ -323,21 +331,26 @@ sub ShowOptions {
print <<EOF; print <<EOF;
Usage: $0 [OPTIONS] < LOGFILE Usage: $0 [OPTIONS] < LOGFILE
--date=YYMMDD select only entrys of date --help, -h
-d=YYMMDD Display this help message
--host=HOSTNAME db-host to ask --date=YYMMDD, -d=YYMMDD
-h=HOSTNAME Select entries from the log only for the given date
--user=USERNAME db-user --host=HOSTNAME, -h=HOSTNAME
-u=USERNAME Connect to the MySQL server on the given host
--password=PASSWORD password of db-user --user=USERNAME, -u=USERNAME
-p=PASSWORD The MySQL username to use when connecting to the server
--socket=SOCKET mysqld socket file to connect --password=PASSWORD, -p=PASSWORD
-s=SOCKET The password to use when connecting to the server
--printerror=1 enable error output --socket=SOCKET, -s=SOCKET
-e 1 The socket file to use when connecting to the server
--printerror=1, -e 1
Read logfile from STDIN an try to EXPLAIN all SELECT statements. All UPDATE statements are rewritten to an EXPLAIN SELECT statement. The results of the EXPLAIN statement are collected and counted. All results with type=ALL are collected in an separete list. Results are printed to STDOUT. Enable error output
mysql_explain_log reads its standard input for query log contents. It
uses EXPLAIN to analyze SELECT statements found in the input. UPDATE
statements are rewritten to SELECT statements and also analyzed with
EXPLAIN. mysql_explain_log then displays a summary of its results.
Results are printed to the standard output.
EOF EOF
} }
...@@ -351,46 +364,37 @@ __END__ ...@@ -351,46 +364,37 @@ __END__
mysql_explain_log mysql_explain_log
Feed a mysqld general logfile (created with mysqld --log) back into mysql Feed a mysqld general query logfile (created with mysqld --log) back
and collect statistics about index usage with EXPLAIN. into mysql and collect statistics about index usage with EXPLAIN.
=head1 DISCUSSION =head1 DISCUSSION
To optimize your indices, you have to know which ones are actually To optimize your indexes, you must know which ones are actually used
used and what kind of queries are causing table scans. Especially and what kind of queries are causing table scans. This may not be easy,
if you are generating your queries dynamically and you have a huge especially if you are generating your queries dynamically and you have
amount of queries going on, this isn't easy. a huge number of queries being executed.
Use this tool to take a look at the effects of your real life queries. Use this tool to take a look at the effects of your real life queries.
Then add indices to avoid table scans and remove those which aren't used. Then add indexes to avoid table scans and remove indexes that aren't used.
=head1 USAGE =head1 USAGE
mysql_explain_log [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile mysql_explain_log [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] [--printerror=1] < logfile
--date=YYMMDD select only entrys of date --help, -h
Display this help message
-d=YYMMDD --date=YYMMDD, -d=YYMMDD
Select entries from the log only for the given date
--host=HOSTNAME db-host to ask --host=HOSTNAME, -h=HOSTNAME
Connect to the MySQL server on the given host
-h=HOSTNAME --user=USERNAME, -u=USERNAME
The MySQL username to use when connecting to the server
--user=USERNAME db-user --password=PASSWORD, -p=PASSWORD
The password to use when connecting to the server
-u=USERNAME --socket=SOCKET, -s=SOCKET
The socket file to use when connecting to the server
--password=PASSWORD password of db-user --printerror=1, -e 1
Enable error output
-p=PASSWORD
--socket=SOCKET change path to the socket
-s=SOCKET
--printerror=1 enable error output
-e 1
=head1 EXAMPLE =head1 EXAMPLE
......
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