From 15da5308c342259fce0c2fccb6d6c6b1e1772efe Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Tue, 1 Nov 2005 11:48:55 -0800 Subject: [PATCH 1/9] Avoid possible race condition in accessing slave statistics during shutdown. (Bug #11796) --- sql/sql_show.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index d6ceca5f23c..268292022e4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1890,7 +1890,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, 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; @@ -1902,9 +1902,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, 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); + 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; } From 592a4c7cb385e8fa7b6f9355a6c072aa56179b82 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Wed, 2 Nov 2005 18:29:06 -0800 Subject: [PATCH 2/9] Don't add optimization flags to CFLAGS if the user specified their own CFLAGS (ditto for CXXFLAGS). (Bug #12640) --- configure.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure.in b/configure.in index 40a3e8ea5d4..f10c7b7a96e 100644 --- a/configure.in +++ b/configure.in @@ -1672,6 +1672,19 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then OPTIMIZE_CXXFLAGS="$OPTIMIZE_CXXFLAGS -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], From 41752fa9a0d263aa7f26c6bdb588267ea4678b5f Mon Sep 17 00:00:00 2001 From: "sasha@asksasha.com" <> Date: Mon, 7 Nov 2005 15:09:35 -0700 Subject: [PATCH 3/9] fix for BUG#7947 - failure to log DO RELEASE_LOCK() if we disconnect in the middle of transaction while holding the lock. Also test to make sure other binlogging issues reported in the bug have been addressed. --- mysql-test/r/rpl_bug7947.result | 48 +++++++++++++++++++++++++++++++++ mysql-test/t/rpl_bug7947.test | 22 +++++++++++++++ sql/item_func.cc | 2 +- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/rpl_bug7947.result create mode 100644 mysql-test/t/rpl_bug7947.test diff --git a/mysql-test/r/rpl_bug7947.result b/mysql-test/r/rpl_bug7947.result new file mode 100644 index 00000000000..8053f47d7d5 --- /dev/null +++ b/mysql-test/r/rpl_bug7947.result @@ -0,0 +1,48 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +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) type=myisam; +Warnings: +Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead +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",null); +get_lock("lock1",null) +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`; create temporary table ti (a int) engine=innodb +master-bin.000001 201 Query 1 201 use `test`; ROLLBACK +master-bin.000001 244 Query 1 244 use `test`; insert into ti values(1) +master-bin.000001 303 Query 1 303 use `test`; BEGIN +master-bin.000001 343 Query 1 303 use `test`; create temporary table t1 (a int) type=myisam +master-bin.000001 423 Query 1 423 use `test`; COMMIT +master-bin.000001 464 Query 1 464 use `test`; create table t0 (n int) +master-bin.000001 522 Query 1 522 use `test`; insert t0 select * from t1 +master-bin.000001 583 Query 1 583 use `test`; insert into t0 select GET_LOCK("lock1",null) +master-bin.000001 662 Query 1 662 use `test`; create table t2 (n int) engine=innodb +master-bin.000001 734 Query 1 734 use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` +master-bin.000001 835 Query 1 835 use `test`; DO RELEASE_LOCK("lock1") +select release_lock("lock1"); +release_lock("lock1") +1 +drop table t0,t2; diff --git a/mysql-test/t/rpl_bug7947.test b/mysql-test/t/rpl_bug7947.test new file mode 100644 index 00000000000..15630ebea04 --- /dev/null +++ b/mysql-test/t/rpl_bug7947.test @@ -0,0 +1,22 @@ +--source include/master-slave.inc +connection master; +begin; +create temporary table ti (a int) engine=innodb; +rollback; +insert into ti values(1); +set autocommit=0; +create temporary table t1 (a int) type=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 master; +connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock); +select get_lock("lock1",null); +show binlog events from 79; +select release_lock("lock1"); +drop table t0,t2; diff --git a/sql/item_func.cc b/sql/item_func.cc index aff4adb788a..d80eed4754a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1975,7 +1975,7 @@ void item_user_lock_release(User_level_lock *ull) tmp.copy(command, strlen(command), tmp.charset()); tmp.append(ull->key,ull->key_length); tmp.append("\")", 2); - Query_log_event qev(current_thd, tmp.ptr(), tmp.length(),1, FALSE); + Query_log_event qev(current_thd, tmp.ptr(), tmp.length(),0, FALSE); qev.error_code=0; // this query is always safe to run on slave mysql_bin_log.write(&qev); } From 637c800191dc1ccdfcbdedf04575b10beeb85575 Mon Sep 17 00:00:00 2001 From: "sasha@asksasha.com" <> Date: Mon, 7 Nov 2005 20:51:30 -0700 Subject: [PATCH 4/9] changed select release_lock() to do release_lock() to avoid having to compare the non-deterministic result in the test case for BUG#7947 the bug fix for BUG#7947 now fixed the result of mix_innodb_myisam_binlog test, which in the past was missing DO RELEASE_LOCK() in the output of SHOW BINLOG EVENTS --- mysql-test/r/mix_innodb_myisam_binlog.result | 1 + mysql-test/r/rpl_bug7947.result | 4 +--- mysql-test/t/rpl_bug7947.test | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 72288d1027b..587209a26ae 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -93,6 +93,7 @@ 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; diff --git a/mysql-test/r/rpl_bug7947.result b/mysql-test/r/rpl_bug7947.result index 8053f47d7d5..117e71a63d5 100644 --- a/mysql-test/r/rpl_bug7947.result +++ b/mysql-test/r/rpl_bug7947.result @@ -42,7 +42,5 @@ master-bin.000001 583 Query 1 583 use `test`; insert into t0 select GET_LOCK("lo master-bin.000001 662 Query 1 662 use `test`; create table t2 (n int) engine=innodb master-bin.000001 734 Query 1 734 use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` master-bin.000001 835 Query 1 835 use `test`; DO RELEASE_LOCK("lock1") -select release_lock("lock1"); -release_lock("lock1") -1 +do release_lock("lock1"); drop table t0,t2; diff --git a/mysql-test/t/rpl_bug7947.test b/mysql-test/t/rpl_bug7947.test index 15630ebea04..e802a311b6c 100644 --- a/mysql-test/t/rpl_bug7947.test +++ b/mysql-test/t/rpl_bug7947.test @@ -18,5 +18,5 @@ disconnect master; connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock); select get_lock("lock1",null); show binlog events from 79; -select release_lock("lock1"); +do release_lock("lock1"); drop table t0,t2; From 2ffc7ff2a20aeafcb005a3b2bdb1348e1d673548 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Fri, 11 Nov 2005 15:23:04 -0800 Subject: [PATCH 5/9] Update out-of-date URLs in 'help' text of mysql client. (Bug #14801) --- client/mysql.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index d408e8a5423..1c4fbf8f06f 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1813,9 +1813,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); From 9986a357ec25890a60f31bcbb5949c27b24cfa1c Mon Sep 17 00:00:00 2001 From: "sasha@asksasha.com" <> Date: Tue, 15 Nov 2005 13:38:06 -0700 Subject: [PATCH 6/9] merged in the test case for BUG#7947 --- mysql-test/r/mix_innodb_myisam_binlog.result | 48 ++++++++++++++++++++ mysql-test/r/rpl_bug7947.result | 46 ------------------- mysql-test/t/mix_innodb_myisam_binlog.test | 28 +++++++++++- mysql-test/t/rpl_bug7947.test | 22 --------- 4 files changed, 75 insertions(+), 69 deletions(-) delete mode 100644 mysql-test/r/rpl_bug7947.result delete mode 100644 mysql-test/t/rpl_bug7947.test diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result index 587209a26ae..a586ad93ce4 100644 --- a/mysql-test/r/mix_innodb_myisam_binlog.result +++ b/mysql-test/r/mix_innodb_myisam_binlog.result @@ -203,3 +203,51 @@ 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",null); +get_lock("lock1",null) +0 +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 +do release_lock("lock1"); +drop table t0,t2; diff --git a/mysql-test/r/rpl_bug7947.result b/mysql-test/r/rpl_bug7947.result deleted file mode 100644 index 117e71a63d5..00000000000 --- a/mysql-test/r/rpl_bug7947.result +++ /dev/null @@ -1,46 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -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) type=myisam; -Warnings: -Warning 1287 'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead -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",null); -get_lock("lock1",null) -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`; create temporary table ti (a int) engine=innodb -master-bin.000001 201 Query 1 201 use `test`; ROLLBACK -master-bin.000001 244 Query 1 244 use `test`; insert into ti values(1) -master-bin.000001 303 Query 1 303 use `test`; BEGIN -master-bin.000001 343 Query 1 303 use `test`; create temporary table t1 (a int) type=myisam -master-bin.000001 423 Query 1 423 use `test`; COMMIT -master-bin.000001 464 Query 1 464 use `test`; create table t0 (n int) -master-bin.000001 522 Query 1 522 use `test`; insert t0 select * from t1 -master-bin.000001 583 Query 1 583 use `test`; insert into t0 select GET_LOCK("lock1",null) -master-bin.000001 662 Query 1 662 use `test`; create table t2 (n int) engine=innodb -master-bin.000001 734 Query 1 734 use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` -master-bin.000001 835 Query 1 835 use `test`; DO RELEASE_LOCK("lock1") -do release_lock("lock1"); -drop table t0,t2; diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test index 6eb9eae2d99..a25ab9c368e 100644 --- a/mysql-test/t/mix_innodb_myisam_binlog.test +++ b/mysql-test/t/mix_innodb_myisam_binlog.test @@ -206,7 +206,33 @@ 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",null); +show binlog events from 79; +do release_lock("lock1"); +drop table t0,t2; + # End of 4.1 tests diff --git a/mysql-test/t/rpl_bug7947.test b/mysql-test/t/rpl_bug7947.test deleted file mode 100644 index e802a311b6c..00000000000 --- a/mysql-test/t/rpl_bug7947.test +++ /dev/null @@ -1,22 +0,0 @@ ---source include/master-slave.inc -connection master; -begin; -create temporary table ti (a int) engine=innodb; -rollback; -insert into ti values(1); -set autocommit=0; -create temporary table t1 (a int) type=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 master; -connect (master,localhost,root,,test,$MASTER_MYPORT,master.sock); -select get_lock("lock1",null); -show binlog events from 79; -do release_lock("lock1"); -drop table t0,t2; From d9ef45228917b3d18c73e98e520ef2dc9590eda6 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Wed, 16 Nov 2005 18:26:30 +1100 Subject: [PATCH 7/9] WL#2779 ndb_size.pl fix some small bugs, slightly improve output, add --help --- ndb/tools/ndb_size.pl | 30 +++++++++++++++++++----------- ndb/tools/ndb_size.tmpl | 6 +++--- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ndb/tools/ndb_size.pl b/ndb/tools/ndb_size.pl index 64a20423636..0203b0c1112 100644 --- a/ndb/tools/ndb_size.pl +++ b/ndb/tools/ndb_size.pl @@ -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); } @@ -68,9 +77,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,7 +140,7 @@ 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])); } @@ -166,7 +174,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) { diff --git a/ndb/tools/ndb_size.tmpl b/ndb/tools/ndb_size.tmpl index d83d5d2c6af..5d9fc8bf0c5 100644 --- a/ndb/tools/ndb_size.tmpl +++ b/ndb/tools/ndb_size.tmpl @@ -13,18 +13,18 @@ td,th { border: 1px solid black }

MySQL Cluster analysis for

This is an automated analysis of the database for migration into MySQL Cluster. No warranty is made to the accuracy of the information.

-

This information should be valid for MySQL 4.1

+

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.


-

+

">

From 87e98c870665579593a2078bb93e58fddebf61a1 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Wed, 16 Nov 2005 19:47:03 +1100 Subject: [PATCH 8/9] WL#2779 ndb_size.pl Add display of minimum requirements for various cluster parameters e.g. DataMemory, IndexMemory, MaxNoOfTables, MaxNoOfAttributes etc and the memory usage because of them. --- ndb/tools/ndb_size.pl | 57 ++++++++++++++++++++++++++++++++++++++++- ndb/tools/ndb_size.tmpl | 40 +++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/ndb/tools/ndb_size.pl b/ndb/tools/ndb_size.pl index 0203b0c1112..ece0901e0b2 100644 --- a/ndb/tools/ndb_size.pl +++ b/ndb/tools/ndb_size.pl @@ -64,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; @@ -147,7 +155,10 @@ foreach(@{$tables}) 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); @@ -265,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; diff --git a/ndb/tools/ndb_size.tmpl b/ndb/tools/ndb_size.tmpl index 5d9fc8bf0c5..dc02b5a5970 100644 --- a/ndb/tools/ndb_size.tmpl +++ b/ndb/tools/ndb_size.tmpl @@ -15,6 +15,46 @@ td,th { border: 1px solid black }

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.

+

Parameter Settings

+

NOTE the configuration parameters below do not take into account system tables and other requirements.

+
Column
+ + + + + + + + + + + + + + +
Parameter
+ +

Memory usage because of parameters

+ +

Usage is in kilobytes. Actual usage will vary as you should set the parameters larger than those listed in the table above.

+ + + + + + + + + + + + + + + +
Parameter
+ +

Table List