diff options
124 files changed, 801 insertions, 660 deletions
diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 553df39191f..7619224314b 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -19,8 +19,23 @@ if test -r /proc/cpuinfo ; then if test -z "$model_name" ; then model_name=`uname -m` fi +else + # Fallback when there is no /proc/cpuinfo + case "`uname -s`" in + FreeBSD) + cpu_family=`uname -m`; + model_name=`sysctl -b hw.model` + ;; + *) + cpu_family=`uname -m`; + model_name="unknown"; + ;; + esac fi +cpu_flag="" +cpu_flag_old="" + case "$cpu_family--$model_name" in Alpha*EV6*) cpu_flag="ev6"; @@ -28,11 +43,25 @@ case "$cpu_family--$model_name" in *Xeon*) cpu_flag="nocona"; ;; + *Pentium*4*Mobile*CPU*) + cpu_flag="pentium4m"; + ;; *Pentium*4*CPU*) cpu_flag="pentium4"; ;; + *Pentium*III*Mobile*CPU*) + cpu_flag="pentium3m"; + ;; + *Pentium*III*CPU*) + cpu_flag="pentium3"; + ;; + *Pentium*M*pro*) + cpu_flag="pentium-m"; + cpu_flag_old="pentium"; + ;; *Athlon*64*) cpu_flag="athlon64"; + cpu_flag_old="athlon"; ;; *Athlon*) cpu_flag="athlon"; @@ -72,6 +101,10 @@ case "$cc_ver--$cc_verno" in check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag" ;; *GCC*) + # Fix for older compiler versions + if test -n "$cpu_flag_old"; then + cpu_flag="$cpu_flag_old" + fi check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag" ;; *) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 7c177f54258..39095f59ffa 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -18,12 +18,17 @@ autoconf # Default to gcc for CC and CXX if test -z "$CXX" ; then export CXX=gcc + # Set some required compile options + if test -z "$CXXFLAGS" ; then + export CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" + fi fi if test -z "$CC" ; then export CC=gcc fi + # Use ccache, if available if ccache -V > /dev/null 2>&1 then diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 1323f7a72f1..246de2fffa2 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -48,6 +48,7 @@ dlenev@mysql.com ejonore@mc03.ndb.mysql.com evgen@moonbone.(none) evgen@moonbone.local +gbichot@production.mysql.com gbichot@quadita2.mysql.com gbichot@quadxeon.mysql.com georg@beethoven.local @@ -74,6 +75,7 @@ hf@bisonxp.(none) hf@deer.(none) hf@deer.mysql.r18.ru hf@genie.(none) +holyfoot@mysql.com igor@hundin.mysql.fi igor@linux.local igor@rurik.mysql.com @@ -161,6 +163,7 @@ mwagner@cash.mwagner.org mwagner@evoq.mwagner.org mwagner@here.mwagner.org mwagner@mysql.com +mwagner@ultrafly.mysql.com mwagner@work.mysql.com mydev@mysql.com mysql@home.(none) diff --git a/client/client_priv.h b/client/client_priv.h index 95f4d105156..45806349d7d 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -49,5 +49,5 @@ enum options_client #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING #endif - ,OPT_IGNORE_TABLE + ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE }; diff --git a/client/mysqldump.c b/client/mysqldump.c index 2573c812067..67b89ea4bc2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -83,7 +83,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1, opt_autocommit=0,opt_disable_keys=1,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0, - opt_hex_blob=0, opt_order_by_primary=0; + opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, @@ -255,6 +255,9 @@ static struct my_option my_long_options[] = "use the directive multiple times, once for each table. Each table must " "be specified with both database and table names, e.g. --ignore-table=database.table", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.", + (gptr*) &opt_ignore, (gptr*) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + 0, 0}, {"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...", (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1096,13 +1099,15 @@ static uint getTableStructure(char *table, char* db) my_bool init=0; uint numFields; char *strpos, *result_table, *opt_quoted_table; - const char *delayed; + const char *insert_option; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3]; FILE *sql_file = md_result_file; DBUG_ENTER("getTableStructure"); - delayed= opt_delayed ? " DELAYED " : ""; + insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " : + opt_delayed ? " DELAYED " : + opt_ignore ? " IGNORE " : ""; if (verbose) fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); @@ -1177,11 +1182,11 @@ static uint getTableStructure(char *table, char* db) if (cFlag) my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", - delayed, opt_quoted_table); + insert_option, opt_quoted_table); else { my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", - delayed, opt_quoted_table); + insert_option, opt_quoted_table); if (!extended_insert) strcat(insert_pat,"("); } @@ -1245,11 +1250,11 @@ static uint getTableStructure(char *table, char* db) } if (cFlag) my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", - delayed, result_table); + insert_option, result_table); else { my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", - delayed, result_table); + insert_option, result_table); if (!extended_insert) strcat(insert_pat,"("); } diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index 9ff005c7156..03f3eb65fbc 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ - search.h tty.h libedit_term.h + search.h tty.h libedit_term.h vis.h EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c diff --git a/configure.in b/configure.in index 00ec737e76f..a5872a79ae3 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 4.1.12) +AM_INIT_AUTOMAKE(mysql, 4.1.13) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -145,8 +145,11 @@ AC_ARG_WITH(darwin-mwcc, export CC CXX LD AR RANLIB AC_SUBST(AR) AC_SUBST(RANLIB) + with_darwin_mwcc=yes ]) +AM_CONDITIONAL(DARWIN_MWCC, test x$with_darwin_mwcc = xyes) + if test "x${CFLAGS-}" = x ; then cflags_is_set=no else diff --git a/include/my_global.h b/include/my_global.h index 017cdea140a..62c6a5d1e4a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -43,6 +43,11 @@ #define HAVE_ERRNO_AS_DEFINE #endif /* __CYGWIN__ */ +/* Determine when to use "#pragma interface" */ +#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3) +#define USE_PRAGMA_INTERFACE +#endif + #if defined(i386) && !defined(__i386__) #define __i386__ #endif @@ -282,9 +287,15 @@ C_MODE_START int __cxa_pure_virtual() {\ #ifndef CONFIG_SMP #define CONFIG_SMP #endif +#if defined(__ia64__) +#define new my_arg_new +#endif C_MODE_START #include <asm/atomic.h> C_MODE_END +#if defined(__ia64__) +#undef new +#endif #endif #include <errno.h> /* Recommended by debian */ /* We need the following to go around a problem with openssl on solaris */ diff --git a/include/mysql.h b/include/mysql.h index d8a56126756..ab61fe694d9 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -381,6 +381,7 @@ unsigned int STDCALL mysql_warning_count(MYSQL *mysql); const char * STDCALL mysql_info(MYSQL *mysql); unsigned long STDCALL mysql_thread_id(MYSQL *mysql); const char * STDCALL mysql_character_set_name(MYSQL *mysql); +int STDCALL mysql_set_character_set(MYSQL *mysql, char *csname); MYSQL * STDCALL mysql_init(MYSQL *mysql); my_bool STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, diff --git a/include/raid.h b/include/raid.h index 04c54393e54..c840afcbaab 100644 --- a/include/raid.h +++ b/include/raid.h @@ -89,7 +89,7 @@ extern "C" { #ifdef __cplusplus } -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c663dab7476..4c9f06df38e 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1509,6 +1509,36 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql) return mysql->charset->csname; } +int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name) +{ + struct charset_info_st *cs; + const char *save_csdir = charsets_dir; + + if (mysql->options.charset_dir) + charsets_dir = mysql->options.charset_dir; + + if ( (cs = get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))) ) + { + char buff[MY_CS_NAME_SIZE + 10]; + charsets_dir = save_csdir; + sprintf(buff, "SET NAMES %s", cs_name); + if (!mysql_query(mysql, buff)) { + mysql->charset = cs; + } + } else { + char cs_dir_name[FN_REFLEN]; + get_charsets_dir(cs_dir_name); + mysql->net.last_errno=CR_CANT_READ_CHARSET; + strmov(mysql->net.sqlstate, unknown_sqlstate); + my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error)-1, + ER(mysql->net.last_errno), + cs_name, + cs_dir_name); + + } + charsets_dir = save_csdir; + return mysql->net.last_errno; +} uint STDCALL mysql_thread_safe(void) { diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index c5579e9ec2b..57c97ab08ee 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -146,4 +146,5 @@ EXPORTS mysql_rpl_query_type mysql_slave_query mysql_embedded + mysql_set_character_set get_defaults_files diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 4cf2c3f67a7..f578e87ae4a 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -83,6 +83,9 @@ INC_LIB= $(top_builddir)/regex/libregex.a \ # generate a total libmysqld.a from all library files, libmysqld.a: libmysqld_int.a $(INC_LIB) +if DARWIN_MWCC + mwld -lib -o $@ libmysqld_int.a `ls -1 $(INC_LIB) | sort -u` +else if test "$(host_os)" = "netware" ; \ then \ $(libmysqld_a_AR) libmysqld.a libmysqld_int.a $(INC_LIB) ; \ @@ -104,7 +107,7 @@ libmysqld.a: libmysqld_int.a $(INC_LIB) rm -f tmp/* ; \ $(RANLIB) libmysqld.a ; \ fi - +endif ## XXX: any time the client interface changes, we'll need to bump ## the version info for libmysqld; however, it's possible for the diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 123fdbd90bd..103bed598ef 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -552,3 +552,14 @@ NULL 1 Test 0 NULL 1 drop table t1, t2, t3; +create table t1 (b bool not null default false); +create table t2 (b bool not null default true); +insert into t1 values (); +insert into t2 values (); +select * from t1; +b +0 +select * from t2; +b +1 +drop table t1,t2; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 3face9b1ba6..5902dd247ce 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -598,6 +598,24 @@ ucs2_bin 00610009 ucs2_bin 0061 ucs2_bin 00610020 drop table t1; +select hex(substr(_ucs2 0x00e400e50068,1)); +hex(substr(_ucs2 0x00e400e50068,1)) +00E400E50068 +select hex(substr(_ucs2 0x00e400e50068,2)); +hex(substr(_ucs2 0x00e400e50068,2)) +00E50068 +select hex(substr(_ucs2 0x00e400e50068,3)); +hex(substr(_ucs2 0x00e400e50068,3)) +0068 +select hex(substr(_ucs2 0x00e400e50068,-1)); +hex(substr(_ucs2 0x00e400e50068,-1)) +0068 +select hex(substr(_ucs2 0x00e400e50068,-2)); +hex(substr(_ucs2 0x00e400e50068,-2)) +00E50068 +select hex(substr(_ucs2 0x00e400e50068,-3)); +hex(substr(_ucs2 0x00e400e50068,-3)) +00E400E50068 SET NAMES latin1; SET collation_connection='ucs2_swedish_ci'; CREATE TABLE t1 (Field1 int(10) default '0'); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 78c56bffbd3..ffdb7cb0f3d 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -817,6 +817,9 @@ drop table t1; select 'c' like '\_' as want0; want0 0 +SELECT SUBSTR('вася',-2); +SUBSTR('вася',-2) +ся create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci); insert into t1 values (1, 'Test'); select * from t1 where soundex(a) = soundex('Test'); diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result index ff7ec1ba73f..f78372541f2 100644 --- a/mysql-test/r/insert_update.result +++ b/mysql-test/r/insert_update.result @@ -167,3 +167,16 @@ a b c VALUES(a) 2 1 11 NULL DROP TABLE t1; DROP TABLE t2; +create table t1 (a int not null unique); +insert into t1 values (1),(2); +insert ignore into t1 select 1 on duplicate key update a=2; +select * from t1; +a +1 +2 +insert ignore into t1 select a from t1 on duplicate key update a=a+1 ; +select * from t1; +a +1 +3 +drop table t1; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 69ca9486d2f..80c6cad5bbf 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -560,3 +560,63 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; +CREATE TABLE t1 (a decimal(240, 20)); +INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), +("0987654321098765432109876543210987654321"); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` decimal(240,20) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +INSERT IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` decimal(240,20) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT DELAYED IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; diff --git a/mysql-test/r/ps_grant.result b/mysql-test/r/ps_grant.result index 4c60bb03165..0787f30c643 100644 --- a/mysql-test/r/ps_grant.result +++ b/mysql-test/r/ps_grant.result @@ -1,7 +1,3 @@ -prepare stmt4 from ' show full processlist '; -execute stmt4; -Id User Host db Command Time State Info -number root localhost test Query time NULL show full processlist test_sequence ------ grant/revoke/drop affects a parallel session test ------ show grants for second_user@localhost ; @@ -79,3 +75,7 @@ commit ; show grants for second_user@localhost ; ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost' drop database mysqltest; +prepare stmt4 from ' show full processlist '; +execute stmt4; +Id User Host db Command Time State Info +number root localhost test Query time NULL show full processlist diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 9df5efc66d6..50300ed9b76 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2445,3 +2445,13 @@ cast((a - b) as unsigned) 1 18446744073709551615 drop table t1; +create table t1 (a int(11)); +select all all * from t1; +a +select distinct distinct * from t1; +a +select all distinct * from t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'distinct * from t1' at line 1 +select distinct all * from t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'all * from t1' at line 1 +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 6f222eedec1..ce85e530569 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -449,3 +449,14 @@ INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13: CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id; SELECT * FROM t3; drop table t1, t2, t3; + +# +# Bug#9666: Can't use 'DEFAULT FALSE' for column of type bool +# +create table t1 (b bool not null default false); +create table t2 (b bool not null default true); +insert into t1 values (); +insert into t2 values (); +select * from t1; +select * from t2; +drop table t1,t2; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index db5b13cf1b4..6c72c409463 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -374,6 +374,16 @@ SET NAMES latin1; SET collation_connection='ucs2_bin'; -- source include/ctype_filesort.inc +# +# Bug#10344 Some string functions fail for UCS2 +# +select hex(substr(_ucs2 0x00e400e50068,1)); +select hex(substr(_ucs2 0x00e400e50068,2)); +select hex(substr(_ucs2 0x00e400e50068,3)); +select hex(substr(_ucs2 0x00e400e50068,-1)); +select hex(substr(_ucs2 0x00e400e50068,-2)); +select hex(substr(_ucs2 0x00e400e50068,-3)); + SET NAMES latin1; # # Bug#8235 diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 194354f8718..02024adb34e 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -667,6 +667,12 @@ drop table t1; select 'c' like '\_' as want0; # +# SUBSTR with negative offset didn't work with multi-byte strings +# +SELECT SUBSTR('вася',-2); + + +# # Bug #7730 Server crash using soundex on an utf8 table # create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci); diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 188de8a5379..0fa366586b3 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -80,3 +80,15 @@ INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); SELECT *, VALUES(a) FROM t1; DROP TABLE t1; DROP TABLE t2; + +# +# Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update" +# INSERT INGORE...UPDATE gives bad error or breaks protocol. +# +create table t1 (a int not null unique); +insert into t1 values (1),(2); +insert ignore into t1 select 1 on duplicate key update a=2; +select * from t1; +insert ignore into t1 select a from t1 on duplicate key update a=a+1 ; +select * from t1; +drop table t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index c321fb9c6b7..b89b482a0f9 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -185,3 +185,13 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A); --exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 DROP TABLE t1; +# +# Test for --insert-ignore +# + +CREATE TABLE t1 (a decimal(240, 20)); +INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), +("0987654321098765432109876543210987654321"); +--exec $MYSQL_DUMP --insert-ignore --skip-comments test t1 +--exec $MYSQL_DUMP --insert-ignore --skip-comments --delayed-insert test t1 +DROP TABLE t1; diff --git a/mysql-test/t/ps_grant.test b/mysql-test/t/ps_grant.test index 06613072824..d6448dd152a 100644 --- a/mysql-test/t/ps_grant.test +++ b/mysql-test/t/ps_grant.test @@ -1,10 +1,6 @@ # Can't test grants with embedded server -- source include/not_embedded.inc -# Tested here simply so it is not tested with embedded server -prepare stmt4 from ' show full processlist '; ---replace_column 1 number 6 time 3 localhost -execute stmt4; let $type= 'MYISAM' ; @@ -116,4 +112,9 @@ show grants for second_user@localhost ; drop database mysqltest; +# Tested here simply so it is not tested with embedded server +prepare stmt4 from ' show full processlist '; +--replace_column 1 number 6 time 3 localhost +execute stmt4; + diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 3d3d4748fe3..8c27d876bc8 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc + # # Problem with range optimizer # @@ -448,6 +450,7 @@ explain select * from t1 where a='aaa' collate latin1_german1_ci; drop table t1; # Test for BUG#9348 "result for WHERE A AND (B OR C) differs from WHERE a AND (C OR B)" +--disable_warnings CREATE TABLE t1 ( `CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', `ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '', @@ -456,6 +459,7 @@ CREATE TABLE t1 ( `FUNCTINT` int(11) NOT NULL default '0', KEY `VERI_CLNT~2` (`ARG1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +--enable_warnings INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0), ('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0), diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index f58a78205ec..6d6d5f6b6e1 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1979,3 +1979,19 @@ select a-b , (a-b < 0) from t1 order by 1; select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0; select cast((a - b) as unsigned) from t1 order by 1; drop table t1; + + +# +# Bug#8733 server accepts malformed query (multiply mentioned distinct) +# +create table t1 (a int(11)); +select all all * from t1; +select distinct distinct * from t1; +--error 1064 +select all distinct * from t1; +--error 1064 +select distinct all * from t1; +drop table t1; + + +# diff --git a/ndb/src/cw/cpcd/APIService.cpp b/ndb/src/cw/cpcd/APIService.cpp index 63d0aaafe86..b009f0c0fc4 100644 --- a/ndb/src/cw/cpcd/APIService.cpp +++ b/ndb/src/cw/cpcd/APIService.cpp @@ -122,6 +122,7 @@ ParserRow<CPCDAPISession> commands[] = CPCD_ARG("stderr", String, Optional, "Redirection of stderr"), CPCD_ARG("stdin", String, Optional, "Redirection of stderr"), CPCD_ARG("ulimit", String, Optional, "ulimit"), + CPCD_ARG("shutdown", String, Optional, "shutdown options"), CPCD_CMD("undefine process", &CPCDAPISession::undefineProcess, ""), CPCD_CMD_ALIAS("undef", "undefine process", 0), diff --git a/ndb/src/cw/cpcd/CPCD.hpp b/ndb/src/cw/cpcd/CPCD.hpp index a5c0bef1dac..aecc43150c4 100644 --- a/ndb/src/cw/cpcd/CPCD.hpp +++ b/ndb/src/cw/cpcd/CPCD.hpp @@ -243,6 +243,12 @@ public: * @desc Format c:unlimited d:0 ... */ BaseString m_ulimit; + + /** + * @brief shutdown options + */ + BaseString m_shutdown_options; + private: class CPCD *m_cpcd; void do_exec(); diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index 2509f34e882..cfffec7d0ce 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -44,6 +44,8 @@ CPCD::Process::print(FILE * f){ fprintf(f, "stdout: %s\n", m_stdout.c_str() ? m_stdout.c_str() : ""); fprintf(f, "stderr: %s\n", m_stderr.c_str() ? m_stderr.c_str() : ""); fprintf(f, "ulimit: %s\n", m_ulimit.c_str() ? m_ulimit.c_str() : ""); + fprintf(f, "shutdown: %s\n", m_shutdown_options.c_str() ? + m_shutdown_options.c_str() : ""); } CPCD::Process::Process(const Properties & props, class CPCD *cpcd) { @@ -64,6 +66,7 @@ CPCD::Process::Process(const Properties & props, class CPCD *cpcd) { props.get("stdout", m_stdout); props.get("stderr", m_stderr); props.get("ulimit", m_ulimit); + props.get("shutdown", m_shutdown_options); m_status = STOPPED; if(strcasecmp(m_type.c_str(), "temporary") == 0){ @@ -220,8 +223,11 @@ set_ulimit(const BaseString & pair){ if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } - +#if defined(__INTEL_COMPILER) + struct rlimit64 rlp; +#else struct rlimit rlp; +#endif #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} if(list[0].trim() == "c"){ @@ -451,7 +457,11 @@ CPCD::Process::stop() { m_status = STOPPING; errno = 0; - int ret = kill(-m_pid, SIGTERM); + int signo= SIGTERM; + if(m_shutdown_options == "SIGKILL") + signo= SIGKILL; + + int ret = kill(-m_pid, signo); switch(ret) { case 0: logger.debug("Sent SIGTERM to pid %d", (int)-m_pid); diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 184db794057..0c4d20ca248 100644 --- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -4043,12 +4043,14 @@ calcLHbits(Uint32 * lhPageBits, Uint32 * lhDistrBits, tmp <<= 1; distrBits++; }//while +#ifdef ndb_classical_lhdistrbits if (tmp != totalFragments) { tmp >>= 1; if ((fid >= (totalFragments - tmp)) && (fid < (tmp - 1))) { distrBits--; }//if }//if +#endif * lhPageBits = pageBits; * lhDistrBits = distrBits; diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp index fb90ccc8c90..fbd181cae24 100644 --- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp +++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp @@ -585,34 +585,8 @@ public: */ ArrayPool<TcIndexOperation> c_theIndexOperationPool; - /** - * The list of index operations - */ - ArrayList<TcIndexOperation> c_theIndexOperations; - UintR c_maxNumberOfIndexOperations; - struct TcSeizedIndexOperation { - /** - * Next ptr (used in pool/list) - */ - union { - Uint32 nextPool; - Uint32 nextList; - }; - /** - * Prev pointer (used in list) - */ - Uint32 prevList; - }; - - /** - * Pool of seized index operations - */ - ArrayPool<TcSeizedIndexOperation> c_theSeizedIndexOperationPool; - - typedef Ptr<TcSeizedIndexOperation> TcSeizedIndexOperationPtr; - /************************** API CONNECT RECORD *********************** * The API connect record contains the connection record to which the * application connects. @@ -650,7 +624,7 @@ public: struct ApiConnectRecord { ApiConnectRecord(ArrayPool<TcFiredTriggerData> & firedTriggerPool, - ArrayPool<TcSeizedIndexOperation> & seizedIndexOpPool): + ArrayPool<TcIndexOperation> & seizedIndexOpPool): theFiredTriggers(firedTriggerPool), isIndexOp(false), theSeizedIndexOperations(seizedIndexOpPool) @@ -763,7 +737,7 @@ public: UintR accumulatingIndexOp; UintR executingIndexOp; UintR tcIndxSendArray[6]; - ArrayList<TcSeizedIndexOperation> theSeizedIndexOperations; + ArrayList<TcIndexOperation> theSeizedIndexOperations; }; typedef Ptr<ApiConnectRecord> ApiConnectRecordPtr; diff --git a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp index 59c8237f20a..f99b4bf15af 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp @@ -65,7 +65,6 @@ void Dbtc::initData() c_theFiredTriggerPool.setSize(c_maxNumberOfFiredTriggers); c_theIndexPool.setSize(c_maxNumberOfIndexes); c_theIndexOperationPool.setSize(c_maxNumberOfIndexOperations); - c_theSeizedIndexOperationPool.setSize(c_maxNumberOfIndexOperations); c_theAttributeBufferPool.setSize(c_transactionBufferSpace); c_firedTriggerHash.setSize((c_maxNumberOfFiredTriggers+10)/10); }//Dbtc::initData() @@ -85,7 +84,7 @@ void Dbtc::initRecords() for(unsigned i = 0; i<capiConnectFilesize; i++) { p = &apiConnectRecord[i]; new (p) ApiConnectRecord(c_theFiredTriggerPool, - c_theSeizedIndexOperationPool); + c_theIndexOperationPool); } // Init all fired triggers DLFifoList<TcFiredTriggerData> triggers(c_theFiredTriggerPool); @@ -177,7 +176,6 @@ Dbtc::Dbtc(const class Configuration & conf): c_maxNumberOfFiredTriggers(0), c_theIndexes(c_theIndexPool), c_maxNumberOfIndexes(0), - c_theIndexOperations(c_theIndexOperationPool), c_maxNumberOfIndexOperations(0), m_commitAckMarkerHash(m_commitAckMarkerPool) { diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index efd4c2a46d0..ca97a5bce6d 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -11161,18 +11161,18 @@ void Dbtc::execTCINDXREQ(Signal* signal) jam(); // This is a newly started transaction, clean-up releaseAllSeizedIndexOperations(regApiPtr); + + regApiPtr->transid[0] = tcIndxReq->transId1; + regApiPtr->transid[1] = tcIndxReq->transId2; }//if - if (!seizeIndexOperation(regApiPtr, indexOpPtr)) { + + if (ERROR_INSERTED(8036) || !seizeIndexOperation(regApiPtr, indexOpPtr)) { jam(); // Failed to allocate index operation - TcIndxRef * const tcIndxRef = (TcIndxRef *)signal->getDataPtrSend(); - - tcIndxRef->connectPtr = tcIndxReq->senderData; - tcIndxRef->transId[0] = regApiPtr->transid[0]; - tcIndxRef->transId[1] = regApiPtr->transid[1]; - tcIndxRef->errorCode = 4000; - sendSignal(regApiPtr->ndbapiBlockref, GSN_TCINDXREF, signal, - TcIndxRef::SignalLength, JBB); + terrorCode = 288; + regApiPtr->m_exec_flag |= TcKeyReq::getExecuteFlag(tcIndxRequestInfo); + apiConnectptr = transPtr; + abortErrorLab(signal); return; } TcIndexOperation* indexOp = indexOpPtr.p; @@ -11307,15 +11307,17 @@ void Dbtc::execINDXKEYINFO(Signal* signal) TcIndexOperationPtr indexOpPtr; TcIndexOperation* indexOp; - indexOpPtr.i = regApiPtr->accumulatingIndexOp; - indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); - if (saveINDXKEYINFO(signal, - indexOp, - src, - keyInfoLength)) { - jam(); - // We have received all we need - readIndexTable(signal, regApiPtr, indexOp); + if((indexOpPtr.i = regApiPtr->accumulatingIndexOp) != RNIL) + { + indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); + if (saveINDXKEYINFO(signal, + indexOp, + src, + keyInfoLength)) { + jam(); + // We have received all we need + readIndexTable(signal, regApiPtr, indexOp); + } } } @@ -11338,15 +11340,17 @@ void Dbtc::execINDXATTRINFO(Signal* signal) TcIndexOperationPtr indexOpPtr; TcIndexOperation* indexOp; - indexOpPtr.i = regApiPtr->accumulatingIndexOp; - indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); - if (saveINDXATTRINFO(signal, - indexOp, - src, - attrInfoLength)) { - jam(); - // We have received all we need - readIndexTable(signal, regApiPtr, indexOp); + if((indexOpPtr.i = regApiPtr->accumulatingIndexOp) != RNIL) + { + indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); + if (saveINDXATTRINFO(signal, + indexOp, + src, + attrInfoLength)) { + jam(); + // We have received all we need + readIndexTable(signal, regApiPtr, indexOp); + } } } @@ -11371,7 +11375,7 @@ bool Dbtc::saveINDXKEYINFO(Signal* signal, releaseIndexOperation(apiConnectptr.p, indexOp); terrorCode = 4000; abortErrorLab(signal); - return true; + return false; } if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) { jam(); @@ -11404,7 +11408,7 @@ bool Dbtc::saveINDXATTRINFO(Signal* signal, releaseIndexOperation(apiConnectptr.p, indexOp); terrorCode = 4000; abortErrorLab(signal); - return true; + return false; } if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) { jam(); @@ -11464,7 +11468,7 @@ void Dbtc::execTCKEYCONF(Signal* signal) jamEntry(); indexOpPtr.i = tcKeyConf->apiConnectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); Uint32 confInfo = tcKeyConf->confInfo; /** @@ -11553,7 +11557,7 @@ void Dbtc::execTCKEYREF(Signal* signal) jamEntry(); indexOpPtr.i = tcKeyRef->connectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); indexOpPtr.p = indexOp; if (!indexOp) { jam(); @@ -11654,7 +11658,7 @@ void Dbtc::execTRANSID_AI(Signal* signal) jamEntry(); TcIndexOperationPtr indexOpPtr; indexOpPtr.i = transIdAI->connectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); indexOpPtr.p = indexOp; if (!indexOp) { jam(); @@ -11762,7 +11766,7 @@ void Dbtc::execTCROLLBACKREP(Signal* signal) jamEntry(); TcIndexOperationPtr indexOpPtr; indexOpPtr.i = tcRollbackRep->connectPtr; - TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); + TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i); indexOpPtr.p = indexOp; tcRollbackRep = (TcRollbackRep *)signal->getDataPtrSend(); tcRollbackRep->connectPtr = indexOp->tcIndxReq.senderData; @@ -12090,16 +12094,7 @@ void Dbtc::executeIndexOperation(Signal* signal, bool Dbtc::seizeIndexOperation(ApiConnectRecord* regApiPtr, TcIndexOperationPtr& indexOpPtr) { - bool seizeOk; - - seizeOk = c_theIndexOperations.seize(indexOpPtr); - if (seizeOk) { - jam(); - TcSeizedIndexOperationPtr seizedIndexOpPtr; - seizeOk &= regApiPtr->theSeizedIndexOperations.seizeId(seizedIndexOpPtr, - indexOpPtr.i); - } - return seizeOk; + return regApiPtr->theSeizedIndexOperations.seize(indexOpPtr); } void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr, @@ -12113,18 +12108,16 @@ void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr, indexOp->expectedTransIdAI = 0; indexOp->transIdAI.release(); regApiPtr->theSeizedIndexOperations.release(indexOp->indexOpId); - c_theIndexOperations.release(indexOp->indexOpId); } void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr) { - TcSeizedIndexOperationPtr seizedIndexOpPtr; + TcIndexOperationPtr seizedIndexOpPtr; regApiPtr->theSeizedIndexOperations.first(seizedIndexOpPtr); while(seizedIndexOpPtr.i != RNIL) { jam(); - TcIndexOperation* indexOp = - c_theIndexOperations.getPtr(seizedIndexOpPtr.i); + TcIndexOperation* indexOp = seizedIndexOpPtr.p; indexOp->indexOpState = IOS_NOOP; indexOp->expectedKeyInfo = 0; @@ -12133,7 +12126,6 @@ void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr) indexOp->attrInfo.release(); indexOp->expectedTransIdAI = 0; indexOp->transIdAI.release(); - c_theIndexOperations.release(seizedIndexOpPtr.i); regApiPtr->theSeizedIndexOperations.next(seizedIndexOpPtr); } regApiPtr->theSeizedIndexOperations.release(); diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index f76440a462a..b3fc6e04d6c 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -799,7 +799,11 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){ request->error = errno; return; } +#if defined(__INTEL_COMPILER) + struct dirent64 * dp; +#else struct dirent * dp; +#endif while ((dp = readdir(dirp)) != NULL){ if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) { BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s", diff --git a/ndb/src/kernel/error/ErrorReporter.cpp b/ndb/src/kernel/error/ErrorReporter.cpp index 7c77e7932ee..e4ead4ce34d 100644 --- a/ndb/src/kernel/error/ErrorReporter.cpp +++ b/ndb/src/kernel/error/ErrorReporter.cpp @@ -130,7 +130,7 @@ ErrorReporter::formatMessage(ErrorCategory type, "Date/Time: %s\nType of error: %s\n" "Message: %s\nFault ID: %d\nProblem data: %s" "\nObject of reference: %s\nProgramName: %s\n" - "ProcessID: %d\nTraceFile: %s\n***EOM***\n", + "ProcessID: %d\nTraceFile: %s\n%s\n***EOM***\n", formatTimeStampString() , errorType[type], lookupErrorMessage(faultID), @@ -139,7 +139,8 @@ ErrorReporter::formatMessage(ErrorCategory type, objRef, my_progname, processId, - theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>"); + theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>", + NDB_VERSION_STRING); // Add trailing blanks to get a fixed lenght of the message while (strlen(messptr) <= MESSAGE_LENGTH-3){ diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index a8931fb32ea..863f54ce51a 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -857,7 +857,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list, args.put("initialstart", initial); args.put("nostart", nostart); const Properties *reply; + const int timeout = handle->read_timeout; + handle->read_timeout= 5*60*1000; // 5 minutes reply = ndb_mgm_call(handle, restart_reply, "restart all", &args); + handle->read_timeout= timeout; CHECK_REPLY(reply, -1); BaseString result; @@ -890,7 +893,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list, args.put("nostart", nostart); const Properties *reply; + const int timeout = handle->read_timeout; + handle->read_timeout= 5*60*1000; // 5 minutes reply = ndb_mgm_call(handle, restart_reply, "restart node", &args); + handle->read_timeout= timeout; if(reply != NULL) { BaseString result; reply->get("result", result); diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp index 1fe0cedbd6c..9603ddf7751 100644 --- a/ndb/src/ndbapi/ClusterMgr.cpp +++ b/ndb/src/ndbapi/ClusterMgr.cpp @@ -66,6 +66,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade): { ndbSetOwnVersion(); clusterMgrThreadMutex = NdbMutex_Create(); + noOfAliveNodes= 0; noOfConnectedNodes= 0; theClusterMgrThread= 0; } @@ -335,9 +336,9 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){ node.m_state = apiRegConf->nodeState; if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED || node.m_state.startLevel == NodeState::SL_SINGLEUSER)){ - node.m_alive = true; + set_node_alive(node, true); } else { - node.m_alive = false; + set_node_alive(node, false); }//if node.hbSent = 0; node.hbCounter = 0; @@ -360,7 +361,7 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){ assert(node.defined == true); node.compatible = false; - node.m_alive = false; + set_node_alive(node, false); node.m_state = NodeState::SL_NOTHING; node.m_info.m_version = ref->version; @@ -437,7 +438,7 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ Node & theNode = theNodes[nodeId]; - theNode.m_alive = false; + set_node_alive(theNode, false); if(theNode.connected) theFacade.doDisconnect(nodeId); @@ -449,8 +450,8 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){ } theNode.nfCompleteRep = false; - - if(noOfConnectedNodes == 0){ + + if(noOfAliveNodes == 0){ NFCompleteRep rep; for(Uint32 i = 1; i<MAX_NODES; i++){ if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){ diff --git a/ndb/src/ndbapi/ClusterMgr.hpp b/ndb/src/ndbapi/ClusterMgr.hpp index cc3cf66c8aa..d75b820e9cb 100644 --- a/ndb/src/ndbapi/ClusterMgr.hpp +++ b/ndb/src/ndbapi/ClusterMgr.hpp @@ -80,6 +80,7 @@ public: Uint32 getNoOfConnectedNodes() const; private: + Uint32 noOfAliveNodes; Uint32 noOfConnectedNodes; Node theNodes[MAX_NODES]; NdbThread* theClusterMgrThread; @@ -100,6 +101,19 @@ private: void execAPI_REGREF (const Uint32 * theData); void execNODE_FAILREP (const Uint32 * theData); void execNF_COMPLETEREP(const Uint32 * theData); + + inline void set_node_alive(Node& node, bool alive){ + if(node.m_alive && !alive) + { + assert(noOfAliveNodes); + noOfAliveNodes--; + } + else if(!node.m_alive && alive) + { + noOfAliveNodes++; + } + node.m_alive = alive; + } }; inline diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp index 9d520d5eac9..1ae1030e463 100644 --- a/ndb/src/ndbapi/Ndb.cpp +++ b/ndb/src/ndbapi/Ndb.cpp @@ -730,7 +730,7 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize) DBUG_RETURN(~(Uint64)0); const NdbTableImpl *table= info->m_table_impl; Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } @@ -742,7 +742,7 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize DBUG_RETURN(~(Uint64)0); const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } @@ -762,7 +762,8 @@ Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize) if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] ) { theFirstTupleId[aTableId]++; - DBUG_PRINT("info", ("next cached value %u", theFirstTupleId[aTableId])); + DBUG_PRINT("info", ("next cached value %ul", + (ulong) theFirstTupleId[aTableId])); DBUG_RETURN(theFirstTupleId[aTableId]); } else // theFirstTupleId == theLastTupleId @@ -783,7 +784,7 @@ Ndb::readAutoIncrementValue(const char* aTableName) DBUG_RETURN(~(Uint64)0); } Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } @@ -795,7 +796,7 @@ Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable) DBUG_RETURN(~(Uint64)0); const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); - DBUG_PRINT("info", ("value %u", tupleId)); + DBUG_PRINT("info", ("value %ul", (ulong) tupleId)); DBUG_RETURN(tupleId); } diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index bbc82a21324..71b0ed6a82f 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -169,7 +169,7 @@ ErrorBundle ErrorCodes[] = { { 4021, TR, "Out of Send Buffer space in NDB API" }, { 4022, TR, "Out of Send Buffer space in NDB API" }, { 4032, TR, "Out of Send Buffer space in NDB API" }, - + { 288, TR, "Out of index operations in transaction coordinator (increase MaxNoOfConcurrentIndexOperations)" }, /** * InsufficientSpace */ diff --git a/ndb/test/include/CpcClient.hpp b/ndb/test/include/CpcClient.hpp index 1655bc57b56..8d8e079d219 100644 --- a/ndb/test/include/CpcClient.hpp +++ b/ndb/test/include/CpcClient.hpp @@ -56,6 +56,7 @@ public: BaseString m_stdout; BaseString m_stderr; BaseString m_ulimit; + BaseString m_shutdown_options; }; private: diff --git a/ndb/test/ndbapi/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp index a50df91908c..9c25d715d07 100644 --- a/ndb/test/ndbapi/testNodeRestart.cpp +++ b/ndb/test/ndbapi/testNodeRestart.cpp @@ -359,7 +359,7 @@ int runLateCommit(NDBT_Context* ctx, NDBT_Step* step){ if(hugoOps.startTransaction(pNdb) != 0) return NDBT_FAILED; - if(hugoOps.pkUpdateRecord(pNdb, 1) != 0) + if(hugoOps.pkUpdateRecord(pNdb, 1, 128) != 0) return NDBT_FAILED; if(hugoOps.execute_NoCommit(pNdb) != 0) diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am index 6b3ba0bff09..cf08542ae97 100644 --- a/ndb/test/run-test/Makefile.am +++ b/ndb/test/run-test/Makefile.am @@ -6,7 +6,12 @@ include $(top_srcdir)/ndb/config/type_util.mk.am include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am test_PROGRAMS = atrt -test_DATA=daily-basic-tests.txt daily-devel-tests.txt +test_DATA=daily-basic-tests.txt daily-devel-tests.txt \ + conf-daily-basic-ndbmaster.txt \ + conf-daily-basic-shark.txt \ + conf-daily-devel-ndbmaster.txt \ + conf-daily-sql-ndbmaster.txt \ + conf-daily-basic-dl145a.txt test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \ atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh diff --git a/ndb/test/run-test/conf-daily-basic-dl145a.txt b/ndb/test/run-test/conf-daily-basic-dl145a.txt new file mode 100644 index 00000000000..d8cf8d34d82 --- /dev/null +++ b/ndb/test/run-test/conf-daily-basic-dl145a.txt @@ -0,0 +1,19 @@ +baseport: 14000 +basedir: /home/ndbdev/autotest/run +mgm: CHOOSE_host1 +ndb: CHOOSE_host2 CHOOSE_host3 +api: CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 +-- cluster config +[DB DEFAULT] +NoOfReplicas: 2 +IndexMemory: 100M +DataMemory: 300M +BackupMemory: 64M +MaxNoOfConcurrentScans: 100 +DataDir: . +FileSystemPath: /home/ndbdev/autotest/run + +[MGM DEFAULT] +PortNumber: 14000 +ArbitrationRank: 1 +DataDir: . diff --git a/ndb/test/run-test/conf-daily-basic-ndbmaster.txt b/ndb/test/run-test/conf-daily-basic-ndbmaster.txt new file mode 100644 index 00000000000..bcd809593f3 --- /dev/null +++ b/ndb/test/run-test/conf-daily-basic-ndbmaster.txt @@ -0,0 +1,19 @@ +baseport: 14000 +basedir: /space/autotest +mgm: CHOOSE_host1 +ndb: CHOOSE_host2 CHOOSE_host3 CHOOSE_host2 CHOOSE_host3 +api: CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 +-- cluster config +[DB DEFAULT] +NoOfReplicas: 2 +IndexMemory: 100M +DataMemory: 300M +BackupMemory: 64M +MaxNoOfConcurrentScans: 100 +DataDir: . +FileSystemPath: /space/autotest/run + +[MGM DEFAULT] +PortNumber: 14000 +ArbitrationRank: 1 +DataDir: . diff --git a/ndb/test/run-test/conf-daily-basic-shark.txt b/ndb/test/run-test/conf-daily-basic-shark.txt new file mode 100644 index 00000000000..6d1f8b64f44 --- /dev/null +++ b/ndb/test/run-test/conf-daily-basic-shark.txt @@ -0,0 +1,19 @@ +baseport: 14000 +basedir: /space/autotest +mgm: CHOOSE_host1 +ndb: CHOOSE_host1 CHOOSE_host1 +api: CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 +-- cluster config +[DB DEFAULT] +NoOfReplicas: 2 +IndexMemory: 100M +DataMemory: 300M +BackupMemory: 64M +MaxNoOfConcurrentScans: 100 +DataDir: . +FileSystemPath: /space/autotest/run + +[MGM DEFAULT] +PortNumber: 14000 +ArbitrationRank: 1 +DataDir: . diff --git a/ndb/test/run-test/conf-daily-devel-ndbmaster.txt b/ndb/test/run-test/conf-daily-devel-ndbmaster.txt new file mode 100644 index 00000000000..8b340e6a39d --- /dev/null +++ b/ndb/test/run-test/conf-daily-devel-ndbmaster.txt @@ -0,0 +1,19 @@ +baseport: 16000 +basedir: /space/autotest +mgm: CHOOSE_host1 +ndb: CHOOSE_host2 CHOOSE_host3 CHOOSE_host2 CHOOSE_host3 +api: CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 +-- cluster config +[DB DEFAULT] +NoOfReplicas: 2 +IndexMemory: 100M +DataMemory: 300M +BackupMemory: 64M +MaxNoOfConcurrentScans: 100 +DataDir: . +FileSystemPath: /space/autotest/run + +[MGM DEFAULT] +PortNumber: 16000 +ArbitrationRank: 1 +DataDir: . diff --git a/ndb/test/run-test/conf-daily-sql-ndbmaster.txt b/ndb/test/run-test/conf-daily-sql-ndbmaster.txt new file mode 100644 index 00000000000..0d6a99f8d48 --- /dev/null +++ b/ndb/test/run-test/conf-daily-sql-ndbmaster.txt @@ -0,0 +1,20 @@ +baseport: 16000 +basedir: /space/autotest +mgm: CHOOSE_host1 +ndb: CHOOSE_host2 CHOOSE_host3 +mysqld: CHOOSE_host1 CHOOSE_host4 +mysql: CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 CHOOSE_host1 CHOOSE_host4 CHOOSE_host4 CHOOSE_host4 CHOOSE_host4 CHOOSE_host4 CHOOSE_host4 +-- cluster config +[DB DEFAULT] +NoOfReplicas: 2 +IndexMemory: 100M +DataMemory: 300M +BackupMemory: 64M +MaxNoOfConcurrentScans: 100 +DataDir: . +FileSystemPath: /space/autotest/run + +[MGM DEFAULT] +PortNumber: 16000 +ArbitrationRank: 1 +DataDir: . diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp index 02c2cc862a3..0b0b7472a19 100644 --- a/ndb/test/run-test/main.cpp +++ b/ndb/test/run-test/main.cpp @@ -116,10 +116,7 @@ main(int argc, const char ** argv){ */ if(restart){ g_logger.info("(Re)starting ndb processes"); - if(!stop_processes(g_config, atrt_process::NDB_MGM)) - goto end; - - if(!stop_processes(g_config, atrt_process::NDB_DB)) + if(!stop_processes(g_config, ~0)) goto end; if(!start_processes(g_config, atrt_process::NDB_MGM)) @@ -142,6 +139,9 @@ main(int argc, const char ** argv){ goto end; started: + if(!start_processes(g_config, p_servers)) + goto end; + g_logger.info("Ndb start completed"); } @@ -158,9 +158,6 @@ main(int argc, const char ** argv){ if(!setup_test_case(g_config, test_case)) goto end; - if(!start_processes(g_config, p_servers)) - goto end; - if(!start_processes(g_config, p_clients)) goto end; @@ -201,9 +198,6 @@ main(int argc, const char ** argv){ if(!stop_processes(g_config, p_clients)) goto end; - if(!stop_processes(g_config, p_servers)) - goto end; - if(!gather_result(g_config, &result)) goto end; @@ -454,6 +448,7 @@ setup_config(atrt_config& config){ proc.m_proc.m_runas = proc.m_host->m_user; proc.m_proc.m_ulimit = "c:unlimited"; proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir.c_str()); + proc.m_proc.m_shutdown_options = ""; proc.m_hostname = proc.m_host->m_hostname; proc.m_ndb_mgm_port = g_default_base_port; if(split1[0] == "mgm"){ @@ -476,21 +471,19 @@ setup_config(atrt_config& config){ proc.m_proc.m_path.assign(dir).append("/libexec/mysqld"); proc.m_proc.m_args = "--core-file --ndbcluster"; proc.m_proc.m_cwd.appfmt("%d.mysqld", index); - if(mysql_port_offset > 0 || g_mysqld_use_base){ - // setup mysql specific stuff - const char * basedir = proc.m_proc.m_cwd.c_str(); - proc.m_proc.m_args.appfmt("--datadir=%s", basedir); - proc.m_proc.m_args.appfmt("--pid-file=%s/mysql.pid", basedir); - proc.m_proc.m_args.appfmt("--socket=%s/mysql.sock", basedir); - proc.m_proc.m_args.appfmt("--port=%d", - g_default_base_port-(++mysql_port_offset)); - } + proc.m_proc.m_shutdown_options = "SIGKILL"; // not nice } else if(split1[0] == "api"){ proc.m_type = atrt_process::NDB_API; proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api"); proc.m_proc.m_path = ""; proc.m_proc.m_args = ""; proc.m_proc.m_cwd.appfmt("%d.ndb_api", index); + } else if(split1[0] == "mysql"){ + proc.m_type = atrt_process::MYSQL_CLIENT; + proc.m_proc.m_name.assfmt("%d-%s", index, "mysql"); + proc.m_proc.m_path = ""; + proc.m_proc.m_args = ""; + proc.m_proc.m_cwd.appfmt("%d.mysql", index); } else { g_logger.critical("%s:%d: Unhandled process type: %s", g_process_config_filename, lineno, @@ -913,6 +906,11 @@ read_test_case(FILE * file, atrt_testcase& tc, int& line){ tc.m_report= true; else tc.m_report= false; + + if(p.get("run-all", &mt) && strcmp(mt, "yes") == 0) + tc.m_run_all= true; + else + tc.m_run_all= false; return true; } @@ -928,16 +926,17 @@ setup_test_case(atrt_config& config, const atrt_testcase& tc){ size_t i = 0; for(; i<config.m_processes.size(); i++){ atrt_process & proc = config.m_processes[i]; - if(proc.m_type == atrt_process::NDB_API){ + if(proc.m_type == atrt_process::NDB_API || proc.m_type == atrt_process::MYSQL_CLIENT){ proc.m_proc.m_path.assfmt("%s/bin/%s", proc.m_host->m_base_dir.c_str(), tc.m_command.c_str()); proc.m_proc.m_args.assign(tc.m_args); - break; + if(!tc.m_run_all) + break; } } for(i++; i<config.m_processes.size(); i++){ atrt_process & proc = config.m_processes[i]; - if(proc.m_type == atrt_process::NDB_API){ + if(proc.m_type == atrt_process::NDB_API || proc.m_type == atrt_process::MYSQL_CLIENT){ proc.m_proc.m_path.assign(""); proc.m_proc.m_args.assign(""); } diff --git a/ndb/test/run-test/make-config.sh b/ndb/test/run-test/make-config.sh index 5394b0654d4..1321ce4e9f0 100755 --- a/ndb/test/run-test/make-config.sh +++ b/ndb/test/run-test/make-config.sh @@ -1,465 +1,101 @@ #!/bin/sh -# NAME -# make-config.sh - Makes a config file for mgm server -# -# SYNOPSIS -# make-config.sh [ -t <template> ] [-s] [ -m <machine conf> [ -d <directory> ] -# -# DESCRIPTION -# -# OPTIONS -# -# EXAMPLES -# -# -# ENVIRONMENT -# NDB_PROJ_HOME Home dir for ndb -# -# FILES -# $NDB_PROJ_HOME/lib/funcs.sh general shell script functions -# -# -# SEE ALSO -# -# DIAGNOSTICTS -# -# VERSION -# 1.0 -# 1.1 021112 epesson: Adapted for new mgmt server in NDB 2.00 -# -# AUTHOR -# Jonas Oreland -# -# CHANGES -# also generate ndbnet config -# -progname=`basename $0` -synopsis="make-config.sh [ -t template ] [ -m <machine conf> ] [ -d <dst directory> ][-s] [<mgm host>]" +baseport="" +basedir="" +proc_no=1 +node_id=1 -#: ${NDB_PROJ_HOME:?} # If undefined, exit with error message +d_file=/tmp/d.$$ +dir_file=/tmp/dirs.$$ +config_file=/tmp/config.$$ +cluster_file=/tmp/cluster.$$ -#: ${NDB_LOCAL_BUILD_OPTIONS:=--} # If undef, set to --. Keeps getopts happy. - # You may have to experiment a bit - # to get quoting right (if you need it). - - -#. $NDB_PROJ_HOME/lib/funcs.sh # Load some good stuff -trace() { - echo $* 1>&2 -} -syndie() { - trace $* - exit 1 -} - -# defaults for options related variables -# - -mgm_nodes=0 -ndb_nodes=0 -api_nodes=0 -uniq_id=$$.$$ -own_host=`hostname` -dst_dir="" -template=/dev/null -machines=/dev/null -verbose=yes - -# used if error when parsing the options environment variable -# -env_opterr="options environment variable: <<$options>>" - -# Option parsing, for the options variable as well as the command line. -# -# We want to be able to set options in an environment variable, -# as well as on the command line. In order not to have to repeat -# the same getopts information twice, we loop two times over the -# getopts while loop. The first time, we process options from -# the options environment variable, the second time we process -# options from the command line. -# -# The things to change are the actual options and what they do. -# -add_node(){ - no=$1; shift +add_procs(){ type=$1; shift - echo $* | awk 'BEGIN{FS=":";}{h=$1; if(h=="localhost") h="'$own_host'"; - printf("%s_%d_host=%s\n", "'$type'", "'$no'", h); - if(NF>1 && $2!="") printf("%s_%d_port=%d\n", - "'$type'", "'$no'", $2); - if(NF>2 && $3!="") printf("%s_%d_dir=%s\n", - "'$type'", "'$no'", $3); - }' -} - - -add_mgm_node(){ - mgm_nodes=`cat /tmp/mgm_nodes.$uniq_id | grep "_host=" | wc -l` - mgm_nodes=`expr $mgm_nodes + 1` - while [ $# -gt 0 ] - do - add_node ${mgm_nodes} mgm_node $1 >> /tmp/mgm_nodes.$uniq_id - shift - mgm_nodes=`expr $mgm_nodes + 1` - done -} - -add_ndb_node(){ - ndb_nodes=`cat /tmp/ndb_nodes.$uniq_id | grep "_host=" | wc -l` - ndb_nodes=`expr $ndb_nodes + 1` - while [ $# -gt 0 ] - do - add_node ${ndb_nodes} ndb_node $1 >> /tmp/ndb_nodes.$uniq_id - shift - ndb_nodes=`expr $ndb_nodes + 1` - done -} - -add_api_node(){ - api_nodes=`cat /tmp/api_nodes.$uniq_id | grep "_host=" |wc -l` - api_nodes=`expr $api_nodes + 1` - while [ $# -gt 0 ] - do - add_node ${api_nodes} api_node $1 >> /tmp/api_nodes.$uniq_id - shift - api_nodes=`expr $api_nodes + 1` - done + while [ $# -ne 0 ] + do + add_proc $type $1 + shift + done } -rm -rf /tmp/mgm_nodes.$uniq_id ; touch /tmp/mgm_nodes.$uniq_id -rm -rf /tmp/ndb_nodes.$uniq_id ; touch /tmp/ndb_nodes.$uniq_id -rm -rf /tmp/api_nodes.$uniq_id ; touch /tmp/api_nodes.$uniq_id - -for optstring in "$options" "" # 1. options variable 2. cmd line -do - - while getopts d:m:t:n:o:a:b:p:s i $optstring # optstring empty => no arg => cmd line - do - case $i in - - q) verbose="";; # echo important things - t) template=$OPTARG;; # Template - d) dst_dir=$OPTARG;; # Destination directory - m) machines=$OPTARG;; # Machine configuration - s) mgm_start=yes;; # Make mgm start script - \?) syndie $env_opterr;; # print synopsis and exit - +add_proc (){ + dir="" + conf="" + case $type in + mgm) + dir="ndb_mgmd" + conf="[ndb_mgmd]\nId: $node_id\nHostName: $2\n" + node_id=`expr $node_id + 1` + ;; + api) + dir="ndb_api" + conf="[api]\nId: $node_id\nHostName: $2\n" + node_id=`expr $node_id + 1` + ;; + ndb) + dir="ndbd" + conf="[ndbd]\nId: $node_id\nHostName: $2\n" + node_id=`expr $node_id + 1` + ;; + mysqld) + dir="mysqld" + conf="[mysqld]\nId: $node_id\nHostName: $2\n" + node_id=`expr $node_id + 1` + ;; + mysql) + dir="mysql" + ;; esac - done - - [ -n "$optstring" ] && OPTIND=1 # Reset for round 2, cmdline options - - env_opterr= # Round 2 should not use the value - -done -shift `expr $OPTIND - 1` - -if [ -z "$dst_dir" ] -then - verbose= -fi - -skip(){ - no=$1; shift - shift $no - echo $* + dir="$proc_no.$dir" + proc_no=`expr $proc_no + 1` + echo -e $dir >> $dir_file + if [ "$conf" ] + then + echo -e $conf >> $config_file + fi } -# --- option parsing done --- -grep "^ndb: " $machines | while read node -do - node=`skip 1 $node` - add_ndb_node $node -done - -grep "^api: " $machines | while read node -do - node=`skip 1 $node` - add_api_node $node -done -grep "^mgm: " $machines | while read node +cnf=/dev/null +cat $1 | while read line do - node=`skip 1 $node` - add_mgm_node $node + case $line in + baseport:*) baseport=`echo $line | sed 's/baseport[ ]*:[ ]*//g'`;; + basedir:*) basedir=`echo $line | sed 's/basedir[ ]*:[ ]*//g'`;; + mgm:*) add_procs mgm `echo $line | sed 's/mgm[ ]*:[ ]*//g'`;; + api:*) add_procs api `echo $line | sed 's/api[ ]*:[ ]*//g'`;; + ndb:*) add_procs ndb `echo $line | sed 's/ndb[ ]*:[ ]*//g'`;; + mysqld:*) add_procs mysqld `echo $line | sed 's/mysqld[ ]*:[ ]*//g'`;; + mysql:*) add_procs mysql `echo $line | sed 's/mysql[ ]*:[ ]*//g'`;; + "-- cluster config") + if [ "$cnf" = "/dev/null" ] + then + cnf=$cluster_file + else + cnf=/dev/null + fi + line="";; + *) echo $line >> $cnf; line="";; + esac + if [ "$line" ] + then + echo $line >> $d_file + fi done -tmp=`grep "^baseport: " $machines | tail -1 | cut -d ":" -f 2` -if [ "$tmp" ] -then - baseport=`echo $tmp` -else - syndie "Unable to find baseport" -fi +cat $dir_file | xargs mkdir -p -trim(){ - echo $* -} -tmp=`grep "^basedir: " $machines | tail -1 | cut -d ":" -f 2` -if [ "$tmp" ] -then - basedir=`trim $tmp` -fi - -# -- Load enviroment -- -ndb_nodes=`cat /tmp/ndb_nodes.$uniq_id | grep "_host=" | wc -l` -api_nodes=`cat /tmp/api_nodes.$uniq_id | grep "_host=" | wc -l` -mgm_nodes=`cat /tmp/mgm_nodes.$uniq_id | grep "_host=" | wc -l` -. /tmp/ndb_nodes.$uniq_id -. /tmp/api_nodes.$uniq_id -. /tmp/mgm_nodes.$uniq_id -rm -f /tmp/ndb_nodes.$uniq_id /tmp/api_nodes.$uniq_id /tmp/mgm_nodes.$uniq_id - -# -- Verify -trace "Verifying arguments" - -if [ ! -r $template ] -then - syndie "Unable to read template file: $template" -fi - -if [ $ndb_nodes -le 0 ] -then - syndie "No ndb nodes specified" -fi - -if [ $api_nodes -le 0 ] -then - syndie "No api nodes specified" -fi - -if [ $mgm_nodes -gt 1 ] -then - syndie "More than one mgm node specified" -fi - -if [ $mgm_nodes -eq 0 ] -then - trace "No managment server specified using `hostname`" - mgm_nodes=1 - mgm_node_1=`hostname` -fi - -if [ -n "$dst_dir" ] -then - mkdir -p $dst_dir - if [ ! -d $dst_dir ] +if [ -f $cluster_file ] then - syndie "Unable to create dst dir: $dst_dir" - fi - DST=/tmp/$uniq_id + cat $cluster_file $config_file >> /tmp/config2.$$ + mv /tmp/config2.$$ $config_file fi -# --- option verifying done --- - -# Find uniq computers -i=1 -while [ $i -le $mgm_nodes ] -do - echo `eval echo "\$"mgm_node_${i}_host` >> /tmp/hosts.$uniq_id - i=`expr $i + 1` -done - -i=1 -while [ $i -le $ndb_nodes ] -do - echo `eval echo "\$"ndb_node_${i}_host` >> /tmp/hosts.$uniq_id - i=`expr $i + 1` -done - -i=1 -while [ $i -le $api_nodes ] -do - echo `eval echo "\$"api_node_${i}_host` >> /tmp/hosts.$uniq_id - i=`expr $i + 1` +for i in `find . -type d -name '*.ndb_mgmd'` + do + cp $config_file $i/config.ini done -sort -u -o /tmp/hosts.$uniq_id /tmp/hosts.$uniq_id - -get_computer_id(){ - grep -w -n $1 /tmp/hosts.$uniq_id | cut -d ":" -f 1 -} - -get_mgm_computer_id(){ - a=`eval echo "\$"mgm_node_${1}_host` - get_computer_id $a -} - -get_ndb_computer_id(){ - a=`eval echo "\$"ndb_node_${1}_host` - get_computer_id $a -} - -get_api_computer_id(){ - a=`eval echo "\$"api_node_${1}_host` - get_computer_id $a -} - -# -- Write config files -- - -mgm_port=$baseport - -( - i=1 - #echo "COMPUTERS" - cat /tmp/hosts.$uniq_id | while read host - do - echo "[COMPUTER]" - echo "Id: $i" - echo "ByteOrder: Big" - echo "HostName: $host" - echo - i=`expr $i + 1` - done - - node_id=1 - echo - - # Mgm process - echo - echo "[MGM]" - echo "Id: $node_id" - echo "ExecuteOnComputer: `get_mgm_computer_id 1`" - echo "PortNumber: $mgm_port" - node_id=`expr $node_id + 1` - - # Ndb processes - i=1 - ndb_nodes=`trim $ndb_nodes` - while [ $i -le $ndb_nodes ] - do - echo - echo "[DB]" - echo "Id: $node_id" - echo "ExecuteOnComputer: `get_ndb_computer_id $i`" - echo "FileSystemPath: $basedir/run/node-${node_id}-fs" - i=`expr $i + 1` - node_id=`expr $node_id + 1` - done - - # API processes - i=1 - while [ $i -le $api_nodes ] - do - echo - echo "[API]" - echo "Id: $node_id" - echo "ExecuteOnComputer: `get_api_computer_id $i`" - i=`expr $i + 1` - node_id=`expr $node_id + 1` - done - - # Connections - current_port=`expr $mgm_port + 1` - echo - - # Connect Mgm with all ndb-nodes - i=1 - while [ $i -le $ndb_nodes ] - do - echo - echo "[TCP]" - echo "NodeId1: 1" - echo "NodeId2: `expr $i + 1`" - echo "PortNumber: $current_port" - i=`expr $i + 1` - current_port=`expr $current_port + 1` - done - - # Connect All ndb processes with all ndb processes - i=1 - while [ $i -le $ndb_nodes ] - do - j=`expr $i + 1` - while [ $j -le $ndb_nodes ] - do - echo - echo "[TCP]" - echo "NodeId1: `expr $i + 1`" - echo "NodeId2: `expr $j + 1`" - echo "PortNumber: $current_port" - j=`expr $j + 1` - current_port=`expr $current_port + 1` - done - i=`expr $i + 1` - done - - # Connect all ndb-nodes with all api nodes - i=1 - while [ $i -le $ndb_nodes ] - do - j=1 - while [ $j -le $api_nodes ] - do - echo - echo "[TCP]" - echo "NodeId1: `expr $i + 1`" - echo "NodeId2: `expr $j + $ndb_nodes + 1`" - echo "PortNumber: $current_port" - j=`expr $j + 1` - current_port=`expr $current_port + 1` - done - i=`expr $i + 1` - done - echo -) > $DST - -trace "Init config file done" - -if [ -z "$dst_dir" ] -then - cat $DST - rm -f $DST - rm -f /tmp/hosts.$uniq_id - exit 0 -fi - -### -# Create Ndb.cfg files - -# nodeid=2;host=localhost:2200 - -# Mgm node -mkcfg(){ - mkdir -p $dst_dir/${2}.ndb_${1} - ( - echo "OwnProcessId $2" - echo "host://${mgm_node_1_host}:${mgm_port}" - ) > $dst_dir/${2}.ndb_${1}/Ndb.cfg - if [ $1 = "db" ] - then - mkdir $dst_dir/node-${2}-fs - fi -} - -mkcfg mgm 1 -cat $DST > $dst_dir/1.ndb_mgm/initconfig.txt - -trace "Creating Ndb.cfg for ndb nodes" - -current_node=2 -i=1 -while [ $i -le $ndb_nodes ] -do - mkcfg db ${current_node} - i=`expr $i + 1` - current_node=`expr $current_node + 1` -done - -trace "Creating Ndb.cfg for api nodes" - -i=1 -while [ $i -le $api_nodes ] -do - mkcfg api ${current_node} - i=`expr $i + 1` - current_node=`expr $current_node + 1` -done - -rm -f $DST -rm -f /tmp/hosts.$uniq_id - - -exit 0 -# vim: set sw=4: +mv $d_file d.txt +rm -f $config_file $dir_file $cluster_file diff --git a/ndb/test/run-test/ndb-autotest.sh b/ndb/test/run-test/ndb-autotest.sh index 397df97d52f..f1c83f079cd 100755 --- a/ndb/test/run-test/ndb-autotest.sh +++ b/ndb/test/run-test/ndb-autotest.sh @@ -1,7 +1,7 @@ #!/bin/sh save_args=$* -VERSION="ndb-autotest.sh version 1.0" +VERSION="ndb-autotest.sh version 1.04" DATE=`date '+%Y-%m-%d'` export DATE @@ -71,11 +71,18 @@ then cd $dst_place rm -rf $run_dir/* aclocal; autoheader; autoconf; automake - (cd innobase; aclocal; autoheader; autoconf; automake) - (cd bdb/dist; sh s_all) + if [ -d storage ] + then + (cd storage/innobase; aclocal; autoheader; autoconf; automake) + (cd storage/bdb/dist; sh s_all) + else + (cd innobase; aclocal; autoheader; autoconf; automake) + (cd bdb/dist; sh s_all) + fi eval $configure --prefix=$run_dir make make install + (cd $run_dir; ./bin/mysql_install_db) fi ### @@ -103,7 +110,9 @@ fi test_dir=$run_dir/mysql-test/ndb atrt=$test_dir/atrt html=$test_dir/make-html-reports.sh -PATH=$test_dir:$PATH +mkconfig=$run_dir/mysql-test/ndb/make-config.sh + +PATH=$run_dir/bin:$test_dir:$PATH export PATH filter(){ @@ -125,20 +134,16 @@ hosts=`cat /tmp/hosts.$DATE` if [ "$deploy" ] then - (cd / && tar cfz /tmp/build.$DATE.tgz $run_dir ) - for i in $hosts - do - ok=0 - scp /tmp/build.$DATE.tgz $i:/tmp/build.$DATE.$$.tgz && \ - ssh $i "rm -rf /space/autotest/*" && \ - ssh $i "cd / && tar xfz /tmp/build.$DATE.$$.tgz" && \ - ssh $i "rm /tmp/build.$DATE.$$.tgz" && ok=1 - if [ $ok -eq 0 ] - then - echo "$i failed during scp/ssh, excluding" - echo $i >> /tmp/failed.$DATE - fi - done + for i in $hosts + do + rsync -a --delete --force --ignore-errors $run_dir/ $i:$run_dir + ok=$? + if [ $ok -ne 0 ] + then + echo "$i failed during rsync, excluding" + echo $i >> /tmp/failed.$DATE + fi + done fi rm -f /tmp/build.$DATE.tgz @@ -170,6 +175,18 @@ choose(){ cat $TMP1 rm -f $TMP1 } + +choose_conf(){ + host=`hostname -s` + if [ -f $test_dir/conf-$1-$host.txt ] + then + echo "$test_dir/conf-$1-$host.txt" + elif [ -f $test_dir/conf-$1.txt ] + then + echo "$test_dir/conf-$1.txt" + fi +} + start(){ rm -rf report.txt result* log.txt $atrt -v -v -r -R --log-file=log.txt --testcase-file=$test_dir/$2-tests.txt & @@ -186,11 +203,17 @@ start(){ p2=`pwd` cd .. tar cfz /tmp/res.$$.tgz `basename $p2`/$DATE - scp /tmp/res.$$.tgz $result_host:$result_path - ssh $result_host "cd $result_path && tar xfz res.$$.tgz && rm -f res.$$.tgz" + scp /tmp/res.$$.tgz $result_host:$result_path/res.$DATE.`hostname -s`.$2.$$.tgz rm -f /tmp/res.$$.tgz } +count_hosts(){ + cnt=`grep "CHOOSE_host" $1 | + awk '{for(i=1; i<=NF;i++) if(match($i, "CHOOSE_host") > 0) print $i;}' | + sort | uniq | wc -l` + echo $cnt +} + p=`pwd` for dir in $RUN do @@ -199,10 +222,11 @@ do run_dir=$base_dir/run-$dir-mysql-$clone-$target res_dir=$base_dir/result-$dir-mysql-$clone-$target/$DATE - mkdir -p $res_dir - rm -rf $res_dir/* + mkdir -p $run_dir $res_dir + rm -rf $res_dir/* $run_dir/* - count=`grep -c "COMPUTER" $run_dir/1.ndb_mgmd/initconfig.template` + conf=`choose_conf $dir` + count=`count_hosts $conf` avail_hosts=`filter /tmp/filter_hosts.$$ $hosts` avail=`echo $avail_hosts | wc -w` if [ $count -gt $avail ] @@ -212,12 +236,12 @@ do break; fi - run_hosts=`echo $avail_hosts| awk '{for(i=1;i<='$count';i++)print $i;}'` - choose $run_dir/d.template $run_hosts > $run_dir/d.txt - choose $run_dir/1.ndb_mgmd/initconfig.template $run_hosts > $run_dir/1.ndb_mgmd/config.ini + run_hosts=`echo $avail_hosts|awk '{for(i=1;i<='$count';i++)print $i;}'` echo $run_hosts >> /tmp/filter_hosts.$$ - + cd $run_dir + choose $conf $run_hosts > d.tmp + $mkconfig d.tmp start $dir-mysql-$clone-$target $dir $res_dir & done cd $p diff --git a/ndb/test/run-test/run-test.hpp b/ndb/test/run-test/run-test.hpp index ff7f916d4ef..7011aec33d3 100644 --- a/ndb/test/run-test/run-test.hpp +++ b/ndb/test/run-test/run-test.hpp @@ -69,6 +69,7 @@ struct atrt_config { struct atrt_testcase { bool m_report; + bool m_run_all; time_t m_max_time; BaseString m_command; BaseString m_args; diff --git a/ndb/test/src/CpcClient.cpp b/ndb/test/src/CpcClient.cpp index 1d1b4fcb977..4d06b4a7ff5 100644 --- a/ndb/test/src/CpcClient.cpp +++ b/ndb/test/src/CpcClient.cpp @@ -282,6 +282,7 @@ convert(const Properties & src, SimpleCpcClient::Process & dst){ b &= src.get("stdout", dst.m_stdout); b &= src.get("stderr", dst.m_stderr); b &= src.get("ulimit", dst.m_ulimit); + b &= src.get("shutdown", dst.m_shutdown_options); return b; } @@ -305,6 +306,7 @@ convert(const SimpleCpcClient::Process & src, Properties & dst ){ b &= dst.put("stdout", src.m_stdout.c_str()); b &= dst.put("stderr", src.m_stderr.c_str()); b &= dst.put("ulimit", src.m_ulimit.c_str()); + b &= dst.put("shutdown", src.m_shutdown_options.c_str()); return b; } @@ -372,6 +374,7 @@ SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) { CPC_ARG("stdout",String, Mandatory, "Redirect stdout"), CPC_ARG("stderr",String, Mandatory, "Redirect stderr"), CPC_ARG("ulimit",String, Mandatory, "ulimit"), + CPC_ARG("shutdown",String, Mandatory, "shutdown"), CPC_END() }; diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 0b82e02761e..8dd95da11e3 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -11,7 +11,6 @@ in_rpm=0 windows=0 defaults="" user="" -tmp_file=/tmp/mysql_install_db.$$ case "$1" in --no-defaults|--defaults-file=*|--defaults-extra-file=*) @@ -223,10 +222,8 @@ then then echo "Fill help tables" fi - echo "use mysql;" > $tmp_file - cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line" + (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line" res=$? - rm $tmp_file if test $res != 0 then echo "" diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h index 855d756368d..7ab463b6661 100644 --- a/sql/examples/ha_archive.h +++ b/sql/examples/ha_archive.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h index 3c6ce4220ee..ae72e5bb275 100644 --- a/sql/examples/ha_example.h +++ b/sql/examples/ha_example.h @@ -21,7 +21,7 @@ that you can implement. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/field.h b/sql/field.h index f19771c3f9c..1d7669d540d 100644 --- a/sql/field.h +++ b/sql/field.h @@ -20,7 +20,7 @@ variables must declare the size_of() member function. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 25d3e128502..1d4823bbdc0 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index e34d5d723a4..7c6e7cb56b6 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -19,7 +19,7 @@ #pragma implementation // gcc: Class implementation #endif -#include <mysql_priv.h> +#include "mysql_priv.h" #ifdef HAVE_BLACKHOLE_DB #include "ha_blackhole.h" diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h index b6f924e94b9..84a386e17f8 100644 --- a/sql/ha_blackhole.h +++ b/sql/ha_blackhole.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_heap.h b/sql/ha_heap.h index f36e9f31c55..60e2e84c5d2 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index edf428669d8..d336811a1eb 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -21,7 +21,7 @@ Innodb */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_isam.h b/sql/ha_isam.h index b3e932696cb..1f9b8eb28fe 100644 --- a/sql/ha_isam.h +++ b/sql/ha_isam.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h index 657e5060272..82a2e312ca3 100644 --- a/sql/ha_isammrg.h +++ b/sql/ha_isammrg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h index 1e6cf2f4ada..b256d4777f9 100644 --- a/sql/ha_myisam.h +++ b/sql/ha_myisam.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 6058c32c805..3bc9c11d4be 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index a1166641f7d..53706b4a9ba 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3003,8 +3003,10 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows) m_rows_inserted= (ha_rows) 0; if (rows == (ha_rows) 0) + { /* We don't know how many will be inserted, guess */ m_rows_to_insert= m_autoincrement_prefetch; + } else m_rows_to_insert= rows; @@ -4021,8 +4023,10 @@ longlong ha_ndbcluster::get_auto_increment() Ndb *ndb= get_ndb(); if (m_rows_inserted > m_rows_to_insert) + { /* We guessed too low */ m_rows_to_insert+= m_autoincrement_prefetch; + } int cache_size= (int) (m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ? diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 7de5dd503e7..439b4855147 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -21,7 +21,7 @@ /* The class defining a handle to an NDB Cluster table */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/handler.h b/sql/handler.h index d2f77c4149a..df623afcd79 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -17,7 +17,7 @@ /* Definitions for parameters to do with handler-routines */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item.h b/sql/item.h index 6f1f56451ab..8fed871e623 100644 --- a/sql/item.h +++ b/sql/item.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 37b0674a094..bea8250de9d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -17,7 +17,7 @@ /* compare and test functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_func.cc b/sql/item_func.cc index 477849a66c5..9c6c19f3ec9 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1692,6 +1692,13 @@ longlong Item_func_bit_count::val_int() udf_handler::~udf_handler() { + /* Everything should be properly cleaned up by this moment. */ + DBUG_ASSERT(not_original || !(initialized || buffers)); +} + + +void udf_handler::cleanup() +{ if (!not_original) { if (initialized) @@ -1703,9 +1710,11 @@ udf_handler::~udf_handler() (*deinit)(&initid); } free_udf(u_d); + initialized= FALSE; } if (buffers) // Because of bug in ecc delete [] buffers; + buffers= 0; } } @@ -1945,6 +1954,12 @@ String *udf_handler::val_str(String *str,String *save_str) } +void Item_udf_func::cleanup() +{ + udf.cleanup(); + Item_func::cleanup(); +} + double Item_func_udf_float::val() { diff --git a/sql/item_func.h b/sql/item_func.h index 288db3a148c..6b6e5d4b8ec 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -17,7 +17,7 @@ /* Function items used by mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif @@ -783,6 +783,7 @@ public: fixed= 1; return res; } + void cleanup(); Item_result result_type () const { return udf.result_type(); } table_map not_null_tables() const { return 0; } }; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 79e4f804a04..5f060416ff3 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -19,7 +19,7 @@ #ifdef HAVE_SPATIAL -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 8b9351d95a5..baba4d9b786 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1023,7 +1023,7 @@ String *Item_func_substr::val_str(String *str) if ((null_value=(args[0]->null_value || args[1]->null_value || (arg_count == 3 && args[2]->null_value)))) return 0; /* purecov: inspected */ - start= (int32)((start < 0) ? res->length() + start : start -1); + start= (int32)((start < 0) ? res->numchars() + start : start -1); start=res->charpos(start); length=res->charpos(length,start); if (start < 0 || (uint) start+1 > res->length() || length <= 0) diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 323b52b826c..6f6af415086 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -17,7 +17,7 @@ /* This file defines all string functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_subselect.h b/sql/item_subselect.h index a6e005d5d26..20ba838e61c 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -16,7 +16,7 @@ /* subselect Item */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7e9c5d09136..dd4cda4ff91 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1449,6 +1449,17 @@ bool Item_udf_sum::add() DBUG_RETURN(0); } +void Item_udf_sum::cleanup() +{ + /* + udf_handler::cleanup() nicely handles case when we have not + original item but one created by copy_or_same() method. + */ + udf.cleanup(); + Item_sum::cleanup(); +} + + Item *Item_sum_udf_float::copy_or_same(THD* thd) { return new (thd->mem_root) Item_sum_udf_float(thd, this); diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..a3b422565d1 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -17,7 +17,7 @@ /* classes for sum functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif @@ -550,6 +550,7 @@ public: bool add(); void reset_field() {}; void update_field() {}; + void cleanup(); }; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index cc2709bf555..1a30b24b7ce 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -17,7 +17,7 @@ /* Function items used by mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index f5d4464ce68..ca282ee2444 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -211,6 +211,9 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; key checks in some cases */ #define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27) #define SELECT_NO_UNLOCK (1L << 28) +/* Thr following is used to detect a conflict with DISTINCT + in the user query has requested */ +#define SELECT_ALL (1L << 29) /* If set to 0, then the thread will ignore all warnings with level notes. Set by executing SET SQL_NOTES=1 */ diff --git a/sql/opt_range.h b/sql/opt_range.h index 5a2044a59f4..edecdcc6282 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -20,7 +20,7 @@ #ifndef _opt_range_h #define _opt_range_h -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/procedure.h b/sql/procedure.h index abe50bdc0a0..0a1e9ddfa2f 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -17,7 +17,7 @@ /* When using sql procedures */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/protocol.h b/sql/protocol.h index a3b6da55da3..32d6acccddf 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/set_var.h b/sql/set_var.h index 080a2a95ae0..d452ba03367 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -16,7 +16,7 @@ /* Classes to support the SET command */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 022a624c921..04f8fcc8dd4 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -331,3 +331,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 18ebe5712f8..384625f7112 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -322,3 +322,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 54377b5949a..3f320dca750 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -331,3 +331,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 1ae4e79bf01..763c984866b 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 5aab524e0d9..b7557a37670 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin7 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index bb2bd29171a..6f10a468e26 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 03e838dd805..c3d00ae06b4 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -332,3 +332,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 87168431595..979091a566c 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -319,3 +319,4 @@ character-set=greek "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index af10c33ee2d..5d32c5b9cc2 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index cd66f15db5f..556b90511b0 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/japanese-sjis/errmsg.txt b/sql/share/japanese-sjis/errmsg.txt index a06723727b7..1aa9ef74d5f 100644 --- a/sql/share/japanese-sjis/errmsg.txt +++ b/sql/share/japanese-sjis/errmsg.txt @@ -323,3 +323,4 @@ character-set=sjis "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index eaab58d8403..47adbf74b86 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -323,3 +323,4 @@ character-set=ujis "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 1cff50432e9..aeafef9d159 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -319,3 +319,4 @@ character-set=euckr "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 27f7a18f029..3f60876348f 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -321,3 +321,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 772f30e5d94..badeed1c0dd 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -321,3 +321,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 634a4d93f42..664a8e8e539 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 65d80918072..453c9dd5c18 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -321,3 +321,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 01c22f00119..0fcc2804326 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -324,3 +324,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 97d59cec074..1913fd3f1c1 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -324,3 +324,4 @@ character-set=koi8r "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 06270f621e4..accf1926abb 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -312,3 +312,4 @@ character-set=cp1250 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 12c3eb2b6af..fafab0c2716 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -327,3 +327,4 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index c5b4fd34eca..3af8e7b97d1 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -323,3 +323,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index ca863df7939..b552df08bf3 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -319,3 +319,4 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index b3859fb881c..9914846b1f8 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -325,3 +325,4 @@ character-set=koi8u "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" + diff --git a/sql/sql_class.h b/sql/sql_class.h index 703bb030ab9..fbd60373498 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -17,7 +17,7 @@ /* Classes in mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 3ced5921076..a3a42ce385d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -632,7 +632,11 @@ int write_record(TABLE *table,COPY_INFO *info) if (fill_record(*info->update_fields, *info->update_values, 0)) goto err; if ((error=table->file->update_row(table->record[1],table->record[0]))) + { + if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore) + break; goto err; + } info->updated++; break; } diff --git a/sql/sql_list.h b/sql/sql_list.h index be3e29b0c62..45a6b5066eb 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_select.h b/sql/sql_select.h index caf4574fbec..7e69eca4683 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -17,7 +17,7 @@ /* classes to use when handling where clause */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_string.h b/sql/sql_string.h index 8dff5558120..31cdd6efb8a 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..ca00901ea67 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -17,7 +17,7 @@ /* This file defines structures needed by udf functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface #endif @@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc bool get_arguments(); bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, uint arg_count,Item **args); + void cleanup(); double val(my_bool *null_value) { if (get_arguments()) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 594077dd4f3..abe7a716a69 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2481,7 +2481,15 @@ select_option: YYABORT; Lex->lock_option= TL_READ_HIGH_PRIORITY; } - | DISTINCT { Select->options|= SELECT_DISTINCT; } + | DISTINCT + { + if (Select->options & SELECT_ALL) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + Select->options|= SELECT_DISTINCT; + } | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; } | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; } | SQL_BUFFER_RESULT @@ -2501,7 +2509,15 @@ select_option: { Lex->select_lex.options|= OPTION_TO_QUERY_CACHE; } - | ALL {} + | ALL + { + if (Select->options & SELECT_DISTINCT) + { + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + } + Select->options|= SELECT_ALL; + } ; select_lock_type: @@ -2959,8 +2975,6 @@ simple_expr: { $$= new Item_func_export_set($3, $5, $7, $9); } | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')' { $$= new Item_func_export_set($3, $5, $7, $9, $11); } - | FALSE_SYM - { $$= new Item_int((char*) "FALSE",0,1); } | FORMAT_SYM '(' expr ',' NUM ')' { $$= new Item_func_format($3,atoi($5.str)); } | FROM_UNIXTIME '(' expr ')' @@ -3108,8 +3122,6 @@ simple_expr: { $$= new Item_func_trim($5,$3); } | TRUNCATE_SYM '(' expr ',' expr ')' { $$= new Item_func_round($3,$5,1); } - | TRUE_SYM - { $$= new Item_int((char*) "TRUE",1,1); } | UDA_CHAR_SUM '(' udf_expr_list ')' { if ($3 != NULL) @@ -4892,6 +4904,8 @@ literal: | NUM_literal { $$ = $1; } | NULL_SYM { $$ = new Item_null(); Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} + | FALSE_SYM { $$= new Item_int((char*) "FALSE",0,1); } + | TRUE_SYM { $$= new Item_int((char*) "TRUE",1,1); } | HEX_NUM { $$ = new Item_varbinary($1.str,$1.length);} | UNDERSCORE_CHARSET HEX_NUM { diff --git a/sql/table.cc b/sql/table.cc index cdcd5148787..012defa116d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -59,6 +59,7 @@ static byte* get_field_name(Field **buff,uint *length, 3 Wrong data in .frm file 4 Error (see frm_error) 5 Error (see frm_error: charset unavailable) + 6 Unknown .frm version */ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, @@ -118,9 +119,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, *fn_ext(outparam->path)='\0'; // Remove extension if (my_read(file,(byte*) head,64,MYF(MY_NABP))) goto err_not_open; - if (head[0] != (uchar) 254 || head[1] != 1 || - (head[2] != FRM_VER && head[2] != FRM_VER+1 && head[2] != FRM_VER+3)) + if (head[0] != (uchar) 254 || head[1] != 1) + goto err_not_open; /* purecov: inspected */ + if (head[2] != FRM_VER && head[2] != FRM_VER+1 && head[2] != FRM_VER+3) + { + error= 6; goto err_not_open; /* purecov: inspected */ + } new_field_pack_flag=head[27]; new_frm_ver= (head[2] - FRM_VER); field_pack_length= new_frm_ver < 2 ? 11 : 17; @@ -1033,6 +1038,12 @@ static void frm_error(int error, TABLE *form, const char *name, MYF(0), csname, form->real_name); break; } + case 6: + my_printf_error(ER_NOT_FORM_FILE, + "Table '%-.64s' was created with a different version " + "of MySQL and cannot be read", + MYF(0), name); + break; default: /* Better wrong error than none */ case 4: my_error(ER_NOT_FORM_FILE,errortype, diff --git a/sql/tztime.h b/sql/tztime.h index 2214c1b29d6..e1ff71b6703 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 07b30205f89..52886116ff2 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6285,7 +6285,7 @@ uint my_well_formed_len_big5(CHARSET_INFO *cs __attribute__((unused)), const char *emb= e - 1; /* Last possible end of an MB character */ *error= 0; - while (pos && b < e) + while (pos-- && b < e) { if ((uchar) b[0] < 128) { diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index 0db38afa1f7..d9e3bbd5866 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -5417,7 +5417,7 @@ uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)), { const char *b0= b; *error= 0; - while (pos && b < e) + while (pos-- && b < e) { /* Cast to int8 for extra safety. diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 35182db3345..b018e148ffe 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4576,7 +4576,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)), { const char *b0= b; *error= 0; - while (pos && b < e) + while (pos-- && b < e) { if ((uchar) b[0] < 128) { diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index f5d0721fa9b..f12cfe3256e 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1261,7 +1261,7 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *e __attribute__((unused)), uint pos) { - return pos*2; + return pos > e - b ? e - b + 2 : pos * 2; } |