Commit f8ce7bc0 authored by jimw@mysql.com's avatar jimw@mysql.com

Merge mysql.com:/home/jimw/my/mysql-4.1-clean

into  mysql.com:/home/jimw/my/mysql-5.0-clean
parents a42b3730 e21566e9
......@@ -1872,9 +1872,13 @@ com_help(String *buffer __attribute__((unused)),
if (help_arg)
return com_server_help(buffer,line,help_arg+1);
put_info("\nFor the complete MySQL Manual online, visit:\n http://www.mysql.com/documentation\n", INFO_INFO);
put_info("For info on technical support from MySQL developers, visit:\n http://www.mysql.com/support\n", INFO_INFO);
put_info("For info on MySQL books, utilities, consultants, etc., visit:\n http://www.mysql.com/portal\n", INFO_INFO);
put_info("\nFor information about MySQL products and services, visit:\n"
" http://www.mysql.com/\n"
"For developer information, including the MySQL Reference Manual, "
"visit:\n"
" http://dev.mysql.com/\n"
"To buy MySQL Network Support, training, or other products, visit:\n"
" https://shop.mysql.com/\n", INFO_INFO);
put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
......
......@@ -1587,6 +1587,19 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG"
fi
# If the user specified CFLAGS, we won't add any optimizations
if test -n "$SAVE_CFLAGS"
then
OPTIMIZE_CFLAGS=""
DEBUG_OPTIMIZE_CC=""
fi
# Ditto for CXXFLAGS
if test -n "$SAVE_CXXFLAGS"
then
OPTIMIZE_CXXFLAGS=""
DEBUG_OPTIMIZE_CXX=""
fi
AC_ARG_WITH(debug,
[ --without-debug Build a production version without debugging code],
[with_debug=$withval],
......
......@@ -87,12 +87,13 @@ insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
show binlog events from 98;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 98 Query 1 # use `test`; BEGIN
master-bin.000001 166 Query 1 # use `test`; insert into t1 values(8)
master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
master-bin.000001 347 Query 1 # use `test`; ROLLBACK
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; BEGIN
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(8)
master-bin.000001 178 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.000001 244 Query 1 244 use `test`; ROLLBACK
master-bin.000001 287 Query 1 287 use `test`; DO RELEASE_LOCK("a")
delete from t1;
delete from t2;
reset master;
......@@ -205,3 +206,53 @@ select (@after-@before) >= 2;
(@after-@before) >= 2
1
drop table t1,t2;
commit;
begin;
create temporary table ti (a int) engine=innodb;
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
insert into ti values(1);
set autocommit=0;
create temporary table t1 (a int) engine=myisam;
commit;
insert t1 values (1);
rollback;
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
insert into t0 select GET_LOCK("lock1",null);
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
select get_lock("lock1",60);
get_lock("lock1",60)
1
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; BEGIN
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
master-bin.000001 239 Query 1 239 use `test`; COMMIT
master-bin.000001 280 Query 1 280 use `test`; delete from t1
master-bin.000001 329 Query 1 329 use `test`; delete from t2
master-bin.000001 378 Query 1 378 use `test`; alter table t2 type=MyISAM
master-bin.000001 439 Query 1 439 use `test`; insert into t1 values (1)
master-bin.000001 499 Query 1 499 use `test`; insert into t2 values (20)
master-bin.000001 560 Query 1 560 use `test`; drop table t1,t2
master-bin.000001 611 Query 1 611 use `test`; BEGIN
master-bin.000001 651 Query 1 611 use `test`; create temporary table ti (a int) engine=innodb
master-bin.000001 733 Query 1 733 use `test`; ROLLBACK
master-bin.000001 776 Query 1 776 use `test`; insert into ti values(1)
master-bin.000001 835 Query 1 835 use `test`; BEGIN
master-bin.000001 875 Query 1 835 use `test`; create temporary table t1 (a int) engine=myisam
master-bin.000001 957 Query 1 957 use `test`; COMMIT
master-bin.000001 998 Query 1 998 use `test`; create table t0 (n int)
master-bin.000001 1056 Query 1 1056 use `test`; insert t0 select * from t1
master-bin.000001 1117 Query 1 1117 use `test`; DO RELEASE_LOCK("a")
master-bin.000001 1172 Query 1 1172 use `test`; insert into t0 select GET_LOCK("lock1",null)
master-bin.000001 1251 Query 1 1251 use `test`; create table t2 (n int) engine=innodb
master-bin.000001 1323 Query 1 1323 use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
master-bin.000001 1424 Query 1 1424 use `test`; DO RELEASE_LOCK("lock1")
do release_lock("lock1");
drop table t0,t2;
......@@ -227,7 +227,35 @@ select (@after:=unix_timestamp())*0; # always give repeatable output
# the bug, the reap would return immediately after the insert into t2.
select (@after-@before) >= 2;
# cleanup
drop table t1,t2;
commit;
# test for BUG#7947 - DO RELEASE_LOCK() not written to binlog on rollback in the middle
# of a transaction
connection con2;
begin;
create temporary table ti (a int) engine=innodb;
rollback;
insert into ti values(1);
set autocommit=0;
create temporary table t1 (a int) engine=myisam;
commit;
insert t1 values (1);
rollback;
create table t0 (n int);
insert t0 select * from t1;
set autocommit=1;
insert into t0 select GET_LOCK("lock1",null);
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
disconnect con2;
connection con3;
select get_lock("lock1",60);
show binlog events from 79;
do release_lock("lock1");
drop table t0,t2;
# End of 4.1 tests
......@@ -26,24 +26,33 @@ use HTML::Template;
# BUGS
# ----
# - enum/set is 0 byte storage! Woah - efficient!
# - DECIMAL is 0 byte storage. A bit too efficient.
# - some float stores come out weird (when there's a comma e.g. 'float(4,1)')
# - no disk data values
# - computes the storage requirements of views (and probably MERGE)
# - ignores character sets.
my $template = HTML::Template->new(filename => 'ndb_size.tmpl',
die_on_bad_params => 0);
die_on_bad_params => 0)
or die "Could not open ndb_size.tmpl.";
my $dbh;
if(@ARGV < 3 || $ARGV[0] eq '--usage' || $ARGV[0] eq '--help')
{
print STDERR "Usage:\n";
print STDERR "\tndb_size.pl database hostname user password\n\n";
print STDERR "If you need to specify a port number, use host:port\n\n";
exit(1);
}
{
my $database= $ARGV[0];
my $hostname= $ARGV[1];
my $port= $ARGV[2];
my $user= $ARGV[3];
my $password= $ARGV[4];
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
$dbh= DBI->connect($dsn, $user, $password);
my $user= $ARGV[2];
my $password= $ARGV[3];
my $dsn = "DBI:mysql:database=$database;host=$hostname";
$dbh= DBI->connect($dsn, $user, $password) or exit(1);
$template->param(db => $database);
$template->param(dsn => $dsn);
}
......@@ -55,6 +64,14 @@ my $tables = $dbh->selectall_arrayref("show tables");
my @table_size;
my @dbDataMemory;
my @dbIndexMemory;
my @NoOfAttributes;
my @NoOfIndexes;
my @NoOfTables;
$NoOfTables[$_]{val} = @{$tables} foreach 0..$#releases;
sub align {
my($to,@unaligned) = @_;
my @aligned;
......@@ -68,9 +85,8 @@ foreach(@{$tables})
{
my $table= @{$_}[0];
my @columns;
my $info= $dbh->selectall_hashref("describe ".$dbh->quote($table),"Field");
my @count = $dbh->selectrow_array("select count(*) from "
.$dbh->quote($table));
my $info= $dbh->selectall_hashref('describe `'.$table.'`',"Field");
my @count = $dbh->selectrow_array('select count(*) from `'.$table.'`');
my %columnsize; # used for index calculations
# We now work out the DataMemory usage
......@@ -132,14 +148,17 @@ foreach(@{$tables})
my $fixed= 1+$size;
my @dynamic=$dbh->selectrow_array("select avg(length("
.$dbh->quote($name)
.")) from ".$dbh->quote($table));
.")) from `".$table.'`');
$dynamic[0]=0 if !$dynamic[0];
@realsize= ($fixed,$fixed,ceil($dynamic[0]));
}
elsif($type =~ /binary/ || $type =~ /char/)
{@realsize=($size,$size,$size)}
elsif($type =~ /text/ || $type =~ /blob/)
{@realsize=(256,256,1)} # FIXME check if 5.1 is correct
{
@realsize=(256,256,1);
$NoOfTables[$_]{val} += 1 foreach 0..$#releases; # blob uses table
} # FIXME check if 5.1 is correct
@realsize= align(4,@realsize);
......@@ -166,7 +185,7 @@ foreach(@{$tables})
# we can still connect to pre-5.0 mysqlds.
my %indexes;
{
my $sth= $dbh->prepare("show index from "$dbh->quote($table));
my $sth= $dbh->prepare("show index from `".$table.'`');
$sth->execute;
while(my $i = $sth->fetchrow_hashref)
{
......@@ -257,7 +276,51 @@ foreach(@{$tables})
IndexMemory=>\@IndexMemory,
};
$dbDataMemory[$_]{val} += $DataMemory[$_]{val} foreach 0..$#releases;
$dbIndexMemory[$_]{val} += $IndexMemory[$_]{val} foreach 0..$#releases;
$NoOfAttributes[$_]{val} += @columns foreach 0..$#releases;
$NoOfIndexes[$_]{val} += @indexes foreach 0..$#releases;
}
my @NoOfTriggers;
# for unique hash indexes
$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val}*3 foreach 0..$#releases;
# for ordered index
$NoOfTriggers[$_]{val} += $NoOfIndexes[$_]{val} foreach 0..$#releases;
my @ParamMemory;
foreach (0..$#releases) {
$ParamMemory[0]{releases}[$_]{val}= POSIX::ceil(200*$NoOfAttributes[$_]{val}/1024);
$ParamMemory[0]{name}= 'Attributes';
$ParamMemory[1]{releases}[$_]{val}= 20*$NoOfTables[$_]{val};
$ParamMemory[1]{name}= 'Tables';
$ParamMemory[2]{releases}[$_]{val}= 10*$NoOfIndexes[$_]{val};
$ParamMemory[2]{name}= 'OrderedIndexes';
$ParamMemory[3]{releases}[$_]{val}= 15*$NoOfIndexes[$_]{val};
$ParamMemory[3]{name}= 'UniqueHashIndexes';
}
$template->param(tables => \@table_size);
$template->param(Parameters => [{name=>'DataMemory (kb)',
releases=>\@dbDataMemory},
{name=>'IndexMemory (kb)',
releases=>\@dbIndexMemory},
{name=>'MaxNoOfTables',
releases=>\@NoOfTables},
{name=>'MaxNoOfAttributes',
releases=>\@NoOfAttributes},
{name=>'MaxNoOfOrderedIndexes',
releases=>\@NoOfIndexes},
{name=>'MaxNoOfUniqueHashIndexes',
releases=>\@NoOfIndexes},
{name=>'MaxNoOfTriggers',
releases=>\@NoOfTriggers}
]
);
$template->param(ParamMemory => \@ParamMemory);
print $template->output;
......@@ -13,18 +13,58 @@ td,th { border: 1px solid black }
<h1>MySQL Cluster analysis for <TMPL_VAR NAME="db" escape="html"></h1>
<p>This is an automated analysis of the <TMPL_VAR NAME="DSN" escape="html"> database for migration into <a href="http://www.mysql.com/">MySQL</a> Cluster. No warranty is made to the accuracy of the information.</p>
<p>This information should be valid for MySQL 4.1</p>
<p>This information should be valid for MySQL 4.1 and 5.0. Since 5.1 is not a final release yet, the numbers should be used as a guide only.</p>
<h2>Parameter Settings</h2>
<p><b>NOTE</b> the configuration parameters below do not take into account system tables and other requirements.</p>
<table>
<tr>
<th>Parameter</th>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel></th>
</TMPL_LOOP>
</tr>
<TMPL_LOOP NAME=Parameters>
<tr>
<td><TMPL_VAR NAME=name></td>
<TMPL_LOOP NAME=releases>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>
<h2>Memory usage because of parameters</h2>
<p>Usage is in kilobytes. Actual usage will vary as you should set the parameters larger than those listed in the table above.</p>
<table>
<tr>
<th>Parameter</th>
<TMPL_LOOP NAME=releases>
<th><TMPL_VAR NAME=rel></th>
</TMPL_LOOP>
</tr>
<TMPL_LOOP NAME=ParamMemory>
<tr>
<td><TMPL_VAR NAME=name></td>
<TMPL_LOOP NAME=releases>
<td><TMPL_VAR NAME=val></td>
</TMPL_LOOP>
</tr>
</TMPL_LOOP>
</table>
<h2>Table List</h2>
<ul>
<TMPL_LOOP NAME="tables">
<li><TMPL_VAR NAME="table"></li>
<li><a href="#<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></li>
</TMPL_LOOP>
</ul>
<hr/>
<TMPL_LOOP NAME="tables">
<h2><TMPL_VAR NAME="table"></h2>
<h2><a name="<TMPL_VAR NAME="table">"><TMPL_VAR NAME="table"></a></h2>
<table>
<tr>
<th>Column</th>
......
......@@ -1426,7 +1426,7 @@ static bool show_status_array(THD *thd, const char *wild,
case SHOW_SLAVE_RUNNING:
{
pthread_mutex_lock(&LOCK_active_mi);
end= strmov(buff, (active_mi->slave_running &&
end= strmov(buff, (active_mi && active_mi->slave_running &&
active_mi->rli.slave_running) ? "ON" : "OFF");
pthread_mutex_unlock(&LOCK_active_mi);
break;
......@@ -1437,12 +1437,15 @@ static bool show_status_array(THD *thd, const char *wild,
TODO: in 5.1 with multimaster, have one such counter per line in
SHOW SLAVE STATUS, and have the sum over all lines here.
*/
pthread_mutex_lock(&LOCK_active_mi);
pthread_mutex_lock(&active_mi->rli.data_lock);
end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
pthread_mutex_unlock(&active_mi->rli.data_lock);
pthread_mutex_unlock(&LOCK_active_mi);
break;
pthread_mutex_lock(&LOCK_active_mi);
if (active_mi)
{
pthread_mutex_lock(&active_mi->rli.data_lock);
end= int10_to_str(active_mi->rli.retried_trans, buff, 10);
pthread_mutex_unlock(&active_mi->rli.data_lock);
}
pthread_mutex_unlock(&LOCK_active_mi);
break;
}
case SHOW_SLAVE_SKIP_ERRORS:
{
......
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