diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 326de19da13..15032d79d78 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -6,7 +6,7 @@ # tree can then be picked up by "make dist" to create the "pristine source # package" that is used as the basis for all other binary builds. # -make distclean +test -f Makefile && make distclean (cd storage/bdb/dist && sh s_all) (cd storage/innobase && aclocal && autoheader && \ libtoolize --automake --force --copy && \ diff --git a/include/m_string.h b/include/m_string.h index 9f7ec220f2c..e009447c192 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -256,6 +256,6 @@ typedef struct } LEX_STRING; #define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1)) -#define C_STRING_WITH_SIZE(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) +#define C_STRING_WITH_LEN(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) #endif diff --git a/include/my_global.h b/include/my_global.h index f3f3825957f..21b2251af1d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -797,6 +797,9 @@ typedef SOCKET_SIZE_TYPE size_socket; #define DBL_MAX 1.79769313486231470e+308 #define FLT_MAX ((float)3.40282346638528860e+38) #endif +#ifndef SSIZE_MAX +#define SSIZE_MAX ((~((size_t) 0)) / 2) +#endif #if !defined(HAVE_ISINF) && !defined(isinf) #define isinf(X) 0 diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index d6fb9382b90..1b2ce17a689 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -880,19 +880,28 @@ sub mtr_kill_processes ($) { sub mtr_kill_process ($$$$) { my $pid= shift; my $signal= shift; - my $retries= shift; + my $total_retries= shift; my $timeout= shift; - while (1) + for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt) { + mtr_debug("Sending $signal to $pid..."); + kill($signal, $pid); - last unless kill (0, $pid) and $retries--; + unless (kill (0, $pid)) + { + mtr_debug("Process $pid died."); + return; + } - mtr_debug("Sleep $timeout second waiting for processes to die"); + mtr_debug("Sleeping $timeout second(s) waiting for processes to die..."); sleep($timeout); } + + mtr_debug("Process $pid is still alive after $total_retries " . + "of sending signal $signal."); } ############################################################################## diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ec105b29e3f..ca2eb6641cd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -290,7 +290,7 @@ our $opt_user_test; our $opt_valgrind= 0; our $opt_valgrind_mysqld= 0; our $opt_valgrind_mysqltest= 0; -our $opt_valgrind_all= 0; +our $default_valgrind_options= "-v --show-reachable=yes"; our $opt_valgrind_options; our $opt_valgrind_path; @@ -629,10 +629,9 @@ sub command_line_setup () { # Coverage, profiling etc 'gcov' => \$opt_gcov, 'gprof' => \$opt_gprof, - 'valgrind' => \$opt_valgrind, + 'valgrind|valgrind-all' => \$opt_valgrind, 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, 'valgrind-mysqld' => \$opt_valgrind_mysqld, - 'valgrind-all' => \$opt_valgrind_all, 'valgrind-options=s' => \$opt_valgrind_options, 'valgrind-path=s' => \$opt_valgrind_path, @@ -816,20 +815,32 @@ sub command_line_setup () { } } - # Turn on valgrinding of all executables if "valgrind" or "valgrind-all" - if ( $opt_valgrind or $opt_valgrind_all ) + # Check valgrind arguments + if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options) { mtr_report("Turning on valgrind for all executables"); $opt_valgrind= 1; $opt_valgrind_mysqld= 1; $opt_valgrind_mysqltest= 1; } - elsif ( $opt_valgrind_mysqld or $opt_valgrind_mysqltest ) + elsif ( $opt_valgrind_mysqld ) { - # If test's are run for a specific executable, turn on - # verbose and show-reachable + mtr_report("Turning on valgrind for mysqld(s) only"); $opt_valgrind= 1; - $opt_valgrind_all= 1; + } + elsif ( $opt_valgrind_mysqltest ) + { + mtr_report("Turning on valgrind for mysqltest only"); + $opt_valgrind= 1; + } + + if ( $opt_valgrind ) + { + # Set valgrind_options to default unless already defined + $opt_valgrind_options=$default_valgrind_options + unless defined $opt_valgrind_options; + + mtr_report("Running valgrind with options \"$opt_valgrind_options\""); } if ( ! $opt_testcase_timeout ) @@ -3109,22 +3120,58 @@ sub im_stop($) { # Try graceful shutdown. + mtr_debug("IM-main pid: $instance_manager->{'pid'}"); + mtr_debug("Stopping IM-main..."); + mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1); + # If necessary, wait for angel process to die. + + if (defined $instance_manager->{'angel_pid'}) + { + mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}"); + mtr_debug("Waiting for IM-angel to die..."); + + my $total_attempts= 10; + + for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt) + { + unless (kill (0, $instance_manager->{'angel_pid'})) + { + mtr_debug("IM-angel died."); + last; + } + + sleep(1); + } + } + # Check that all processes died. my $clean_shutdown= 0; while (1) { - last if kill (0, $instance_manager->{'pid'}); + if (kill (0, $instance_manager->{'pid'})) + { + mtr_debug("IM-main is still alive."); + last; + } - last if (defined $instance_manager->{'angel_pid'}) && - kill (0, $instance_manager->{'angel_pid'}); + if (defined $instance_manager->{'angel_pid'} && + kill (0, $instance_manager->{'angel_pid'})) + { + mtr_debug("IM-angel is still alive."); + last; + } foreach my $pid (@mysqld_pids) { - last if kill (0, $pid); + if (kill (0, $pid)) + { + mtr_debug("Guarded mysqld ($pid) is still alive."); + last; + } } $clean_shutdown= 1; @@ -3135,15 +3182,21 @@ sub im_stop($) { unless ($clean_shutdown) { - mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1) - if defined $instance_manager->{'angel_pid'}; + + if (defined $instance_manager->{'angel_pid'}) + { + mtr_debug("Killing IM-angel..."); + mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1) + } + mtr_debug("Killing IM-main..."); mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1); # Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM # will not stop them on shutdown. So, we should firstly try to end them # legally. + mtr_debug("Killing guarded mysqld(s)..."); mtr_kill_processes(\@mysqld_pids); # Complain in error log so that a warning will be shown. @@ -3694,17 +3747,8 @@ sub valgrind_arguments { mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir) if -f "$glob_mysql_test_dir/valgrind.supp"; - if ( $opt_valgrind_all ) - { - mtr_add_arg($args, "-v"); - mtr_add_arg($args, "--show-reachable=yes"); - } - - if ( $opt_valgrind_options ) - { - mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); - } - + # Add valgrind options, can be overriden by user + mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options)); mtr_add_arg($args, $$exe); @@ -3816,12 +3860,11 @@ Options for coverage, profiling etc gcov FIXME gprof FIXME valgrind Run the "mysqltest" and "mysqld" executables using - valgrind - valgrind-all Same as "valgrind" but will also add "verbose" and - "--show-reachable" flags to valgrind + valgrind with options($default_valgrind_options) + valgrind-all Synonym for --valgrind valgrind-mysqltest Run the "mysqltest" executable with valgrind valgrind-mysqld Run the "mysqld" executable with valgrind - valgrind-options=ARGS Extra options to give valgrind + valgrind-options=ARGS Options to give valgrind, replaces default options valgrind-path=[EXE] Path to the valgrind executable Misc options diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index f6a4b20bc22..7e3e25370d3 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -241,3 +241,11 @@ select * from t1 where match a against('ab c' in boolean mode); a drop table t1; set names latin1; +SET NAMES utf8; +CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES('„MySQL“'); +SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE); +a +„MySQL“ +DROP TABLE t1; +SET NAMES latin1; diff --git a/mysql-test/r/im_daemon_life_cycle.result b/mysql-test/r/im_daemon_life_cycle.result index 29c9ea2047d..a5526a31384 100644 --- a/mysql-test/r/im_daemon_life_cycle.result +++ b/mysql-test/r/im_daemon_life_cycle.result @@ -1,3 +1,4 @@ +Success: the process has been started. SHOW INSTANCES; instance_name state mysqld1 online diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index 876fbb38eee..b6d3bb8361c 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -2,6 +2,7 @@ -------------------------------------------------------------------- -- 1.1.1. -------------------------------------------------------------------- +Success: the process has been started. SHOW INSTANCES; instance_name state mysqld1 online @@ -11,10 +12,7 @@ mysqld2 offline -- 1.1.2. -------------------------------------------------------------------- START INSTANCE mysqld2; -SHOW INSTANCES; -instance_name state -mysqld1 online -mysqld2 online +Success: the process has been started. SHOW VARIABLES LIKE 'port'; Variable_name Value port IM_MYSQLD2_PORT @@ -23,16 +21,7 @@ port IM_MYSQLD2_PORT -- 1.1.3. -------------------------------------------------------------------- STOP INSTANCE mysqld2; -SHOW INSTANCES; -instance_name state -mysqld1 online -mysqld2 offline -SHOW INSTANCE STATUS mysqld1; -instance_name state version_number version mysqld_compatible -mysqld1 online VERSION_NUMBER VERSION no -SHOW INSTANCE STATUS mysqld2; -instance_name state version_number version mysqld_compatible -mysqld2 offline VERSION_NUMBER VERSION no +Success: the process has been stopped. -------------------------------------------------------------------- -- 1.1.4. @@ -58,26 +47,19 @@ mysqld2 offline Killing the process... Sleeping... Success: the process was restarted. +SHOW INSTANCES; +instance_name state +mysqld1 online +mysqld2 offline -------------------------------------------------------------------- -- 1.1.7. -------------------------------------------------------------------- -SHOW INSTANCES; -instance_name state -mysqld1 online -mysqld2 offline START INSTANCE mysqld2; -SHOW INSTANCES; -instance_name state -mysqld1 online -mysqld2 online +Success: the process has been started. Killing the process... Sleeping... Success: the process was killed. -SHOW INSTANCES; -instance_name state -mysqld1 online -mysqld2 offline -------------------------------------------------------------------- -- 1.1.8. diff --git a/mysql-test/r/im_utils.result b/mysql-test/r/im_utils.result index ae8e03bf8ea..df20a7fb5c7 100644 --- a/mysql-test/r/im_utils.result +++ b/mysql-test/r/im_utils.result @@ -1,3 +1,4 @@ +Success: the process has been started. SHOW INSTANCES; instance_name state mysqld1 online @@ -42,7 +43,9 @@ skip-ndbcluster VALUE nonguarded VALUE log-output VALUE START INSTANCE mysqld2; +Success: the process has been started. STOP INSTANCE mysqld2; +Success: the process has been stopped. SHOW mysqld1 LOG FILES; Logfile Path File size ERROR LOG PATH FILE_SIZE diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 18bd6d7e796..235c3f61fe9 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -321,3 +321,35 @@ ERROR 42000: Column 'b' specified twice INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a); ERROR 42000: Column 'b' specified twice drop table t1; +create table t1 (n int); +create view v1 as select * from t1; +insert delayed into v1 values (1); +ERROR HY000: 'test.v1' is not BASE TABLE +drop table t1; +drop view v1; +create table t1 (id int primary key, data int); +insert into t1 values (1, 1), (2, 2), (3, 3); +select row_count(); +row_count() +3 +insert ignore into t1 values (1, 1); +select row_count(); +row_count() +0 +replace into t1 values (1, 11); +select row_count(); +row_count() +2 +replace into t1 values (4, 4); +select row_count(); +row_count() +1 +insert into t1 values (2, 2) on duplicate key update data= data + 10; +select row_count(); +row_count() +2 +insert into t1 values (5, 5) on duplicate key update data= data + 10; +select row_count(); +row_count() +1 +drop table t1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3226351f966..0ec74f59de3 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -747,6 +747,14 @@ select count(id1) from t1 where id2 = 10; count(id1) 5 drop table t1; +CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM; +INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx'); +UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb'; +SELECT * FROM t1; +a b +xxxxxxxxx bbbbbb +xxxxxxxxx bbbbbb +DROP TABLE t1; set storage_engine=MyISAM; drop table if exists t1,t2,t3; --- Testing varchar --- diff --git a/mysql-test/r/ndb_dd_dump.result b/mysql-test/r/ndb_dd_dump.result index 6572f0228d0..52e88b7db86 100644 --- a/mysql-test/r/ndb_dd_dump.result +++ b/mysql-test/r/ndb_dd_dump.result @@ -172,7 +172,7 @@ INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE="UNDO LOG" ORDER BY FILE_NAME; LOGFILE_GROUP_NAME FILE_NAME TOTAL_EXTENTS INITIAL_SIZE ENGINE -lg1 undofile_lg1_01.dat 1048576 2097152 ndbcluster +lg1 undofile_lg1_01.dat 524288 2097152 ndbcluster lg1 undofile_lg1_02.dat 1048576 4194304 ndbcluster SELECT DISTINCT TABLESPACE_NAME, diff --git a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result index cdcd935bfcc..8e85feb3bd3 100644 --- a/mysql-test/r/ndb_replace.result +++ b/mysql-test/r/ndb_replace.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, benutzer_id int(11) DEFAULT '0' NOT NULL, @@ -31,3 +31,24 @@ SELECT * from t1 ORDER BY i; i j k 3 1 42 17 2 NULL +CREATE TABLE t2 (a INT(11) NOT NULL, +b INT(11) NOT NULL, +c INT(11) NOT NULL, +x TEXT, +y TEXT, +z TEXT, +id INT(10) unsigned NOT NULL AUTO_INCREMENT, +i INT(11) DEFAULT NULL, +PRIMARY KEY (id), +UNIQUE KEY a (a,b,c) +) ENGINE=ndbcluster; +REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3); +SELECT * FROM t2 ORDER BY id; +a b c x y z id i +1 1 1 c c c 3 3 +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1); +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2); +SELECT * FROM t2 ORDER BY id; +a b c x y z id i +1 1 1 b b b 5 2 +DROP TABLE t2; diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index c435fb37531..b88af325397 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -132,3 +132,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +create table t1(a int auto_increment primary key, b int); +insert into t1 values (NULL, 1); +reset master; +set insert_id=5; +insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Table_map 2 # table_id: 30 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 30 flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result index 65e9ee9fb9f..609f9376efd 100644 --- a/mysql-test/r/rpl_row_log.result +++ b/mysql-test/r/rpl_row_log.result @@ -100,3 +100,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +create table t1(a int auto_increment primary key, b int); +insert into t1 values (NULL, 1); +reset master; +set insert_id=5; +insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Table_map 2 # table_id: 21 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 21 flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result index 2c89ca5f8ff..b47dff40454 100644 --- a/mysql-test/r/rpl_row_log_innodb.result +++ b/mysql-test/r/rpl_row_log_innodb.result @@ -108,3 +108,19 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +create table t1(a int auto_increment primary key, b int); +insert into t1 values (NULL, 1); +reset master; +set insert_id=5; +insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 +slave-bin.000001 # Table_map 2 # table_id: 21 (test.t1) +slave-bin.000001 # Write_rows 2 # table_id: 21 flags: STMT_END_F +select * from t1; +a b +1 1 +5 1 +6 1 +drop table t1; diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 24675f2cd66..145579201a9 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -169,21 +169,22 @@ select @log; @log (BEFORE_INSERT: new=(id=1, data=2)) set @log:= ""; -replace t1 values (1, 3), (2, 2); +insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1; select @log; @log -(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=3))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2)) -alter table t1 add ts timestamp default now(); +(BEFORE_INSERT: new=(id=1, data=3))(BEFORE_UPDATE: old=(id=1, data=1) new=(id=1, data=2))(AFTER_UPDATE: old=(id=1, data=1) new=(id=1, data=2))(BEFORE_INSERT: new=(id=2, data=2))(AFTER_INSERT: new=(id=2, data=2)) set @log:= ""; -replace t1 (id, data) values (1, 4); +replace t1 values (1, 4), (3, 3); select @log; @log -(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=3))(AFTER_DELETE: old=(id=1, data=3))(AFTER_INSERT: new=(id=1, data=4)) +(BEFORE_INSERT: new=(id=1, data=4))(BEFORE_DELETE: old=(id=1, data=2))(AFTER_DELETE: old=(id=1, data=2))(AFTER_INSERT: new=(id=1, data=4))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3)) +drop trigger t1_bd; +drop trigger t1_ad; set @log:= ""; -insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2; +replace t1 values (1, 5); select @log; @log -(BEFORE_INSERT: new=(id=1, data=5))(BEFORE_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(AFTER_UPDATE: old=(id=1, data=4) new=(id=1, data=6))(BEFORE_INSERT: new=(id=3, data=3))(AFTER_INSERT: new=(id=3, data=3)) +(BEFORE_INSERT: new=(id=1, data=5))(AFTER_INSERT: new=(id=1, data=5)) drop table t1; create table t1 (id int primary key, data varchar(10), fk int); create table t2 (event varchar(100)); @@ -493,15 +494,9 @@ select * from t1; i k 3 13 replace into t1 values (3, 3); -ERROR 42S22: Unknown column 'at' in 'NEW' -select * from t1; -i k -3 3 -alter table t1 add ts timestamp default now(); -replace into t1 (i, k) values (3, 13); ERROR 42S22: Unknown column 'at' in 'OLD' select * from t1; -i k ts +i k drop table t1, t2; create table t1 (i int, bt int, k int, key(k)) engine=myisam; create table t2 (i int); @@ -574,18 +569,11 @@ i k 1 1 2 2 replace into t1 values (2, 4); -ERROR 42S22: Unknown column 'bt' in 'NEW' +ERROR 42S22: Unknown column 'bt' in 'OLD' select * from t1; i k 1 1 2 2 -alter table t1 add ts timestamp default now(); -replace into t1 (i, k) values (2, 11); -ERROR 42S22: Unknown column 'bt' in 'OLD' -select * from t1; -i k ts -1 1 0000-00-00 00:00:00 -2 2 0000-00-00 00:00:00 drop table t1, t2; drop function if exists bug5893; create table t1 (col1 int, col2 int); diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 2305004a5a3..20462ad62cb 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -13,9 +13,9 @@ #events_stress : BUG#17619 2006-02-21 andrey Race conditions #events : BUG#17619 2006-02-21 andrey Race conditions #events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. -im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly -im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails +im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly +im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog #ndb_binlog_discover : BUG#19395 2006-04-28 tomas/knielsen mysqld does not always detect cluster shutdown diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index fd97f795534..88967a5dd04 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -221,3 +221,13 @@ drop table t1; set names latin1; # End of 4.1 tests + +# +# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns +# +SET NAMES utf8; +CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES('„MySQL“'); +SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE); +DROP TABLE t1; +SET NAMES latin1; diff --git a/mysql-test/t/im_cmd_line.imtest b/mysql-test/t/im_cmd_line.imtest index 00e8351535e..29ed420439d 100644 --- a/mysql-test/t/im_cmd_line.imtest +++ b/mysql-test/t/im_cmd_line.imtest @@ -26,7 +26,7 @@ --echo --echo --> Printing out line for 'testuser'... ---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --passwd --username=testuser --password=abc | tail -1 +--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=abc | tail -1 --echo --echo --> Listing users... @@ -45,7 +45,7 @@ --echo --echo --> Printing out line for 'testuser'... ---exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --passwd --username=testuser --password=xyz | tail -1 +--exec $IM_EXE --defaults-file="$IM_DEFAULTS_PATH" --print-password-line --username=testuser --password=xyz | tail -1 --echo --echo --> Listing users... diff --git a/mysql-test/t/im_daemon_life_cycle.imtest b/mysql-test/t/im_daemon_life_cycle.imtest index d173ce2a6e2..3afc36935f8 100644 --- a/mysql-test/t/im_daemon_life_cycle.imtest +++ b/mysql-test/t/im_daemon_life_cycle.imtest @@ -10,9 +10,22 @@ ########################################################################### +# Wait for mysqld1 (guarded instance) to start. + +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started + +# Let IM detect that mysqld1 is online. This delay should be longer than +# monitoring interval. + --sleep 3 -# should be longer than monitoring interval and enough to start instance. + +# Check that start conditions are as expected. SHOW INSTANCES; ---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted +########################################################################### + +# Kill the IM main process and check that the IM Angel will restart the main +# process. + +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_PATH_PID restarted 30 diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest index d71cdc86624..2cbe53a7b28 100644 --- a/mysql-test/t/im_life_cycle.imtest +++ b/mysql-test/t/im_life_cycle.imtest @@ -22,8 +22,16 @@ --echo -- 1.1.1. --echo -------------------------------------------------------------------- +# Wait for mysqld1 (guarded instance) to start. + +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started + +# Let IM detect that mysqld1 is online. This delay should be longer than +# monitoring interval. + --sleep 3 -# should be longer than monitoring interval and enough to start instance. + +# Check that start conditions are as expected. SHOW INSTANCES; @@ -44,10 +52,12 @@ SHOW INSTANCES; START INSTANCE mysqld2; # FIXME: START INSTANCE should be synchronous. ---sleep 3 -# should be longer than monitoring interval and enough to start instance. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started -SHOW INSTANCES; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; --connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK) --connection mysql_con @@ -74,14 +84,12 @@ SHOW VARIABLES LIKE 'port'; STOP INSTANCE mysqld2; # FIXME: STOP INSTANCE should be synchronous. ---sleep 3 -# should be longer than monitoring interval and enough to stop instance. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped -SHOW INSTANCES; ---replace_column 3 VERSION_NUMBER 4 VERSION -SHOW INSTANCE STATUS mysqld1; ---replace_column 3 VERSION_NUMBER 4 VERSION -SHOW INSTANCE STATUS mysqld2; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ########################################################################### # @@ -140,10 +148,14 @@ STOP INSTANCE mysqld3; SHOW INSTANCES; ---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30 + +# Give some time to IM to detect that mysqld was restarted. It should be longer +# than monitoring interval. --sleep 3 -# should be longer than monitoring interval and enough to start instance. + +SHOW INSTANCES; ########################################################################### # @@ -156,18 +168,21 @@ SHOW INSTANCES; --echo -- 1.1.7. --echo -------------------------------------------------------------------- -SHOW INSTANCES; - START INSTANCE mysqld2; # FIXME: START INSTANCE should be synchronous. ---sleep 3 -# should be longer than monitoring interval and enough to start instance. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started -SHOW INSTANCES; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ---exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed +--exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10 -SHOW INSTANCES; +# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is +# synchronous. Even waiting for mysqld to start by looking at its pid file is +# not enough, because IM may not detect that mysqld has started. +# SHOW INSTANCES; ########################################################################### # diff --git a/mysql-test/t/im_utils.imtest b/mysql-test/t/im_utils.imtest index 8e8d475cfee..47902eeba52 100644 --- a/mysql-test/t/im_utils.imtest +++ b/mysql-test/t/im_utils.imtest @@ -17,8 +17,16 @@ # - the second instance is offline; # +# Wait for mysqld1 (guarded instance) to start. + +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started + +# Let IM detect that mysqld1 is online. This delay should be longer than +# monitoring interval. + --sleep 3 -# should be longer than monitoring interval and enough to start instance. + +# Check that start conditions are as expected. SHOW INSTANCES; @@ -43,12 +51,10 @@ SHOW INSTANCE OPTIONS mysqld2; # START INSTANCE mysqld2; - -# FIXME: START INSTANCE should be synchronous. ---sleep 3 -# should be longer than monitoring interval and enough to start instance. +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started STOP INSTANCE mysqld2; +--exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped # # Check 'SHOW LOG FILES' command: diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index e2514083ea7..3711e2986ed 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -201,3 +201,36 @@ insert into t1 (b,b) select 1,2; --error 1110 INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a); drop table t1; +# Test for INSERT DELAYED INTO a +# BUG#13683: INSERT DELAYED into a view creates an infinite loop +# + +create table t1 (n int); +create view v1 as select * from t1; +--error 1347 +insert delayed into v1 values (1); +drop table t1; +drop view v1; + +# +# Test for values returned by ROW_COUNT() function +# (and thus for values returned by mysql_affected_rows()) +# for various forms of INSERT +# +create table t1 (id int primary key, data int); +insert into t1 values (1, 1), (2, 2), (3, 3); +select row_count(); +insert ignore into t1 values (1, 1); +select row_count(); +# Reports that 2 rows are affected (1 deleted + 1 inserted) +replace into t1 values (1, 11); +select row_count(); +replace into t1 values (4, 4); +select row_count(); +# Reports that 2 rows are affected. This conforms to documentation. +# (Useful for differentiating inserts from updates). +insert into t1 values (2, 2) on duplicate key update data= data + 10; +select row_count(); +insert into t1 values (5, 5) on duplicate key update data= data + 10; +select row_count(); +drop table t1; diff --git a/mysql-test/t/kill_n_check.sh b/mysql-test/t/kill_n_check.sh index e722b3a180d..64cc869d1ec 100755 --- a/mysql-test/t/kill_n_check.sh +++ b/mysql-test/t/kill_n_check.sh @@ -1,66 +1,115 @@ #!/bin/sh -if [ $# -ne 2 ]; then - echo "Usage: kill_n_check.sh killed|restarted" +########################################################################### + +# NOTE: this script returns 0 (success) even in case of failure. This is +# because this script is executed under mysql-test-run[.pl] and it's better to +# examine particular problem in log file, than just having said that the test +# case has failed. + +########################################################################### + +check_restart() +{ + if [ ! -r "$pid_path" ]; then + user_msg='the process was killed' + return 1 + fi + + new_pid=`cat "$pid_path" 2>/dev/null` + + if [ $? -eq 0 -a "$original_pid" = "$new_pid" ]; then + user_msg='the process was not restarted' + return 1 + fi + + user_msg='the process was restarted' + return 0 +} + +########################################################################### + +if [ $# -ne 3 ]; then + echo "Usage: kill_n_check.sh killed|restarted " exit 0 fi pid_path="$1" expected_result="$2" +total_timeout="$3" -if [ -z "$pid_path" -o ! -r "$pid_path" ]; then - echo "Error: invalid PID path ($pid_path) or PID file does not exist." +if [ "$expected_result" != 'killed' -a \ + "$expected_result" != 'restarted' ]; then + echo "Error: invalid second argument ('killed' or 'restarted' expected)." exit 0 fi -if [ "$expected_result" != "killed" -a \ - "$expected_result" != "restarted" ]; then - echo "Error: expected result must be either 'killed' or 'restarted'." +if [ -z "$pid_path" ]; then + echo "Error: invalid PID path ($pid_path)." exit 0 fi -# echo "PID path: '$pid_path'" +if [ $expected_result = 'killed' -a ! -r "$pid_path" ]; then + echo "Error: PID file ($pid_path) does not exist." + exit 0 +fi + +if [ -z "$total_timeout" ]; then + echo "Error: timeout is not specified." + exit 0 +fi + +########################################################################### original_pid=`cat "$pid_path"` -# echo "Original PID: $original_pid" - echo "Killing the process..." kill -9 $original_pid +########################################################################### + echo "Sleeping..." -sleep 3 - -new_pid="" - -[ -r "$pid_path" ] && new_pid=`cat "$pid_path"` - -# echo "New PID: $new_pid" - if [ "$expected_result" = "restarted" ]; then - if [ -z "$new_pid" ]; then - echo "Error: the process was killed." - exit 0 - fi + # Wait for the process to restart. - if [ "$original_pid" -eq "$new_pid" ]; then - echo "Error: the process was not restarted." - exit 0 - fi - - echo "Success: the process was restarted." + cur_attempt=1 + + while true; do + + if check_restart; then + echo "Success: $user_msg." + exit 0 + fi + + [ $cur_attempt -ge $total_timeout ] && break + + sleep 1 + + cur_attempt=`expr $cur_attempt + 1` + + done + + echo "Error: $user_msg." exit 0 - -else # $expected_result = killed - + +else # $expected_result == killed + + # Here we have to sleep for some long time to ensure that the process will + # not be restarted. + + sleep $total_timeout + + new_pid=`cat "$pid_path" 2>/dev/null` + if [ "$new_pid" -a "$new_pid" -ne "$original_pid" ]; then echo "Error: the process was restarted." - exit 0 + else + echo "Success: the process was killed." fi - echo "Success: the process was killed." exit 0 + fi diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index a77537f3ff5..2cce38498b8 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -697,6 +697,15 @@ select count(*) from t1 where id2 = 10; select count(id1) from t1 where id2 = 10; drop table t1; +# +# BUG#18036 - update of table joined to self reports table as crashed +# +CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM; +INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx'); +UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb'; +SELECT * FROM t1; +DROP TABLE t1; + # End of 4.1 tests # @@ -869,4 +878,3 @@ drop table t1; create table t1 (a int not null, key key_block_size=1024 (a)); --error 1064 create table t1 (a int not null, key `a` key_block_size=1024 (a)); - diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test index 6cad80ef8ea..94a11f7dfb2 100644 --- a/mysql-test/t/ndb_replace.test +++ b/mysql-test/t/ndb_replace.test @@ -6,7 +6,7 @@ # --disable_warnings -drop table if exists t1; +drop table if exists t1,t2; --enable_warnings CREATE TABLE t1 ( @@ -27,6 +27,8 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1); select * from t1 order by gesuchnr; drop table t1; +# End of 4.1 tests + # bug#17431 CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT, j INT, @@ -38,4 +40,28 @@ REPLACE INTO t1 (j,k) VALUES (1,42); REPLACE INTO t1 (i,j) VALUES (17,2); SELECT * from t1 ORDER BY i; -# End of 4.1 tests +# bug#19906 +CREATE TABLE t2 (a INT(11) NOT NULL, + b INT(11) NOT NULL, + c INT(11) NOT NULL, + x TEXT, + y TEXT, + z TEXT, + id INT(10) unsigned NOT NULL AUTO_INCREMENT, + i INT(11) DEFAULT NULL, + PRIMARY KEY (id), + UNIQUE KEY a (a,b,c) +) ENGINE=ndbcluster; + +REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3); + +SELECT * FROM t2 ORDER BY id; + +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1); +REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2); + +SELECT * FROM t2 ORDER BY id; + +DROP TABLE t2; + + diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index a87f289e94e..58adffc6e87 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -185,24 +185,26 @@ select @log; set @log:= ""; insert ignore t1 values (1, 2); select @log; -# REPLACE: before insert trigger should be called for both records, -# but then for first one update will be executed (and both update -# triggers should fire). For second after insert trigger will be -# called as for usual insert +# INSERT ... ON DUPLICATE KEY UPDATE ... set @log:= ""; -replace t1 values (1, 3), (2, 2); +insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1; select @log; -# Now let us change table in such way that REPLACE on won't be executed -# using update. -alter table t1 add ts timestamp default now(); +# REPLACE (also test for bug#13479 "REPLACE activates UPDATE trigger, +# not the DELETE and INSERT triggers") +# We define REPLACE as INSERT which DELETEs old rows which conflict with +# row being inserted. So for the first record in statement below we will +# call before insert trigger, then delete will be executed (and both delete +# triggers should fire). Finally after insert trigger will be called. +# For the second record we will just call both on insert triggers. set @log:= ""; -# This REPLACE should be executed via DELETE and INSERT so proper -# triggers should be invoked. -replace t1 (id, data) values (1, 4); +replace t1 values (1, 4), (3, 3); select @log; -# Finally let us test INSERT ... ON DUPLICATE KEY UPDATE ... +# Now we will drop ON DELETE triggers to test REPLACE which is internally +# executed via update +drop trigger t1_bd; +drop trigger t1_ad; set @log:= ""; -insert into t1 (id, data) values (1, 5), (3, 3) on duplicate key update data= data + 2; +replace t1 values (1, 5); select @log; # This also drops associated triggers @@ -531,14 +533,11 @@ alter table t1 add primary key (i); --error 1054 insert into t1 values (3, 4) on duplicate key update k= k + 10; select * from t1; +# The following statement will delete old row and won't +# insert new one since after delete trigger will fail. --error 1054 replace into t1 values (3, 3); select * from t1; -# Change table in such way that REPLACE will delete row -alter table t1 add ts timestamp default now(); ---error 1054 -replace into t1 (i, k) values (3, 13); -select * from t1; # Also drops all triggers drop table t1, t2; @@ -594,11 +593,6 @@ select * from t1; --error 1054 replace into t1 values (2, 4); select * from t1; -# Change table in such way that REPLACE will delete row -alter table t1 add ts timestamp default now(); ---error 1054 -replace into t1 (i, k) values (2, 11); -select * from t1; # Also drops all triggers drop table t1, t2; diff --git a/mysql-test/t/wait_for_process.sh b/mysql-test/t/wait_for_process.sh new file mode 100755 index 00000000000..df0f4a17e3a --- /dev/null +++ b/mysql-test/t/wait_for_process.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +########################################################################### + +pid_path="$1" +total_attempts="$2" +event="$3" + +case "$3" in + started) + check_fn='check_started'; + ;; + + stopped) + check_fn='check_stopped'; + ;; + + *) + echo "Error: invalid third argument ('started' or 'stopped' expected)." + exit 0 +esac + +########################################################################### + +check_started() +{ + [ ! -r "$pid_path" ] && return 1 + + new_pid=`cat "$pid_path" 2>/dev/null` + + [ $? -eq 0 -a "$original_pid" = "$new_pid" ] && return 1 + + return 0 +} + +########################################################################### + +check_stopped() +{ + [ -r "$pid_path" ] && return 1 + + return 0 +} + +########################################################################### + +cur_attempt=1 + +while true; do + + if ( eval $check_fn ); then + echo "Success: the process has been $event." + exit 0 + fi + + [ $cur_attempt -ge $total_attempts ] && break + + sleep 1 + + cur_attempt=`expr $cur_attempt + 1` + +done + +echo "Error: the process has not been $event in $total_attempts secs." +exit 0 + diff --git a/netware/BUILD/compile-netware-END b/netware/BUILD/compile-netware-END index 0bb4e808b63..c5c08cea908 100755 --- a/netware/BUILD/compile-netware-END +++ b/netware/BUILD/compile-netware-END @@ -21,10 +21,6 @@ rm -rf Makefile.in.bk # run auto tools . $path/compile-AUTOTOOLS -# For NetWare there is no comp_err but comp_err.linux -sed -e "s/comp_err\$(EXEEXT)/comp_err.linux/g" extra/Makefile.am > extra/Makefile.am.$$ -mv extra/Makefile.am.$$ extra/Makefile.am - # configure ./configure $base_configs $extra_configs diff --git a/netware/Makefile.am b/netware/Makefile.am index e1c2eedc2b7..5b40933994b 100644 --- a/netware/Makefile.am +++ b/netware/Makefile.am @@ -31,7 +31,7 @@ netware_build_files = client/mysql.def client/mysqladmin.def \ client/mysqlshow.def client/mysqltest.def \ client/mysqlslap.def \ sql/mysqld.def extra/mysql_waitpid.def \ - extra/mysql_install.def extra/my_print_defaults.def \ + extra/my_print_defaults.def \ extra/perror.def extra/replace.def \ extra/resolveip.def extra/comp_err.def \ extra/resolve_stack_dump.def \ @@ -54,7 +54,7 @@ EXTRA_DIST= comp_err.def init_db.sql install_test_db.ncf \ libmysqlmain.c my_manage.c my_manage.h \ my_print_defaults.def myisam_ftdump.def myisamchk.def \ myisamlog.def myisampack.def mysql.def mysql.xdc \ - mysql_fix_privilege_tables.pl mysql_install.def \ + mysql_fix_privilege_tables.pl \ mysql_install_db.c mysql_install_db.def \ mysql_secure_installation.pl mysql_test_run.c \ mysql_test_run.def mysql_waitpid.def mysqladmin.def \ diff --git a/netware/mysql_install.def b/netware/mysql_install.def deleted file mode 100644 index 3392afb7298..00000000000 --- a/netware/mysql_install.def +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# My Print Defaults -#------------------------------------------------------------------------------ -MODULE libc.nlm -COPYRIGHT "(c) 2003-2005 Novell, Inc. Portions (c) 2003 MySQL AB. All Rights Reserved." -DESCRIPTION "MySQL Install Tool" -VERSION 4, 0 -XDCDATA ../netware/mysql.xdc -#DEBUG - diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 6883719cbe4..27c8b6b7e91 100644 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -1,11 +1,14 @@ #!/bin/sh +# Terminate loudly on error, we don't want partial package +set -e +trap "echo '*** script failed ***'" 0 + # # Script to create a Windows src package # version=@VERSION@ -export version CP="cp -p" DEBUG=0 @@ -74,7 +77,7 @@ show_usage() echo " --tmp Specify the temporary location" echo " --suffix Suffix name for the package" echo " --dirname Directory name to copy files (intermediate)" - echo " --silent Do not list verbosely files processed" + echo " --silent Show no progress information" echo " --tar Create tar.gz package" echo " --zip Create zip package" echo " --help Show this help message" @@ -140,10 +143,11 @@ unix_to_dos() # Create a tmp dest directory to copy files # -BASE=$TMP/my_win_dist$SUFFIX +BASE=$TMP/my_win_dist$SUFFIX.$$ +trap "rm -r -f $BASE; echo '*** interrupted ***'; exit 1" 1 2 3 13 15 if [ -d $BASE ] ; then - print_debug "Destination directory '$BASE' already exists, deleting it" + echo "WARNING: Destination directory '$BASE' already exists, deleting it" rm -r -f $BASE fi @@ -199,7 +203,7 @@ copy_dir_files() print_debug "Creating directory '$arg'" mkdir $BASE/$arg fi - for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp \ + for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp *.yy \ README INSTALL* LICENSE AUTHORS NEWS ChangeLog \ *.inc *.test *.result *.pem Moscow_leap des_key_file \ *.vcproj *.sln *.dat *.000001 *.require *.opt @@ -252,7 +256,7 @@ copy_dir_dirs() { for i in client dbug extra storage/heap include storage/archive storage/csv \ include/mysql libmysql libmysqld storage/myisam storage/example \ storage/myisammrg mysys regex sql strings sql-common \ - tools vio zlib + vio zlib do copy_dir_files $i done @@ -260,7 +264,7 @@ done # # Create project files for ndb # -#make -C $SOURCE/storage/ndb windoze +#make -C $SOURCE/storage/ndb windoze || true # # Input directories to be copied recursively @@ -334,8 +338,17 @@ done # Fix some windows files to avoid compiler warnings # -./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' > $BASE/sql/sql_yacc.cpp-new -mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp +if [ -x extra/replace ] ; then + ./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | \ + sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' \ + > $BASE/sql/sql_yacc.cpp-new + mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp +else + if [ "$SILENT" = "0" ] ; then + echo 'WARNING: "extra/replace" not built, can not filter "sql_yacc.ccp"' + echo 'WARNING: to reduce the number of warnings when building' + fi +fi # # Search the tree for plain text files and adapt the line end marker @@ -356,19 +369,23 @@ mv $BASE/README $BASE/README.txt # Clean up if we did this from a bk tree # -if [ -d $BASE/SSL/SCCS ] -then - find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f -fi -find $BASE/ -type d -name .deps -printf " \"%p\"" | xargs rm -r -f -find $BASE/ -type d -name .libs -printf " \"%p\"" | xargs rm -r -f +find $BASE -type d \( -name SCCS -o -name .deps -o -name .libs \) -print0 | \ +xargs -0 rm -r -f rm -r -f "$BASE/mysql-test/var" # # Initialize the initial data directory # -if [ -f scripts/mysql_install_db ]; then +if [ ! -f scripts/mysql_install_db ] ; then + if [ "$SILENT" = "0" ] ; then + echo 'WARNING: "scripts/mysql_install_db" is not built, can not initiate databases' + fi +elif [ ! -f extra/my_print_defaults ]; then + if [ "$SILENT" = "0" ] ; then + echo 'WARNING: "extra/my_print_defaults" is not built, can not initiate databases' + fi +else print_debug "Initializing the 'data' directory" scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data if test "$?" = 1 @@ -446,21 +463,15 @@ set_tarzip_options() if [ "$arg" = "tar" ]; then ZIPFILE1=gnutar ZIPFILE2=gtar - OPT=cvf + OPT=cf EXT=".tar" NEED_COMPRESS=1 - if [ "$SILENT" = "1" ] ; then - OPT=cf - fi else ZIPFILE1=zip ZIPFILE2="" - OPT="-r" + OPT="-r -q" EXT=".zip" NEED_COMPRESS=0 - if [ "$SILENT" = "1" ] ; then - OPT="$OPT -q" - fi fi done } @@ -521,4 +532,7 @@ fi print_debug "Removing temporary directory" rm -r -f $BASE +# No need to report anything if we got here +trap "" 0 + # End of script diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc index 07e1e9a18f3..f45b230171e 100644 --- a/server-tools/instance-manager/commands.cc +++ b/server-tools/instance-manager/commands.cc @@ -695,7 +695,7 @@ bool Create_instance::parse_args(const char **text) if (!option_value_str) { - LEX_STRING empty_str= { C_STRING_WITH_SIZE("") }; + LEX_STRING empty_str= { C_STRING_WITH_LEN("") }; if (!(option_value_str= Named_value::alloc_str(&empty_str))) return TRUE; /* out of memory during parsing. */ @@ -1511,7 +1511,7 @@ bool Set_option::parse_args(const char **text) if (!option_value_str) { - LEX_STRING empty_str= { C_STRING_WITH_SIZE("") }; + LEX_STRING empty_str= { C_STRING_WITH_LEN("") }; if (!(option_value_str= Named_value::alloc_str(&empty_str))) return TRUE; /* out of memory during parsing. */ @@ -1650,7 +1650,7 @@ bool Unset_option::parse_args(const char **text) return TRUE; /* out of memory during parsing. */ { - LEX_STRING empty_str= { C_STRING_WITH_SIZE("") }; + LEX_STRING empty_str= { C_STRING_WITH_LEN("") }; if (!(option_value_str= Named_value::alloc_str(&empty_str))) { diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 456052bf7e5..340a2d67353 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -37,7 +37,7 @@ const LEX_STRING -Instance::DFLT_INSTANCE_NAME= { C_STRING_WITH_SIZE("mysqld") }; +Instance::DFLT_INSTANCE_NAME= { C_STRING_WITH_LEN("mysqld") }; static const char * const INSTANCE_NAME_PREFIX= Instance::DFLT_INSTANCE_NAME.str; static const int INSTANCE_NAME_PREFIX_LEN= Instance::DFLT_INSTANCE_NAME.length; diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc index c9608fa7c14..ec73fb7d73a 100644 --- a/server-tools/instance-manager/instance_map.cc +++ b/server-tools/instance-manager/instance_map.cc @@ -293,7 +293,7 @@ int Instance_map::flush_instances() get_instance_key, delete_instance, 0); rc= load(); - guardian->init(); + guardian->init(); // TODO: check error status. return rc; } diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc index b05e40734b7..7b3f435eae5 100644 --- a/server-tools/instance-manager/instance_options.cc +++ b/server-tools/instance-manager/instance_options.cc @@ -120,7 +120,7 @@ int Instance_options::get_default_option(char *result, size_t result_len, { int rc= 1; LEX_STRING verbose_option= - { C_STRING_WITH_SIZE(" --no-defaults --verbose --help") }; + { C_STRING_WITH_LEN(" --no-defaults --verbose --help") }; /* reserve space for the path + option + final '\0' */ Buffer cmd(mysqld_path.length + verbose_option.length + 1); @@ -155,7 +155,7 @@ int Instance_options::fill_instance_version() { char result[MAX_VERSION_LENGTH]; LEX_STRING version_option= - { C_STRING_WITH_SIZE(" --no-defaults --version") }; + { C_STRING_WITH_LEN(" --no-defaults --version") }; int rc= 1; Buffer cmd(mysqld_path.length + version_option.length + 1); @@ -210,7 +210,7 @@ int Instance_options::fill_mysqld_real_path() { char result[FN_REFLEN]; LEX_STRING help_option= - { C_STRING_WITH_SIZE(" --no-defaults --help") }; + { C_STRING_WITH_LEN(" --no-defaults --help") }; int rc= 1; Buffer cmd(mysqld_path.length + help_option.length); diff --git a/server-tools/instance-manager/manager.cc b/server-tools/instance-manager/manager.cc index 599131089ed..d2d498eebf1 100644 --- a/server-tools/instance-manager/manager.cc +++ b/server-tools/instance-manager/manager.cc @@ -198,6 +198,25 @@ void manager() if (create_pid_file(Options::Main::pid_file_name, manager_pid)) return; /* necessary logging has been already done. */ + /* + Initialize signals and alarm-infrastructure. + + NOTE: To work nicely with LinuxThreads, the signal thread is the first + thread in the process. + + NOTE: + After init_thr_alarm() call it's possible to call thr_alarm() (from + different threads), that results in sending ALARM signal to the alarm + thread (which can be the main thread). That signal can interrupt + blocking calls. + + In other words, a blocking call can be interrupted in the main thread + after init_thr_alarm(). + */ + + sigset_t mask; + set_signals(&mask); + /* create guardian thread */ { pthread_t guardian_thd_id; @@ -205,9 +224,16 @@ void manager() int rc; /* - NOTE: Guardian should be shutdown first. Only then all other threads - need to be stopped. This should be done, as guardian is responsible for - shutting down the instances, and this is a long operation. + NOTE: Guardian should be shutdown first. Only then all other threads + need to be stopped. This should be done, as guardian is responsible + for shutting down the instances, and this is a long operation. + + NOTE: Guardian uses thr_alarm() when detects current state of + instances (is_running()), but it is not interfere with + flush_instances() later in the code, because until flush_instances() + complete in the main thread, Guardian thread is not permitted to + process instances. And before flush_instances() there is no instances + to proceed. */ pthread_attr_init(&guardian_thd_attr); @@ -223,10 +249,8 @@ void manager() } - /* - To work nicely with LinuxThreads, the signal thread is the first thread - in the process. - */ + /* Load instances. */ + { instance_map.guardian->lock(); @@ -246,11 +270,6 @@ void manager() } } - /* Initialize signals and alarm-infrastructure. */ - - sigset_t mask; - set_signals(&mask); - /* create the listener */ { pthread_t listener_thd_id; diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 31ce5b00190..07a1fd3e932 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -114,7 +114,6 @@ static const int ANGEL_PID_FILE_SUFFIX_LEN= strlen(ANGEL_PID_FILE_SUFFIX); */ enum options { - OPT_PASSWD= 'P', OPT_USERNAME= 'u', OPT_PASSWORD= 'p', OPT_LOG= 256, @@ -135,6 +134,7 @@ enum options { OPT_PORT, OPT_WAIT_TIMEOUT, OPT_BIND_ADDRESS, + OPT_PRINT_PASSWORD_LINE, OPT_ADD_USER, OPT_DROP_USER, OPT_EDIT_USER, @@ -225,8 +225,8 @@ static struct my_option my_long_options[] = (gptr *) &Options::Main::mysqld_safe_compatible, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 }, - { "passwd", OPT_PASSWD, - "Prepare an entry for the password file and exit.", + { "print-password-line", OPT_PRINT_PASSWORD_LINE, + "Print out a user entry as a line for the password file and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "password", OPT_PASSWORD, "Password to update the password file", @@ -339,7 +339,7 @@ get_one_option(int optid, case 'V': version(); exit(0); - case OPT_PASSWD: + case OPT_PRINT_PASSWORD_LINE: case OPT_ADD_USER: case OPT_DROP_USER: case OPT_EDIT_USER: @@ -354,8 +354,8 @@ get_one_option(int optid, } switch (optid) { - case OPT_PASSWD: - Options::User_management::cmd= new Passwd_cmd(); + case OPT_PRINT_PASSWORD_LINE: + Options::User_management::cmd= new Print_password_line_cmd(); break; case OPT_ADD_USER: Options::User_management::cmd= new Add_user_cmd(); diff --git a/server-tools/instance-manager/priv.cc b/server-tools/instance-manager/priv.cc index d3cc52ec638..3dae900d84b 100644 --- a/server-tools/instance-manager/priv.cc +++ b/server-tools/instance-manager/priv.cc @@ -43,7 +43,7 @@ bool linuxthreads; The following string must be less then 80 characters, as mysql_connection.cc relies on it */ -const LEX_STRING mysqlmanager_version= { C_STRING_WITH_SIZE("1.0-beta") }; +const LEX_STRING mysqlmanager_version= { C_STRING_WITH_LEN("1.0-beta") }; const unsigned char protocol_version= PROTOCOL_VERSION; diff --git a/server-tools/instance-manager/user_management_commands.cc b/server-tools/instance-manager/user_management_commands.cc index 03a3f9814e3..20ebeb0d6bf 100644 --- a/server-tools/instance-manager/user_management_commands.cc +++ b/server-tools/instance-manager/user_management_commands.cc @@ -180,10 +180,10 @@ static int save_password_file(User_map *user_map) } /************************************************************************* - Passwd_cmd + Print_password_line_cmd *************************************************************************/ -int Passwd_cmd::execute() +int Print_password_line_cmd::execute() { LEX_STRING user_name; const char *password; diff --git a/server-tools/instance-manager/user_management_commands.h b/server-tools/instance-manager/user_management_commands.h index 4bf3546f0a6..8d820be5ec7 100644 --- a/server-tools/instance-manager/user_management_commands.h +++ b/server-tools/instance-manager/user_management_commands.h @@ -61,13 +61,14 @@ public: /************************************************************************* - Passwd_cmd: support for --passwd command-line option. + Print_password_line_cmd: support for --print-password-line command-line + option. *************************************************************************/ -class Passwd_cmd : public User_management_cmd +class Print_password_line_cmd : public User_management_cmd { public: - Passwd_cmd() + Print_password_line_cmd() { } public: diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 2d623702670..7afa2852e1a 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -735,7 +735,7 @@ int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg) ha_ndbcluster *ha= (ha_ndbcluster *)arg; int ret= get_ndb_blobs_value(ha->table, ha->m_value, ha->m_blobs_buffer, ha->m_blobs_buffer_size, - 0); + ha->m_blobs_offset); DBUG_RETURN(ret); } @@ -864,6 +864,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, if (ndb_blob != NULL) { // Set callback + m_blobs_offset= buf - (byte*) table->record[0]; void *arg= (void *)this; DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0); } @@ -5477,6 +5478,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE_SHARE *table_arg): m_ops_pending(0), m_skip_auto_increment(TRUE), m_blobs_pending(0), + m_blobs_offset(0), m_blobs_buffer(0), m_blobs_buffer_size(0), m_dupkey((uint) -1), @@ -10364,7 +10366,7 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, table->field[c++]->set_null(); // DELETED_ROWS table->field[c++]->set_null(); // UPDATE_COUNT table->field[c++]->store(lfg.getUndoFreeWords()); // FREE_EXTENTS - table->field[c++]->store(lfg.getUndoBufferSize()); // TOTAL_EXTENTS + table->field[c++]->store(uf.getSize()/4); // TOTAL_EXTENTS table->field[c++]->store(4); // EXTENT_SIZE table->field[c++]->store(uf.getSize()); // INITIAL_SIZE @@ -10394,8 +10396,8 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, table->field[c++]->store("NORMAL", 6, system_charset_info); - char extra[30]; - int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u",id); + char extra[100]; + int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize()); table->field[c]->store(extra, len, system_charset_info); schema_table_store_record(thd, table); } diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 9bcc549cb60..df3c5791713 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -798,7 +798,6 @@ private: int get_ndb_value(NdbOperation*, Field *field, uint fieldnr, byte*); int get_ndb_partition_id(NdbOperation *); friend int g_get_ndb_blobs_value(NdbBlob *ndb_blob, void *arg); - int get_ndb_blobs_value(NdbBlob *last_ndb_blob); int set_primary_key(NdbOperation *op, const byte *key); int set_primary_key_from_record(NdbOperation *op, const byte *record); int set_index_key_from_record(NdbOperation *op, const byte *record, @@ -883,6 +882,7 @@ private: ha_rows m_ops_pending; bool m_skip_auto_increment; bool m_blobs_pending; + my_ptrdiff_t m_blobs_offset; // memory for blobs in one tuple char *m_blobs_buffer; uint32 m_blobs_buffer_size; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f2d7191f130..75e2720c13a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6156,7 +6156,8 @@ The minimum value for this variable is 4096.", "Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.", (gptr*) &global_system_variables.read_buff_size, (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, + 0}, {"read_only", OPT_READONLY, "Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege", (gptr*) &opt_readonly, @@ -6167,12 +6168,12 @@ The minimum value for this variable is 4096.", (gptr*) &global_system_variables.read_rnd_buff_size, (gptr*) &max_system_variables.read_rnd_buff_size, 0, GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD, - ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, {"record_buffer", OPT_RECORD_BUFFER, "Alias for read_buffer_size", (gptr*) &global_system_variables.read_buff_size, (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0}, + 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, SSIZE_MAX, MALLOC_OVERHEAD, IO_SIZE, 0}, #ifdef HAVE_REPLICATION {"relay_log_purge", OPT_RELAY_LOG_PURGE, "0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.", diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index aea9aba41ec..4c2c0099908 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1083,16 +1083,19 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) to convert the latter operation internally to an UPDATE. We also should not perform this conversion if we have timestamp field with ON UPDATE which is different from DEFAULT. + Another case when conversion should not be performed is when + we have ON DELETE trigger on table so user may notice that + we cheat here. Note that it is ok to do such conversion for + tables which have ON UPDATE but have no ON DELETE triggers, + we just should not expose this fact to users by invoking + ON UPDATE triggers. */ if (last_uniq_key(table,key_nr) && !table->file->referenced_by_foreign_key() && (table->timestamp_field_type == TIMESTAMP_NO_AUTO_SET || - table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH)) + table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH) && + (!table->triggers || !table->triggers->has_delete_triggers())) { - if (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, - TRG_ACTION_BEFORE, TRUE)) - goto before_trg_err; if (thd->clear_next_insert_id) { /* Reset auto-increment cacheing if we do an update */ @@ -1103,13 +1106,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) table->record[0]))) goto err; info->deleted++; - trg_error= (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, - TRG_ACTION_AFTER, - TRUE)); - /* Update logfile and count */ - info->copied++; - goto ok_or_after_trg_err; + /* + Since we pretend that we have done insert we should call + its after triggers. + */ + goto after_trg_n_copied_inc; } else { @@ -1133,10 +1134,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) } } } - info->copied++; - trg_error= (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_INSERT, - TRG_ACTION_AFTER, TRUE)); /* Restore column maps if they where replaced during an duplicate key problem. @@ -1151,14 +1148,14 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE)) goto err; table->file->restore_auto_increment(); + goto ok_or_after_trg_err; } - else - { - info->copied++; - trg_error= (table->triggers && - table->triggers->process_triggers(thd, TRG_EVENT_INSERT, - TRG_ACTION_AFTER, TRUE)); - } + +after_trg_n_copied_inc: + info->copied++; + trg_error= (table->triggers && + table->triggers->process_triggers(thd, TRG_EVENT_INSERT, + TRG_ACTION_AFTER, TRUE)); ok_or_after_trg_err: if (key) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index dc598b786d5..9fc19c5b135 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -438,6 +438,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, uint col_access=thd->col_access; #endif TABLE_LIST table_list; + char tbbuff[FN_REFLEN]; DBUG_ENTER("mysql_find_files"); if (wild && !wild[0]) @@ -454,6 +455,8 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, DBUG_RETURN(-1); } + VOID(tablename_to_filename(tmp_file_prefix, tbbuff, sizeof(tbbuff))); + for (i=0 ; i < (uint) dirp->number_off_files ; i++) { char uname[NAME_LEN*3+1]; /* Unencoded name */ @@ -491,7 +494,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, { // Return only .frm files which aren't temp files. if (my_strcasecmp(system_charset_info, ext=fn_rext(file->name),reg_ext) || - is_prefix(file->name,tmp_file_prefix)) + is_prefix(file->name,tbbuff)) continue; *ext=0; VOID(filename_to_tablename(file->name, uname, sizeof(uname))); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e917c1358ef..da529cc0070 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -985,7 +985,12 @@ reopen_tables: } } } - + /* + Set exclude_from_table_unique_test value back to FALSE. It is needed for + further check in multi_update::prepare whether to use record cache. + */ + lex->select_lex.exclude_from_table_unique_test= FALSE; + if (thd->fill_derived_tables() && mysql_handle_derived(lex, &mysql_derived_filling)) DBUG_RETURN(TRUE); @@ -1164,7 +1169,7 @@ int multi_update::prepare(List ¬_used_values, for (table_ref= leaves; table_ref; table_ref= table_ref->next_leaf) { TABLE *table=table_ref->table; - if (!(tables_to_update & table->map) && + if ((tables_to_update & table->map) && unique_table(thd, table_ref, update_tables)) table->no_cache= 1; // Disable row cache } diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 38ac744d4a8..adc3f351dc8 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -111,6 +111,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) { byte *doc=*start; + int ctype; uint mwc, length, mbl; param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0); @@ -119,9 +120,11 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, while (doc 0 ? mbl : 1)) { - if (true_word_char(cs,*doc)) break; + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) + break; if (*doc == FTB_RQUOT && param->quot) { param->quot=doc; @@ -155,14 +158,16 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end, } mwc=length=0; - for (word->pos=doc; docpos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : 1)) + { + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) mwc=0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; - + } param->prev='A'; /* be sure *prev is true_word_char */ word->len= (uint)(doc-word->pos) - mwc; if ((param->trunc=(doc 0 ? mbl : 1)) { - if (doc >= end) DBUG_RETURN(0); - if (true_word_char(cs, *doc)) break; + if (doc >= end) + DBUG_RETURN(0); + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) + break; } mwc= length= 0; - for (word->pos=doc; docpos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : 1)) + { + mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); + if (true_word_char(ctype, *doc)) mwc= 0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; + } word->len= (uint)(doc-word->pos) - mwc; diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index 08d605dbcc2..7a0876ce5a4 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -174,11 +174,6 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) FT_SEG_ITERATOR ftsi1, ftsi2; CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset; DBUG_ENTER("_mi_ft_cmp"); -#ifndef MYSQL_HAS_TRUE_CTYPE_IMPLEMENTATION - if (cs->mbmaxlen > 1) - DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT); -#endif - _mi_ft_segiterator_init(info, keynr, rec1, &ftsi1); _mi_ft_segiterator_init(info, keynr, rec2, &ftsi2); diff --git a/storage/myisam/ftdefs.h b/storage/myisam/ftdefs.h index 108faf4f1a3..3c5b9d9e608 100644 --- a/storage/myisam/ftdefs.h +++ b/storage/myisam/ftdefs.h @@ -24,9 +24,10 @@ #include #include -#define true_word_char(s,X) (my_isalnum(s,X) || (X)=='_') +#define true_word_char(ctype, character) \ + ((ctype) & (_MY_U | _MY_L | _MY_NMR) || \ + (character) == '_') #define misc_word_char(X) 0 -#define word_char(s,X) (true_word_char(s,X) || misc_word_char(X)) #define FT_MAX_WORD_LEN_FOR_SORT 31 diff --git a/storage/ndb/Makefile.am b/storage/ndb/Makefile.am index 287368c5ae7..0b99ca39114 100644 --- a/storage/ndb/Makefile.am +++ b/storage/ndb/Makefile.am @@ -20,7 +20,8 @@ dist-hook: done windoze: - for i in `find . -name 'Makefile.am'`; do make -C `dirname $$i` windoze-dsp; done + for i in `find . -name 'old_dirs' -prune -o -name 'Makefile.am' -print`; \ + do make -C `dirname $$i` windoze-dsp; done windoze-dsp: diff --git a/storage/ndb/include/mgmapi/ndbd_exit_codes.h b/storage/ndb/include/mgmapi/ndbd_exit_codes.h index 686641ebef5..b16f1a63a8d 100644 --- a/storage/ndb/include/mgmapi/ndbd_exit_codes.h +++ b/storage/ndb/include/mgmapi/ndbd_exit_codes.h @@ -77,6 +77,7 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification; #define NDBD_EXIT_SR_RESTARTCONFLICT 2311 #define NDBD_EXIT_NO_MORE_UNDOLOG 2312 #define NDBD_EXIT_SR_UNDOLOG 2313 +#define NDBD_EXIT_SR_SCHEMAFILE 2310 #define NDBD_EXIT_MEMALLOC 2327 #define NDBD_EXIT_BLOCK_JBUFCONGESTION 2334 #define NDBD_EXIT_TIME_QUEUE_SHORT 2335 @@ -91,6 +92,9 @@ typedef ndbd_exit_classification_enum ndbd_exit_classification; #define NDBD_EXIT_INVALID_CONFIG 2350 #define NDBD_EXIT_OUT_OF_LONG_SIGNAL_MEMORY 2351 +/* Errorcodes for fatal resource errors */ +#define NDBD_EXIT_RESOURCE_ALLOC_ERROR 2500 + #define NDBD_EXIT_OS_SIGNAL_RECEIVED 6000 /* VM 6050-> */ diff --git a/storage/ndb/include/util/ConfigValues.hpp b/storage/ndb/include/util/ConfigValues.hpp index 457488e3c42..8dfb3c83df3 100644 --- a/storage/ndb/include/util/ConfigValues.hpp +++ b/storage/ndb/include/util/ConfigValues.hpp @@ -96,6 +96,7 @@ public: public: ConfigValuesFactory(Uint32 keys = 50, Uint32 data = 10); // Initial ConfigValuesFactory(ConfigValues * m_cfg); // + ~ConfigValuesFactory(); ConfigValues * m_cfg; ConfigValues * getConfigValues(); diff --git a/storage/ndb/src/common/transporter/TransporterRegistry.cpp b/storage/ndb/src/common/transporter/TransporterRegistry.cpp index 633cfeb0ac2..458f7c4f47e 100644 --- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp +++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp @@ -1319,7 +1319,7 @@ TransporterRegistry::start_clients_thread() else { ndbout_c("Management server closed connection early. " - "It is probably being shut down (or has crashed). " + "It is probably being shut down (or has problems). " "We will retry the connection."); } } diff --git a/storage/ndb/src/common/util/ConfigValues.cpp b/storage/ndb/src/common/util/ConfigValues.cpp index 5c4b17c73ca..ae4fbfd2f71 100644 --- a/storage/ndb/src/common/util/ConfigValues.cpp +++ b/storage/ndb/src/common/util/ConfigValues.cpp @@ -294,6 +294,12 @@ ConfigValuesFactory::ConfigValuesFactory(ConfigValues * cfg){ } } +ConfigValuesFactory::~ConfigValuesFactory() +{ + if(m_cfg) + free(m_cfg); +} + ConfigValues * ConfigValuesFactory::create(Uint32 keys, Uint32 data){ Uint32 sz = sizeof(ConfigValues); @@ -528,7 +534,7 @@ ConfigValuesFactory::extractCurrentSection(const ConfigValues::ConstIterator & c } } - ConfigValues * ret = fac->m_cfg; + ConfigValues * ret = fac->getConfigValues(); delete fac; return ret; } diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index ef08c06822f..e9d2fce5e18 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -1355,10 +1355,11 @@ void Dbdict::readSchemaConf(Signal* signal, sf->FileSize == sf0->FileSize && sf->PageNumber == n && computeChecksum((Uint32*)sf, NDB_SF_PAGE_SIZE_IN_WORDS) == 0; - ndbrequire(ok || !crashInd); + ndbrequireErr(ok || !crashInd, NDBD_EXIT_SR_SCHEMAFILE); if (! ok) { jam(); - ndbrequire(fsPtr.p->fsState == FsConnectRecord::READ_SCHEMA1); + ndbrequireErr(fsPtr.p->fsState == FsConnectRecord::READ_SCHEMA1, + NDBD_EXIT_SR_SCHEMAFILE); readSchemaRef(signal, fsPtr); return; } diff --git a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index bb4c2ed197e..dc93dca4e46 100644 --- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -8606,7 +8606,7 @@ Dbdih::resetReplicaSr(TabRecordPtr tabPtr){ *--------_----------------------------------------------------- */ const Uint32 nextCrashed = noCrashedReplicas + 1; replicaPtr.p->noCrashedReplicas = nextCrashed; - arrGuard(nextCrashed, 8); + arrGuardErr(nextCrashed, 8, NDBD_EXIT_MAX_CRASHED_REPLICAS); replicaPtr.p->createGci[nextCrashed] = newestRestorableGCI + 1; ndbrequire(newestRestorableGCI + 1 != 0xF1F1F1F1); replicaPtr.p->replicaLastGci[nextCrashed] = (Uint32)-1; diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 53cf5c06fe4..bdd19839a02 100644 --- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -17839,7 +17839,8 @@ void Dblqh::stepAhead(Signal* signal, Uint32 stepAheadWords) logFilePtr.p->currentLogpage = logPagePtr.p->logPageWord[ZNEXT_PAGE]; logPagePtr.i = logPagePtr.p->logPageWord[ZNEXT_PAGE]; logFilePtr.p->currentFilepage++; - ptrCheckGuard(logPagePtr, clogPageFileSize, logPageRecord); + ptrCheckGuardErr(logPagePtr, clogPageFileSize, logPageRecord, + NDBD_EXIT_SR_REDOLOG); logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX] = ZPAGE_HEADER_SIZE; logPartPtr.p->execSrPagesRead--; logPartPtr.p->execSrPagesExecuted++; diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index 91f0fab06f8..686ae476879 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -410,7 +410,22 @@ Suma::createSequenceReply(Signal* signal, jam(); if (ref != NULL) + { + switch ((UtilSequenceRef::ErrorCode)ref->errorCode) + { + case UtilSequenceRef::NoSuchSequence: + ndbrequire(false); + case UtilSequenceRef::TCError: + { + char buf[128]; + snprintf(buf, sizeof(buf), + "Startup failed during sequence creation. TC error %d", + ref->TCErrorCode); + progError(__LINE__, NDBD_EXIT_RESOURCE_ALLOC_ERROR, buf); + } + } ndbrequire(false); + } sendSTTORRY(signal); } diff --git a/storage/ndb/src/kernel/error/ndbd_exit_codes.c b/storage/ndb/src/kernel/error/ndbd_exit_codes.c index 6a14d8b7ffd..172125c35a1 100644 --- a/storage/ndb/src/kernel/error/ndbd_exit_codes.c +++ b/storage/ndb/src/kernel/error/ndbd_exit_codes.c @@ -51,14 +51,16 @@ static const ErrStruct errArray[] = {NDBD_EXIT_SYSTEM_ERROR, XIE, "System error, node killed during node restart by other node"}, {NDBD_EXIT_INDEX_NOTINRANGE, XIE, "Array index out of range"}, - {NDBD_EXIT_ARBIT_SHUTDOWN, XAE, "Arbitrator shutdown, " - "please investigate error(s) on other node(s)"}, + {NDBD_EXIT_ARBIT_SHUTDOWN, XAE, "Node lost connection to other nodes and " + "can not form a unpartitioned cluster, please investigate if there are " + "error(s) on other node(s)"}, {NDBD_EXIT_POINTER_NOTINRANGE, XIE, "Pointer too large"}, {NDBD_EXIT_SR_OTHERNODEFAILED, XRE, "Another node failed during system " "restart, please investigate error(s) on other node(s)"}, {NDBD_EXIT_NODE_NOT_DEAD, XRE, "Internal node state conflict, " "most probably resolved by restarting node again"}, {NDBD_EXIT_SR_REDOLOG, XFI, "Error while reading the REDO log"}, + {NDBD_EXIT_SR_SCHEMAFILE, XFI, "Error while reading the schema file"}, /* Currently unused? */ {2311, XIE, "Conflict when selecting restart type"}, {NDBD_EXIT_NO_MORE_UNDOLOG, XCR, @@ -80,6 +82,10 @@ static const ErrStruct errArray[] = /* this error message is complemented by additional info when generated */ {NDBD_EXIT_INVALID_CONFIG, XCE, "Invalid configuration received from Management Server"}, + + {NDBD_EXIT_RESOURCE_ALLOC_ERROR, XCE, + "Resource allocation error, please review the configuration"}, + /* this error message is complemented by additional info when generated, such as signal, and text */ @@ -94,7 +100,7 @@ static const ErrStruct errArray[] = {NDBD_EXIT_WATCHDOG_TERMINATE, XIE, "WatchDog terminate, internal error " "or massive overload on the machine running this node"}, {NDBD_EXIT_SIGNAL_LOST_SEND_BUFFER_FULL, XCR, - "Signal lost, out of send buffer memory, please increase SendBufferMemory"}, + "Signal lost, out of send buffer memory, please increase SendBufferMemory or lower the load"}, {NDBD_EXIT_SIGNAL_LOST, XIE, "Signal lost (unknown reason)"}, {NDBD_EXIT_ILLEGAL_SIGNAL, XIE, "Illegal signal (version mismatch a possibility)"}, diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp index f184f089f2d..43021a8d669 100644 --- a/storage/ndb/src/mgmapi/mgmapi.cpp +++ b/storage/ndb/src/mgmapi/mgmapi.cpp @@ -1924,7 +1924,7 @@ ndb_mgm_get_configuration(NdbMgmHandle handle, unsigned int version) { } delete prop; - return (ndb_mgm_configuration*)cvf.m_cfg; + return (ndb_mgm_configuration*)cvf.getConfigValues(); } while(0); delete prop; diff --git a/storage/ndb/src/mgmsrv/ConfigInfo.cpp b/storage/ndb/src/mgmsrv/ConfigInfo.cpp index 8705b640809..42776798385 100644 --- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp @@ -2289,11 +2289,11 @@ ConfigInfo::ConfigInfo() if (!m_info.getCopy(param._section, §ion)) { Properties newsection(true); m_info.put(param._section, &newsection); + + // Get copy of section + m_info.getCopy(param._section, §ion); } - - // Get copy of section - m_info.getCopy(param._section, §ion); - + // Create pinfo (parameter info) entry Properties pinfo(true); pinfo.put("Id", param._paramId); @@ -2347,6 +2347,7 @@ ConfigInfo::ConfigInfo() // Replace section with modified section m_info.put(param._section, section, true); + delete section; if(param._type != ConfigInfo::CI_SECTION){ Properties * p; diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c index a867ad7315b..b72ce4bd3c6 100644 --- a/storage/ndb/src/ndbapi/ndberror.c +++ b/storage/ndb/src/ndbapi/ndberror.c @@ -284,6 +284,7 @@ ErrorBundle ErrorCodes[] = { /** * Application error */ + { 763, DMEC, AE, "Alter table requires cluster nodes to have exact same version" }, { 823, DMEC, AE, "Too much attrinfo from application in tuple manager" }, { 831, DMEC, AE, "Too many nullable/bitfields in table definition" }, { 876, DMEC, AE, "876" }, @@ -344,6 +345,7 @@ ErrorBundle ErrorCodes[] = { /** * SchemaError */ + { 311, DMEC, AE, "Undefined partition used in setPartitionId" }, { 703, DMEC, SE, "Invalid table format" }, { 704, DMEC, SE, "Attribute name too long" }, { 705, DMEC, SE, "Table name too long" }, diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 01746d3156e..4fb271c6c02 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -221,7 +221,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --prefix=/ \ --with-extra-charsets=all \ %if %{YASSL_BUILD} - --with-yassl \ + --with-ssl \ %endif --exec-prefix=%{_exec_prefix} \ --libexecdir=%{_sbindir} \ @@ -235,6 +235,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --enable-thread-safe-client \ --with-readline \ " + make } # Use our own copy of glibc @@ -350,6 +351,7 @@ BuildMySQL "--enable-shared \ --with-example-storage-engine \ --with-blackhole-storage-engine \ --with-federated-storage-engine \ + --with-embedded-server \ --with-big-tables \ --with-comment=\"MySQL Community Server (GPL)\"") @@ -389,10 +391,10 @@ install -d $RBR%{_sbindir} mv $RBR/%{_libdir}/mysql/*.so* $RBR/%{_libdir}/ # install "mysqld-debug" and "mysqld-max" -./libtool --mode=execute install -m 755 \ +$MBD/libtool --mode=execute install -m 755 \ $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/mysqld \ $RBR%{_sbindir}/mysqld-debug -./libtool --mode=execute install -m 755 \ +$MBD/libtool --mode=execute install -m 755 \ $RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-max-%{mysql_version}/sql/mysqld \ $RBR%{_sbindir}/mysqld-max @@ -404,16 +406,12 @@ install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate. install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql # Install embedded server library in the build root -install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql/ +install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/ # Create a symlink "rcmysql", pointing to the init.script. SuSE users # will appreciate that, as all services usually offer this. ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql -# Create symbolic compatibility link safe_mysqld -> mysqld_safe -# (safe_mysqld will be gone in MySQL 4.1) -ln -sf ./mysqld_safe $RBR%{_bindir}/safe_mysqld - # Touch the place where the my.cnf config file and mysqlmanager.passwd # (MySQL Instance Manager password file) might be located # Just to make sure it's in the file list and marked as a config file @@ -480,7 +478,7 @@ chmod -R og-rw $mysql_datadir/mysql # Restart in the same way that mysqld will be started normally. %{_sysconfdir}/init.d/mysql start -# Allow safe_mysqld to start mysqld and print a message before we exit +# Allow mysqld_safe to start mysqld and print a message before we exit sleep 2 @@ -542,7 +540,6 @@ fi %doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* %doc %attr(644, root, man) %{_mandir}/man1/perror.1* %doc %attr(644, root, man) %{_mandir}/man1/replace.1* -%doc %attr(644, root, man) %{_mandir}/man1/safe_mysqld.1* %ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf %ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd @@ -571,7 +568,6 @@ fi %attr(755, root, root) %{_bindir}/replace %attr(755, root, root) %{_bindir}/resolve_stack_dump %attr(755, root, root) %{_bindir}/resolveip -%attr(755, root, root) %{_bindir}/safe_mysqld %attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_sbindir}/mysqld-debug