Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.0

into quadita2.mysql.com:/nfstmp1/guilhem/mysql-5.0-4ita
This commit is contained in:
gbichot@quadita2.mysql.com 2005-05-10 11:31:46 +02:00
commit d6e1e5b417
99 changed files with 836 additions and 698 deletions

View File

@ -19,8 +19,23 @@ if test -r /proc/cpuinfo ; then
if test -z "$model_name" ; then if test -z "$model_name" ; then
model_name=`uname -m` model_name=`uname -m`
fi 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 fi
cpu_flag=""
cpu_flag_old=""
case "$cpu_family--$model_name" in case "$cpu_family--$model_name" in
Alpha*EV6*) Alpha*EV6*)
cpu_flag="ev6"; cpu_flag="ev6";
@ -28,11 +43,24 @@ case "$cpu_family--$model_name" in
*Xeon*) *Xeon*)
cpu_flag="nocona"; cpu_flag="nocona";
;; ;;
*Pentium*4*Mobile*CPU*)
cpu_flag="pentium4m";
;;
*Pentium*4*CPU*) *Pentium*4*CPU*)
cpu_flag="pentium4"; cpu_flag="pentium4";
;; ;;
*Pentium*III*Mobile*CPU*)
cpu_flag="pentium3m";
;;
*Pentium*III*CPU*)
cpu_flag="pentium3";
;;
*Pentium*M*pro*)
cpu_flag="pentium-m";
;;
*Athlon*64*) *Athlon*64*)
cpu_flag="athlon64"; cpu_flag="athlon64";
cpu_flag_old="athlon";
;; ;;
*Athlon*) *Athlon*)
cpu_flag="athlon"; cpu_flag="athlon";
@ -72,6 +100,10 @@ case "$cc_ver--$cc_verno" in
check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag" check_cpu_cflags="-mtune=$cpu_flag -march=$cpu_flag"
;; ;;
*GCC*) *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" check_cpu_cflags="-mcpu=$cpu_flag -march=$cpu_flag"
;; ;;
*) *)

View File

@ -115,6 +115,7 @@ jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com jcole@tetra.spaceapes.com
jimw@mysql.com jimw@mysql.com
joerg@mysql.com joerg@mysql.com
joerg@trift-lap.fambruehe
jon@gigan. jon@gigan.
jonas@mysql.com jonas@mysql.com
joreland@bk-internal.mysql.com joreland@bk-internal.mysql.com
@ -180,6 +181,7 @@ mwagner@cash.mwagner.org
mwagner@evoq.mwagner.org mwagner@evoq.mwagner.org
mwagner@here.mwagner.org mwagner@here.mwagner.org
mwagner@mysql.com mwagner@mysql.com
mwagner@ultrafly.mysql.com
mwagner@work.mysql.com mwagner@work.mysql.com
mydev@mysql.com mydev@mysql.com
mysql@home.(none) mysql@home.(none)

View File

@ -49,5 +49,5 @@ enum options_client
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
#endif #endif
OPT_IGNORE_TABLE OPT_IGNORE_TABLE,OPT_INSERT_IGNORE
}; };

View File

@ -1100,6 +1100,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
uchar inchar; uchar inchar;
char buff[80], *pos, *out; char buff[80], *pos, *out;
COMMANDS *com; COMMANDS *com;
bool need_space= 0;
if (!line[0] && buffer.is_empty()) if (!line[0] && buffer.is_empty())
return 0; return 0;
@ -1208,6 +1209,7 @@ static bool add_line(String &buffer,char *line,char *in_string,
{ {
pos++; pos++;
*ml_comment= 0; *ml_comment= 0;
need_space= 1;
} }
else else
{ // Add found char to buffer { // Add found char to buffer
@ -1217,9 +1219,16 @@ static bool add_line(String &buffer,char *line,char *in_string,
(inchar == '\'' || inchar == '"' || inchar == '`')) (inchar == '\'' || inchar == '"' || inchar == '`'))
*in_string= (char) inchar; *in_string= (char) inchar;
if (!*ml_comment) if (!*ml_comment)
{
if (need_space && !my_isspace(charset_info, (char)inchar))
{
*out++= ' ';
need_space= 0;
}
*out++= (char) inchar; *out++= (char) inchar;
} }
} }
}
if (out != line || !buffer.is_empty()) if (out != line || !buffer.is_empty())
{ {
*out++='\n'; *out++='\n';

View File

@ -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_autocommit=0,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0, opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0, opt_compact= 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 ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
@ -257,6 +257,9 @@ static struct my_option my_long_options[] =
"use the directive multiple times, once for each table. Each table must " "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", "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}, 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 ...", {"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...",
(gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR, (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -1100,13 +1103,15 @@ static uint get_table_structure(char *table, char *db)
my_bool init=0; my_bool init=0;
uint numFields; uint numFields;
char *strpos, *result_table, *opt_quoted_table; 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 name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3];
FILE *sql_file = md_result_file; FILE *sql_file = md_result_file;
DBUG_ENTER("get_table_structure"); DBUG_ENTER("get_table_structure");
delayed= opt_delayed ? " DELAYED " : ""; insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " :
opt_delayed ? " DELAYED " :
opt_ignore ? " IGNORE " : "";
if (verbose) if (verbose)
fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
@ -1190,11 +1195,11 @@ static uint get_table_structure(char *table, char *db)
if (cFlag) if (cFlag)
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (",
delayed, opt_quoted_table); insert_option, opt_quoted_table);
else else
{ {
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ",
delayed, opt_quoted_table); insert_option, opt_quoted_table);
if (!extended_insert) if (!extended_insert)
strcat(insert_pat,"("); strcat(insert_pat,"(");
} }
@ -1258,11 +1263,11 @@ static uint get_table_structure(char *table, char *db)
} }
if (cFlag) if (cFlag)
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (",
delayed, result_table); insert_option, result_table);
else else
{ {
my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ",
delayed, result_table); insert_option, result_table);
if (!extended_insert) if (!extended_insert)
strcat(insert_pat,"("); strcat(insert_pat,"(");
} }

View File

@ -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 \ 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 \ 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 EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c

View File

@ -635,13 +635,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
key+= 2; /* skip key pack length */ key+= 2; /* skip key pack length */
if (cs->mbmaxlen > 1) if (cs->mbmaxlen > 1)
{ {
uint char_length= seg->length / cs->mbmaxlen; uint char_length1, char_length2;
char_length_key= my_charpos(cs, key, key + char_length_key, char_length1= char_length2= seg->length / cs->mbmaxlen;
char_length); char_length1= my_charpos(cs, key, key + char_length_key, char_length1);
set_if_smaller(char_length_key, seg->length); set_if_smaller(char_length_key, char_length1);
char_length_rec= my_charpos(cs, pos, pos + char_length_rec, char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
char_length); set_if_smaller(char_length_rec, char_length2);
set_if_smaller(char_length_rec, seg->length);
} }
if (cs->coll->strnncollsp(seg->charset, if (cs->coll->strnncollsp(seg->charset,

View File

@ -43,6 +43,11 @@
#define HAVE_ERRNO_AS_DEFINE #define HAVE_ERRNO_AS_DEFINE
#endif /* __CYGWIN__ */ #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__) #if defined(i386) && !defined(__i386__)
#define __i386__ #define __i386__
#endif #endif
@ -303,9 +308,15 @@ C_MODE_END
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
#define CONFIG_SMP #define CONFIG_SMP
#endif #endif
#if defined(__ia64__)
#define new my_arg_new
#endif
C_MODE_START C_MODE_START
#include <asm/atomic.h> #include <asm/atomic.h>
C_MODE_END C_MODE_END
#if defined(__ia64__)
#undef new
#endif
#endif #endif
#include <errno.h> /* Recommended by debian */ #include <errno.h> /* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */ /* We need the following to go around a problem with openssl on solaris */

View File

@ -89,7 +89,7 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -149,3 +149,6 @@ EXPORTS
mysql_server_init mysql_server_init
mysql_server_end mysql_server_end
get_defaults_files get_defaults_files
get_charset_by_csname
get_charsets_dir
charsets_dir

View File

@ -199,6 +199,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
unix_socket=0; unix_socket=0;
db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL; db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
if (client_flag & CLIENT_MULTI_STATEMENTS)
client_flag|= CLIENT_MULTI_RESULTS;
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->thd= create_embedded_thd(client_flag, db_name); mysql->thd= create_embedded_thd(client_flag, db_name);
init_embedded_mysql(mysql, client_flag, db_name); init_embedded_mysql(mysql, client_flag, db_name);
@ -209,11 +217,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql_init_charset(mysql)) if (mysql_init_charset(mysql))
goto error; goto error;
/* Send client information for access check */
client_flag|=CLIENT_CAPABILITIES;
client_flag&= ~CLIENT_COMPRESS;
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
mysql->server_status= SERVER_STATUS_AUTOCOMMIT; mysql->server_status= SERVER_STATUS_AUTOCOMMIT;
if (mysql->options.init_commands) if (mysql->options.init_commands)

View File

@ -568,3 +568,14 @@ NULL 1
Test 0 Test 0
NULL 1 NULL 1
drop table t1, t2, t3; 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;

View File

@ -817,6 +817,9 @@ drop table t1;
select 'c' like '\_' as want0; select 'c' like '\_' as want0;
want0 want0
0 0
SELECT SUBSTR('вася',-2);
SUBSTR('вася',-2)
ся
create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci); create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
insert into t1 values (1, 'Test'); insert into t1 values (1, 'Test');
select * from t1 where soundex(a) = soundex('Test'); select * from t1 where soundex(a) = soundex('Test');

View File

@ -1961,3 +1961,10 @@ a varchar(30), b varchar(30), primary key(a), key(b)
select distinct a from t1; select distinct a from t1;
a a
drop table t1; drop table t1;
create table t1(a int, key(a)) engine=innodb;
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
a count(a)
1 1
NULL 1
drop table t1;

View File

@ -748,3 +748,7 @@ TABLE_CONSTRAINTS TABLE_NAME select
KEY_COLUMN_USAGE TABLE_NAME select KEY_COLUMN_USAGE TABLE_NAME select
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
flush privileges; flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 15
mysql 17

View File

@ -167,3 +167,16 @@ a b c VALUES(a)
2 1 11 NULL 2 1 11 NULL
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; 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;

View File

@ -631,3 +631,63 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
/*!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` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
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` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
/*!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;

View File

@ -2476,3 +2476,13 @@ x
NULL NULL
1.0000 1.0000
drop table t1; 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;

View File

@ -1404,11 +1404,10 @@ show procedure status like '%p%'|
Db Name Type Definer Modified Created Security_type Comment Db Name Type Definer Modified Created Security_type Comment
drop table if exists fib| drop table if exists fib|
create table fib ( f bigint unsigned not null )| create table fib ( f bigint unsigned not null )|
insert into fib values (1), (1)|
drop procedure if exists fib| drop procedure if exists fib|
create procedure fib(n int unsigned) create procedure fib(n int unsigned)
begin begin
if n > 0 then if n > 1 then
begin begin
declare x, y bigint unsigned; declare x, y bigint unsigned;
declare c cursor for select f from fib order by f desc limit 2; declare c cursor for select f from fib order by f desc limit 2;
@ -1421,9 +1420,20 @@ call fib(n-1);
end; end;
end if; end if;
end| end|
insert into fib values (0), (1)|
call fib(3)|
select * from fib order by f asc|
f
0
1
1
2
delete from fib|
insert into fib values (0), (1)|
call fib(20)| call fib(20)|
select * from fib order by f asc| select * from fib order by f asc|
f f
0
1 1
1 1
2 2
@ -1444,8 +1454,6 @@ f
2584 2584
4181 4181
6765 6765
10946
17711
drop table fib| drop table fib|
drop procedure fib| drop procedure fib|
drop procedure if exists bar| drop procedure if exists bar|

View File

@ -460,3 +460,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; 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; SELECT * FROM t3;
drop table t1, t2, 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;

View File

@ -666,6 +666,12 @@ drop table t1;
# #
select 'c' like '\_' as want0; 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 # Bug #7730 Server crash using soundex on an utf8 table
# #

View File

@ -610,3 +610,14 @@ create table t1 (
--enable_warnings --enable_warnings
select distinct a from t1; select distinct a from t1;
drop table t1; drop table t1;
#
# Bug #9798: group by with rollup
#
--disable_warnings
create table t1(a int, key(a)) engine=innodb;
--enable_warnings
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
drop table t1;

View File

@ -486,3 +486,10 @@ where COLUMN_NAME='TABLE_NAME';
connection default; connection default;
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
flush privileges; flush privileges;
#
# Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;

View File

@ -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; SELECT *, VALUES(a) FROM t1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; 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;

View File

@ -204,3 +204,14 @@ CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\''); INSERT INTO t1 VALUES ('\'');
--exec $MYSQL_DUMP --skip-comments test t1 --exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1; DROP TABLE t1;
#
# Test for --insert-ignore
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore test t1
--exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1
DROP TABLE t1;

View File

@ -1,3 +1,5 @@
-- source include/have_innodb.inc
# #
# Problem with range optimizer # Problem with range optimizer
# #
@ -435,6 +437,7 @@ explain select * from t1 where a='aaa' collate latin1_german1_ci;
drop table t1; drop table t1;
# Test for BUG#9348 "result for WHERE A AND (B OR C) differs from WHERE a AND (C OR B)" # 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 ( CREATE TABLE t1 (
`CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', `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 '', `ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '',
@ -443,6 +446,7 @@ CREATE TABLE t1 (
`FUNCTINT` int(11) NOT NULL default '0', `FUNCTINT` int(11) NOT NULL default '0',
KEY `VERI_CLNT~2` (`ARG1`) KEY `VERI_CLNT~2` (`ARG1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0), 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), ('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0),

View File

@ -2056,3 +2056,19 @@ create table t1 (s1 int);
insert into t1 values (null),(1); insert into t1 values (null),(1);
select distinct avg(s1) as x from t1 group by s1 with rollup; select distinct avg(s1) as x from t1 group by s1 with rollup;
drop table t1; 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;
#

View File

@ -1634,8 +1634,6 @@ drop table if exists fib|
--enable_warnings --enable_warnings
create table fib ( f bigint unsigned not null )| create table fib ( f bigint unsigned not null )|
insert into fib values (1), (1)|
# We deliberately do it the awkward way, fetching the last two # We deliberately do it the awkward way, fetching the last two
# values from the table, in order to exercise various statements # values from the table, in order to exercise various statements
# and table accesses at each turn. # and table accesses at each turn.
@ -1644,7 +1642,7 @@ drop procedure if exists fib|
--enable_warnings --enable_warnings
create procedure fib(n int unsigned) create procedure fib(n int unsigned)
begin begin
if n > 0 then if n > 1 then
begin begin
declare x, y bigint unsigned; declare x, y bigint unsigned;
declare c cursor for select f from fib order by f desc limit 2; declare c cursor for select f from fib order by f desc limit 2;
@ -1659,6 +1657,20 @@ begin
end if; end if;
end| end|
# Minimum test: recursion of 3 levels
insert into fib values (0), (1)|
call fib(3)|
select * from fib order by f asc|
delete from fib|
# Original test: 20 levels (may run into memory limits!)
insert into fib values (0), (1)|
call fib(20)| call fib(20)|
select * from fib order by f asc| select * from fib order by f asc|

View File

@ -122,6 +122,7 @@ ParserRow<CPCDAPISession> commands[] =
CPCD_ARG("stderr", String, Optional, "Redirection of stderr"), CPCD_ARG("stderr", String, Optional, "Redirection of stderr"),
CPCD_ARG("stdin", String, Optional, "Redirection of stderr"), CPCD_ARG("stdin", String, Optional, "Redirection of stderr"),
CPCD_ARG("ulimit", String, Optional, "ulimit"), CPCD_ARG("ulimit", String, Optional, "ulimit"),
CPCD_ARG("shutdown", String, Optional, "shutdown options"),
CPCD_CMD("undefine process", &CPCDAPISession::undefineProcess, ""), CPCD_CMD("undefine process", &CPCDAPISession::undefineProcess, ""),
CPCD_CMD_ALIAS("undef", "undefine process", 0), CPCD_CMD_ALIAS("undef", "undefine process", 0),

View File

@ -243,6 +243,12 @@ public:
* @desc Format c:unlimited d:0 ... * @desc Format c:unlimited d:0 ...
*/ */
BaseString m_ulimit; BaseString m_ulimit;
/**
* @brief shutdown options
*/
BaseString m_shutdown_options;
private: private:
class CPCD *m_cpcd; class CPCD *m_cpcd;
void do_exec(); void do_exec();

View File

@ -44,6 +44,8 @@ CPCD::Process::print(FILE * f){
fprintf(f, "stdout: %s\n", m_stdout.c_str() ? m_stdout.c_str() : ""); 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, "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, "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) { 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("stdout", m_stdout);
props.get("stderr", m_stderr); props.get("stderr", m_stderr);
props.get("ulimit", m_ulimit); props.get("ulimit", m_ulimit);
props.get("shutdown", m_shutdown_options);
m_status = STOPPED; m_status = STOPPED;
if(strcasecmp(m_type.c_str(), "temporary") == 0){ if(strcasecmp(m_type.c_str(), "temporary") == 0){
@ -220,8 +223,11 @@ set_ulimit(const BaseString & pair){
if(!(list[1].trim() == "unlimited")){ if(!(list[1].trim() == "unlimited")){
value = atoi(list[1].c_str()); value = atoi(list[1].c_str());
} }
#if defined(__INTEL_COMPILER)
struct rlimit64 rlp;
#else
struct rlimit rlp; struct rlimit rlp;
#endif
#define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }}
if(list[0].trim() == "c"){ if(list[0].trim() == "c"){
@ -451,7 +457,11 @@ CPCD::Process::stop() {
m_status = STOPPING; m_status = STOPPING;
errno = 0; 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) { switch(ret) {
case 0: case 0:
logger.debug("Sent SIGTERM to pid %d", (int)-m_pid); logger.debug("Sent SIGTERM to pid %d", (int)-m_pid);

View File

@ -4061,12 +4061,14 @@ calcLHbits(Uint32 * lhPageBits, Uint32 * lhDistrBits,
tmp <<= 1; tmp <<= 1;
distrBits++; distrBits++;
}//while }//while
#ifdef ndb_classical_lhdistrbits
if (tmp != totalFragments) { if (tmp != totalFragments) {
tmp >>= 1; tmp >>= 1;
if ((fid >= (totalFragments - tmp)) && (fid < (tmp - 1))) { if ((fid >= (totalFragments - tmp)) && (fid < (tmp - 1))) {
distrBits--; distrBits--;
}//if }//if
}//if }//if
#endif
* lhPageBits = pageBits; * lhPageBits = pageBits;
* lhDistrBits = distrBits; * lhDistrBits = distrBits;

View File

@ -585,34 +585,8 @@ public:
*/ */
ArrayPool<TcIndexOperation> c_theIndexOperationPool; ArrayPool<TcIndexOperation> c_theIndexOperationPool;
/**
* The list of index operations
*/
ArrayList<TcIndexOperation> c_theIndexOperations;
UintR c_maxNumberOfIndexOperations; 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 *********************** /************************** API CONNECT RECORD ***********************
* The API connect record contains the connection record to which the * The API connect record contains the connection record to which the
* application connects. * application connects.
@ -650,7 +624,7 @@ public:
struct ApiConnectRecord { struct ApiConnectRecord {
ApiConnectRecord(ArrayPool<TcFiredTriggerData> & firedTriggerPool, ApiConnectRecord(ArrayPool<TcFiredTriggerData> & firedTriggerPool,
ArrayPool<TcSeizedIndexOperation> & seizedIndexOpPool): ArrayPool<TcIndexOperation> & seizedIndexOpPool):
theFiredTriggers(firedTriggerPool), theFiredTriggers(firedTriggerPool),
isIndexOp(false), isIndexOp(false),
theSeizedIndexOperations(seizedIndexOpPool) theSeizedIndexOperations(seizedIndexOpPool)
@ -763,7 +737,7 @@ public:
UintR accumulatingIndexOp; UintR accumulatingIndexOp;
UintR executingIndexOp; UintR executingIndexOp;
UintR tcIndxSendArray[6]; UintR tcIndxSendArray[6];
ArrayList<TcSeizedIndexOperation> theSeizedIndexOperations; ArrayList<TcIndexOperation> theSeizedIndexOperations;
}; };
typedef Ptr<ApiConnectRecord> ApiConnectRecordPtr; typedef Ptr<ApiConnectRecord> ApiConnectRecordPtr;

View File

@ -65,7 +65,6 @@ void Dbtc::initData()
c_theFiredTriggerPool.setSize(c_maxNumberOfFiredTriggers); c_theFiredTriggerPool.setSize(c_maxNumberOfFiredTriggers);
c_theIndexPool.setSize(c_maxNumberOfIndexes); c_theIndexPool.setSize(c_maxNumberOfIndexes);
c_theIndexOperationPool.setSize(c_maxNumberOfIndexOperations); c_theIndexOperationPool.setSize(c_maxNumberOfIndexOperations);
c_theSeizedIndexOperationPool.setSize(c_maxNumberOfIndexOperations);
c_theAttributeBufferPool.setSize(c_transactionBufferSpace); c_theAttributeBufferPool.setSize(c_transactionBufferSpace);
c_firedTriggerHash.setSize((c_maxNumberOfFiredTriggers+10)/10); c_firedTriggerHash.setSize((c_maxNumberOfFiredTriggers+10)/10);
}//Dbtc::initData() }//Dbtc::initData()
@ -85,7 +84,7 @@ void Dbtc::initRecords()
for(unsigned i = 0; i<capiConnectFilesize; i++) { for(unsigned i = 0; i<capiConnectFilesize; i++) {
p = &apiConnectRecord[i]; p = &apiConnectRecord[i];
new (p) ApiConnectRecord(c_theFiredTriggerPool, new (p) ApiConnectRecord(c_theFiredTriggerPool,
c_theSeizedIndexOperationPool); c_theIndexOperationPool);
} }
// Init all fired triggers // Init all fired triggers
DLFifoList<TcFiredTriggerData> triggers(c_theFiredTriggerPool); DLFifoList<TcFiredTriggerData> triggers(c_theFiredTriggerPool);
@ -177,7 +176,6 @@ Dbtc::Dbtc(const class Configuration & conf):
c_maxNumberOfFiredTriggers(0), c_maxNumberOfFiredTriggers(0),
c_theIndexes(c_theIndexPool), c_theIndexes(c_theIndexPool),
c_maxNumberOfIndexes(0), c_maxNumberOfIndexes(0),
c_theIndexOperations(c_theIndexOperationPool),
c_maxNumberOfIndexOperations(0), c_maxNumberOfIndexOperations(0),
m_commitAckMarkerHash(m_commitAckMarkerPool) m_commitAckMarkerHash(m_commitAckMarkerPool)
{ {

View File

@ -11368,18 +11368,18 @@ void Dbtc::execTCINDXREQ(Signal* signal)
jam(); jam();
// This is a newly started transaction, clean-up // This is a newly started transaction, clean-up
releaseAllSeizedIndexOperations(regApiPtr); releaseAllSeizedIndexOperations(regApiPtr);
regApiPtr->transid[0] = tcIndxReq->transId1;
regApiPtr->transid[1] = tcIndxReq->transId2;
}//if }//if
if (!seizeIndexOperation(regApiPtr, indexOpPtr)) {
if (ERROR_INSERTED(8036) || !seizeIndexOperation(regApiPtr, indexOpPtr)) {
jam(); jam();
// Failed to allocate index operation // Failed to allocate index operation
TcKeyRef * const tcIndxRef = (TcKeyRef *)signal->getDataPtrSend(); terrorCode = 288;
regApiPtr->m_exec_flag |= TcKeyReq::getExecuteFlag(tcIndxRequestInfo);
tcIndxRef->connectPtr = tcIndxReq->senderData; apiConnectptr = transPtr;
tcIndxRef->transId[0] = regApiPtr->transid[0]; abortErrorLab(signal);
tcIndxRef->transId[1] = regApiPtr->transid[1];
tcIndxRef->errorCode = 4000;
sendSignal(regApiPtr->ndbapiBlockref, GSN_TCINDXREF, signal,
TcKeyRef::SignalLength, JBB);
return; return;
} }
TcIndexOperation* indexOp = indexOpPtr.p; TcIndexOperation* indexOp = indexOpPtr.p;
@ -11514,8 +11514,9 @@ void Dbtc::execINDXKEYINFO(Signal* signal)
TcIndexOperationPtr indexOpPtr; TcIndexOperationPtr indexOpPtr;
TcIndexOperation* indexOp; TcIndexOperation* indexOp;
indexOpPtr.i = regApiPtr->accumulatingIndexOp; if((indexOpPtr.i = regApiPtr->accumulatingIndexOp) != RNIL)
indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); {
indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i);
if (saveINDXKEYINFO(signal, if (saveINDXKEYINFO(signal,
indexOp, indexOp,
src, src,
@ -11525,6 +11526,7 @@ void Dbtc::execINDXKEYINFO(Signal* signal)
readIndexTable(signal, regApiPtr, indexOp); readIndexTable(signal, regApiPtr, indexOp);
} }
} }
}
void Dbtc::execINDXATTRINFO(Signal* signal) void Dbtc::execINDXATTRINFO(Signal* signal)
{ {
@ -11545,8 +11547,9 @@ void Dbtc::execINDXATTRINFO(Signal* signal)
TcIndexOperationPtr indexOpPtr; TcIndexOperationPtr indexOpPtr;
TcIndexOperation* indexOp; TcIndexOperation* indexOp;
indexOpPtr.i = regApiPtr->accumulatingIndexOp; if((indexOpPtr.i = regApiPtr->accumulatingIndexOp) != RNIL)
indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); {
indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i);
if (saveINDXATTRINFO(signal, if (saveINDXATTRINFO(signal,
indexOp, indexOp,
src, src,
@ -11556,6 +11559,7 @@ void Dbtc::execINDXATTRINFO(Signal* signal)
readIndexTable(signal, regApiPtr, indexOp); readIndexTable(signal, regApiPtr, indexOp);
} }
} }
}
/** /**
* Save signal INDXKEYINFO * Save signal INDXKEYINFO
@ -11578,7 +11582,7 @@ bool Dbtc::saveINDXKEYINFO(Signal* signal,
releaseIndexOperation(apiConnectptr.p, indexOp); releaseIndexOperation(apiConnectptr.p, indexOp);
terrorCode = 4000; terrorCode = 4000;
abortErrorLab(signal); abortErrorLab(signal);
return true; return false;
} }
if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) { if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) {
jam(); jam();
@ -11611,7 +11615,7 @@ bool Dbtc::saveINDXATTRINFO(Signal* signal,
releaseIndexOperation(apiConnectptr.p, indexOp); releaseIndexOperation(apiConnectptr.p, indexOp);
terrorCode = 4000; terrorCode = 4000;
abortErrorLab(signal); abortErrorLab(signal);
return true; return false;
} }
if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) { if (receivedAllINDXKEYINFO(indexOp) && receivedAllINDXATTRINFO(indexOp)) {
jam(); jam();
@ -11671,7 +11675,7 @@ void Dbtc::execTCKEYCONF(Signal* signal)
jamEntry(); jamEntry();
indexOpPtr.i = tcKeyConf->apiConnectPtr; indexOpPtr.i = tcKeyConf->apiConnectPtr;
TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i);
Uint32 confInfo = tcKeyConf->confInfo; Uint32 confInfo = tcKeyConf->confInfo;
/** /**
@ -11760,7 +11764,7 @@ void Dbtc::execTCKEYREF(Signal* signal)
jamEntry(); jamEntry();
indexOpPtr.i = tcKeyRef->connectPtr; indexOpPtr.i = tcKeyRef->connectPtr;
TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i);
indexOpPtr.p = indexOp; indexOpPtr.p = indexOp;
if (!indexOp) { if (!indexOp) {
jam(); jam();
@ -11861,7 +11865,7 @@ void Dbtc::execTRANSID_AI(Signal* signal)
jamEntry(); jamEntry();
TcIndexOperationPtr indexOpPtr; TcIndexOperationPtr indexOpPtr;
indexOpPtr.i = transIdAI->connectPtr; indexOpPtr.i = transIdAI->connectPtr;
TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i);
indexOpPtr.p = indexOp; indexOpPtr.p = indexOp;
if (!indexOp) { if (!indexOp) {
jam(); jam();
@ -11969,7 +11973,7 @@ void Dbtc::execTCROLLBACKREP(Signal* signal)
jamEntry(); jamEntry();
TcIndexOperationPtr indexOpPtr; TcIndexOperationPtr indexOpPtr;
indexOpPtr.i = tcRollbackRep->connectPtr; indexOpPtr.i = tcRollbackRep->connectPtr;
TcIndexOperation* indexOp = c_theIndexOperations.getPtr(indexOpPtr.i); TcIndexOperation* indexOp = c_theIndexOperationPool.getPtr(indexOpPtr.i);
indexOpPtr.p = indexOp; indexOpPtr.p = indexOp;
tcRollbackRep = (TcRollbackRep *)signal->getDataPtrSend(); tcRollbackRep = (TcRollbackRep *)signal->getDataPtrSend();
tcRollbackRep->connectPtr = indexOp->tcIndxReq.senderData; tcRollbackRep->connectPtr = indexOp->tcIndxReq.senderData;
@ -12297,16 +12301,7 @@ void Dbtc::executeIndexOperation(Signal* signal,
bool Dbtc::seizeIndexOperation(ApiConnectRecord* regApiPtr, bool Dbtc::seizeIndexOperation(ApiConnectRecord* regApiPtr,
TcIndexOperationPtr& indexOpPtr) TcIndexOperationPtr& indexOpPtr)
{ {
bool seizeOk; return regApiPtr->theSeizedIndexOperations.seize(indexOpPtr);
seizeOk = c_theIndexOperations.seize(indexOpPtr);
if (seizeOk) {
jam();
TcSeizedIndexOperationPtr seizedIndexOpPtr;
seizeOk &= regApiPtr->theSeizedIndexOperations.seizeId(seizedIndexOpPtr,
indexOpPtr.i);
}
return seizeOk;
} }
void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr, void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr,
@ -12320,18 +12315,16 @@ void Dbtc::releaseIndexOperation(ApiConnectRecord* regApiPtr,
indexOp->expectedTransIdAI = 0; indexOp->expectedTransIdAI = 0;
indexOp->transIdAI.release(); indexOp->transIdAI.release();
regApiPtr->theSeizedIndexOperations.release(indexOp->indexOpId); regApiPtr->theSeizedIndexOperations.release(indexOp->indexOpId);
c_theIndexOperations.release(indexOp->indexOpId);
} }
void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr) void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr)
{ {
TcSeizedIndexOperationPtr seizedIndexOpPtr; TcIndexOperationPtr seizedIndexOpPtr;
regApiPtr->theSeizedIndexOperations.first(seizedIndexOpPtr); regApiPtr->theSeizedIndexOperations.first(seizedIndexOpPtr);
while(seizedIndexOpPtr.i != RNIL) { while(seizedIndexOpPtr.i != RNIL) {
jam(); jam();
TcIndexOperation* indexOp = TcIndexOperation* indexOp = seizedIndexOpPtr.p;
c_theIndexOperations.getPtr(seizedIndexOpPtr.i);
indexOp->indexOpState = IOS_NOOP; indexOp->indexOpState = IOS_NOOP;
indexOp->expectedKeyInfo = 0; indexOp->expectedKeyInfo = 0;
@ -12340,7 +12333,6 @@ void Dbtc::releaseAllSeizedIndexOperations(ApiConnectRecord* regApiPtr)
indexOp->attrInfo.release(); indexOp->attrInfo.release();
indexOp->expectedTransIdAI = 0; indexOp->expectedTransIdAI = 0;
indexOp->transIdAI.release(); indexOp->transIdAI.release();
c_theIndexOperations.release(seizedIndexOpPtr.i);
regApiPtr->theSeizedIndexOperations.next(seizedIndexOpPtr); regApiPtr->theSeizedIndexOperations.next(seizedIndexOpPtr);
} }
regApiPtr->theSeizedIndexOperations.release(); regApiPtr->theSeizedIndexOperations.release();

View File

@ -799,7 +799,11 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){
request->error = errno; request->error = errno;
return; return;
} }
#if defined(__INTEL_COMPILER)
struct dirent64 * dp;
#else
struct dirent * dp; struct dirent * dp;
#endif
while ((dp = readdir(dirp)) != NULL){ while ((dp = readdir(dirp)) != NULL){
if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) { if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) {
BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s", BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s",

View File

@ -130,7 +130,7 @@ ErrorReporter::formatMessage(ErrorCategory type,
"Date/Time: %s\nType of error: %s\n" "Date/Time: %s\nType of error: %s\n"
"Message: %s\nFault ID: %d\nProblem data: %s" "Message: %s\nFault ID: %d\nProblem data: %s"
"\nObject of reference: %s\nProgramName: %s\n" "\nObject of reference: %s\nProgramName: %s\n"
"ProcessID: %d\nTraceFile: %s\n***EOM***\n", "ProcessID: %d\nTraceFile: %s\n%s\n***EOM***\n",
formatTimeStampString() , formatTimeStampString() ,
errorType[type], errorType[type],
lookupErrorMessage(faultID), lookupErrorMessage(faultID),
@ -139,7 +139,8 @@ ErrorReporter::formatMessage(ErrorCategory type,
objRef, objRef,
my_progname, my_progname,
processId, processId,
theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>"); theNameOfTheTraceFile ? theNameOfTheTraceFile : "<no tracefile>",
NDB_VERSION_STRING);
// Add trailing blanks to get a fixed lenght of the message // Add trailing blanks to get a fixed lenght of the message
while (strlen(messptr) <= MESSAGE_LENGTH-3){ while (strlen(messptr) <= MESSAGE_LENGTH-3){

View File

@ -892,7 +892,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
args.put("initialstart", initial); args.put("initialstart", initial);
args.put("nostart", nostart); args.put("nostart", nostart);
const Properties *reply; 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); reply = ndb_mgm_call(handle, restart_reply, "restart all", &args);
handle->read_timeout= timeout;
CHECK_REPLY(reply, -1); CHECK_REPLY(reply, -1);
BaseString result; BaseString result;
@ -925,7 +928,10 @@ ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes, const int * node_list,
args.put("nostart", nostart); args.put("nostart", nostart);
const Properties *reply; 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); reply = ndb_mgm_call(handle, restart_reply, "restart node", &args);
handle->read_timeout= timeout;
if(reply != NULL) { if(reply != NULL) {
BaseString result; BaseString result;
reply->get("result", result); reply->get("result", result);

View File

@ -66,6 +66,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
{ {
ndbSetOwnVersion(); ndbSetOwnVersion();
clusterMgrThreadMutex = NdbMutex_Create(); clusterMgrThreadMutex = NdbMutex_Create();
noOfAliveNodes= 0;
noOfConnectedNodes= 0; noOfConnectedNodes= 0;
theClusterMgrThread= 0; theClusterMgrThread= 0;
} }
@ -336,9 +337,9 @@ ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
node.m_state = apiRegConf->nodeState; node.m_state = apiRegConf->nodeState;
if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED || if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED ||
node.m_state.startLevel == NodeState::SL_SINGLEUSER)){ node.m_state.startLevel == NodeState::SL_SINGLEUSER)){
node.m_alive = true; set_node_alive(node, true);
} else { } else {
node.m_alive = false; set_node_alive(node, false);
}//if }//if
node.hbSent = 0; node.hbSent = 0;
node.hbCounter = 0; node.hbCounter = 0;
@ -361,7 +362,7 @@ ClusterMgr::execAPI_REGREF(const Uint32 * theData){
assert(node.defined == true); assert(node.defined == true);
node.compatible = false; node.compatible = false;
node.m_alive = false; set_node_alive(node, false);
node.m_state = NodeState::SL_NOTHING; node.m_state = NodeState::SL_NOTHING;
node.m_info.m_version = ref->version; node.m_info.m_version = ref->version;
@ -446,7 +447,7 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
Node & theNode = theNodes[nodeId]; Node & theNode = theNodes[nodeId];
theNode.m_alive = false; set_node_alive(theNode, false);
theNode.m_info.m_connectCount ++; theNode.m_info.m_connectCount ++;
if(theNode.connected) if(theNode.connected)
@ -462,8 +463,7 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
} }
theNode.nfCompleteRep = false; theNode.nfCompleteRep = false;
if(noOfAliveNodes == 0){
if(noOfConnectedNodes == 0){
NFCompleteRep rep; NFCompleteRep rep;
for(Uint32 i = 1; i<MAX_NODES; i++){ for(Uint32 i = 1; i<MAX_NODES; i++){
if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){ if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){

View File

@ -80,6 +80,7 @@ public:
Uint32 getNoOfConnectedNodes() const; Uint32 getNoOfConnectedNodes() const;
private: private:
Uint32 noOfAliveNodes;
Uint32 noOfConnectedNodes; Uint32 noOfConnectedNodes;
Node theNodes[MAX_NODES]; Node theNodes[MAX_NODES];
NdbThread* theClusterMgrThread; NdbThread* theClusterMgrThread;
@ -100,6 +101,19 @@ private:
void execAPI_REGREF (const Uint32 * theData); void execAPI_REGREF (const Uint32 * theData);
void execNODE_FAILREP (const Uint32 * theData); void execNODE_FAILREP (const Uint32 * theData);
void execNF_COMPLETEREP(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 inline

View File

@ -764,7 +764,7 @@ Ndb::getAutoIncrementValue(const char* aTableName, Uint32 cacheSize)
DBUG_RETURN(~(Uint64)0); DBUG_RETURN(~(Uint64)0);
const NdbTableImpl *table= info->m_table_impl; const NdbTableImpl *table= info->m_table_impl;
Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize);
DBUG_PRINT("info", ("value %u", tupleId)); DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId); DBUG_RETURN(tupleId);
} }
@ -776,7 +776,7 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable, Uint32 cacheSize
DBUG_RETURN(~(Uint64)0); DBUG_RETURN(~(Uint64)0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize); Uint64 tupleId = getTupleIdFromNdb(table->m_tableId, cacheSize);
DBUG_PRINT("info", ("value %u", tupleId)); DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId); DBUG_RETURN(tupleId);
} }
@ -796,7 +796,8 @@ Ndb::getTupleIdFromNdb(Uint32 aTableId, Uint32 cacheSize)
if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] ) if ( theFirstTupleId[aTableId] != theLastTupleId[aTableId] )
{ {
theFirstTupleId[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]); DBUG_RETURN(theFirstTupleId[aTableId]);
} }
else // theFirstTupleId == theLastTupleId else // theFirstTupleId == theLastTupleId
@ -817,7 +818,7 @@ Ndb::readAutoIncrementValue(const char* aTableName)
DBUG_RETURN(~(Uint64)0); DBUG_RETURN(~(Uint64)0);
} }
Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); Uint64 tupleId = readTupleIdFromNdb(table->m_tableId);
DBUG_PRINT("info", ("value %u", tupleId)); DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId); DBUG_RETURN(tupleId);
} }
@ -829,7 +830,7 @@ Ndb::readAutoIncrementValue(const NdbDictionary::Table * aTable)
DBUG_RETURN(~(Uint64)0); DBUG_RETURN(~(Uint64)0);
const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable); const NdbTableImpl* table = & NdbTableImpl::getImpl(*aTable);
Uint64 tupleId = readTupleIdFromNdb(table->m_tableId); Uint64 tupleId = readTupleIdFromNdb(table->m_tableId);
DBUG_PRINT("info", ("value %u", tupleId)); DBUG_PRINT("info", ("value %ul", (ulong) tupleId));
DBUG_RETURN(tupleId); DBUG_RETURN(tupleId);
} }

View File

@ -173,7 +173,7 @@ ErrorBundle ErrorCodes[] = {
{ 4021, TR, "Out of Send Buffer space in NDB API" }, { 4021, TR, "Out of Send Buffer space in NDB API" },
{ 4022, 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" }, { 4032, TR, "Out of Send Buffer space in NDB API" },
{ 288, TR, "Out of index operations in transaction coordinator (increase MaxNoOfConcurrentIndexOperations)" },
/** /**
* InsufficientSpace * InsufficientSpace
*/ */

View File

@ -56,6 +56,7 @@ public:
BaseString m_stdout; BaseString m_stdout;
BaseString m_stderr; BaseString m_stderr;
BaseString m_ulimit; BaseString m_ulimit;
BaseString m_shutdown_options;
}; };
private: private:

View File

@ -359,7 +359,7 @@ int runLateCommit(NDBT_Context* ctx, NDBT_Step* step){
if(hugoOps.startTransaction(pNdb) != 0) if(hugoOps.startTransaction(pNdb) != 0)
return NDBT_FAILED; return NDBT_FAILED;
if(hugoOps.pkUpdateRecord(pNdb, 1) != 0) if(hugoOps.pkUpdateRecord(pNdb, 1, 128) != 0)
return NDBT_FAILED; return NDBT_FAILED;
if(hugoOps.execute_NoCommit(pNdb) != 0) if(hugoOps.execute_NoCommit(pNdb) != 0)

View File

@ -6,7 +6,12 @@ include $(top_srcdir)/ndb/config/type_util.mk.am
include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
test_PROGRAMS = atrt test_PROGRAMS = atrt
test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-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 \ 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 atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh

View File

@ -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: .

View File

@ -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: .

View File

@ -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: .

View File

@ -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: .

View File

@ -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: .

View File

@ -116,10 +116,7 @@ main(int argc, const char ** argv){
*/ */
if(restart){ if(restart){
g_logger.info("(Re)starting ndb processes"); g_logger.info("(Re)starting ndb processes");
if(!stop_processes(g_config, atrt_process::NDB_MGM)) if(!stop_processes(g_config, ~0))
goto end;
if(!stop_processes(g_config, atrt_process::NDB_DB))
goto end; goto end;
if(!start_processes(g_config, atrt_process::NDB_MGM)) if(!start_processes(g_config, atrt_process::NDB_MGM))
@ -142,6 +139,9 @@ main(int argc, const char ** argv){
goto end; goto end;
started: started:
if(!start_processes(g_config, p_servers))
goto end;
g_logger.info("Ndb start completed"); g_logger.info("Ndb start completed");
} }
@ -158,9 +158,6 @@ main(int argc, const char ** argv){
if(!setup_test_case(g_config, test_case)) if(!setup_test_case(g_config, test_case))
goto end; goto end;
if(!start_processes(g_config, p_servers))
goto end;
if(!start_processes(g_config, p_clients)) if(!start_processes(g_config, p_clients))
goto end; goto end;
@ -201,9 +198,6 @@ main(int argc, const char ** argv){
if(!stop_processes(g_config, p_clients)) if(!stop_processes(g_config, p_clients))
goto end; goto end;
if(!stop_processes(g_config, p_servers))
goto end;
if(!gather_result(g_config, &result)) if(!gather_result(g_config, &result))
goto end; 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_runas = proc.m_host->m_user;
proc.m_proc.m_ulimit = "c:unlimited"; proc.m_proc.m_ulimit = "c:unlimited";
proc.m_proc.m_env.assfmt("MYSQL_BASE_DIR=%s", dir.c_str()); 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_hostname = proc.m_host->m_hostname;
proc.m_ndb_mgm_port = g_default_base_port; proc.m_ndb_mgm_port = g_default_base_port;
if(split1[0] == "mgm"){ 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_path.assign(dir).append("/libexec/mysqld");
proc.m_proc.m_args = "--core-file --ndbcluster"; proc.m_proc.m_args = "--core-file --ndbcluster";
proc.m_proc.m_cwd.appfmt("%d.mysqld", index); proc.m_proc.m_cwd.appfmt("%d.mysqld", index);
if(mysql_port_offset > 0 || g_mysqld_use_base){ proc.m_proc.m_shutdown_options = "SIGKILL"; // not nice
// 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));
}
} else if(split1[0] == "api"){ } else if(split1[0] == "api"){
proc.m_type = atrt_process::NDB_API; proc.m_type = atrt_process::NDB_API;
proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api"); proc.m_proc.m_name.assfmt("%d-%s", index, "ndb_api");
proc.m_proc.m_path = ""; proc.m_proc.m_path = "";
proc.m_proc.m_args = ""; proc.m_proc.m_args = "";
proc.m_proc.m_cwd.appfmt("%d.ndb_api", index); 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 { } else {
g_logger.critical("%s:%d: Unhandled process type: %s", g_logger.critical("%s:%d: Unhandled process type: %s",
g_process_config_filename, lineno, g_process_config_filename, lineno,
@ -914,6 +907,11 @@ read_test_case(FILE * file, atrt_testcase& tc, int& line){
else else
tc.m_report= false; 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; return true;
} }
@ -928,16 +926,17 @@ setup_test_case(atrt_config& config, const atrt_testcase& tc){
size_t i = 0; size_t i = 0;
for(; i<config.m_processes.size(); i++){ for(; i<config.m_processes.size(); i++){
atrt_process & proc = config.m_processes[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(), proc.m_proc.m_path.assfmt("%s/bin/%s", proc.m_host->m_base_dir.c_str(),
tc.m_command.c_str()); tc.m_command.c_str());
proc.m_proc.m_args.assign(tc.m_args); proc.m_proc.m_args.assign(tc.m_args);
if(!tc.m_run_all)
break; break;
} }
} }
for(i++; i<config.m_processes.size(); i++){ for(i++; i<config.m_processes.size(); i++){
atrt_process & proc = config.m_processes[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_path.assign("");
proc.m_proc.m_args.assign(""); proc.m_proc.m_args.assign("");
} }

View File

@ -1,465 +1,101 @@
#!/bin/sh #!/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>]"
#: ${NDB_PROJ_HOME:?} # If undefined, exit with error message
#: ${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
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
}
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
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 $*
}
# --- 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
do
node=`skip 1 $node`
add_mgm_node $node
done
tmp=`grep "^baseport: " $machines | tail -1 | cut -d ":" -f 2`
if [ "$tmp" ]
then
baseport=`echo $tmp`
else
syndie "Unable to find baseport"
fi
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 ]
then
syndie "Unable to create dst dir: $dst_dir"
fi
DST=/tmp/$uniq_id
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`
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
baseport=""
basedir=""
proc_no=1
node_id=1 node_id=1
echo
# Mgm process d_file=/tmp/d.$$
echo dir_file=/tmp/dirs.$$
echo "[MGM]" config_file=/tmp/config.$$
echo "Id: $node_id" cluster_file=/tmp/cluster.$$
echo "ExecuteOnComputer: `get_mgm_computer_id 1`"
echo "PortNumber: $mgm_port" add_procs(){
type=$1; shift
while [ $# -ne 0 ]
do
add_proc $type $1
shift
done
}
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` node_id=`expr $node_id + 1`
;;
# Ndb processes api)
i=1 dir="ndb_api"
ndb_nodes=`trim $ndb_nodes` conf="[api]\nId: $node_id\nHostName: $2\n"
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` node_id=`expr $node_id + 1`
done ;;
ndb)
# API processes dir="ndbd"
i=1 conf="[ndbd]\nId: $node_id\nHostName: $2\n"
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` node_id=`expr $node_id + 1`
done ;;
mysqld)
# Connections dir="mysqld"
current_port=`expr $mgm_port + 1` conf="[mysqld]\nId: $node_id\nHostName: $2\n"
echo node_id=`expr $node_id + 1`
;;
# Connect Mgm with all ndb-nodes mysql)
i=1 dir="mysql"
while [ $i -le $ndb_nodes ] ;;
do esac
echo dir="$proc_no.$dir"
echo "[TCP]" proc_no=`expr $proc_no + 1`
echo "NodeId1: 1" echo -e $dir >> $dir_file
echo "NodeId2: `expr $i + 1`" if [ "$conf" ]
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 then
cat $DST echo -e $conf >> $config_file
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 fi
} }
mkcfg mgm 1
cat $DST > $dst_dir/1.ndb_mgm/initconfig.txt
trace "Creating Ndb.cfg for ndb nodes" cnf=/dev/null
cat $1 | while read line
current_node=2
i=1
while [ $i -le $ndb_nodes ]
do do
mkcfg db ${current_node} case $line in
i=`expr $i + 1` baseport:*) baseport=`echo $line | sed 's/baseport[ ]*:[ ]*//g'`;;
current_node=`expr $current_node + 1` 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 done
trace "Creating Ndb.cfg for api nodes" cat $dir_file | xargs mkdir -p
i=1 if [ -f $cluster_file ]
while [ $i -le $api_nodes ] then
cat $cluster_file $config_file >> /tmp/config2.$$
mv /tmp/config2.$$ $config_file
fi
for i in `find . -type d -name '*.ndb_mgmd'`
do do
mkcfg api ${current_node} cp $config_file $i/config.ini
i=`expr $i + 1`
current_node=`expr $current_node + 1`
done done
rm -f $DST mv $d_file d.txt
rm -f /tmp/hosts.$uniq_id rm -f $config_file $dir_file $cluster_file
exit 0
# vim: set sw=4:

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
save_args=$* save_args=$*
VERSION="ndb-autotest.sh version 1.0" VERSION="ndb-autotest.sh version 1.04"
DATE=`date '+%Y-%m-%d'` DATE=`date '+%Y-%m-%d'`
export DATE export DATE
@ -71,11 +71,18 @@ then
cd $dst_place cd $dst_place
rm -rf $run_dir/* rm -rf $run_dir/*
aclocal; autoheader; autoconf; automake aclocal; autoheader; autoconf; automake
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 innobase; aclocal; autoheader; autoconf; automake)
(cd bdb/dist; sh s_all) (cd bdb/dist; sh s_all)
fi
eval $configure --prefix=$run_dir eval $configure --prefix=$run_dir
make make
make install make install
(cd $run_dir; ./bin/mysql_install_db)
fi fi
### ###
@ -103,7 +110,9 @@ fi
test_dir=$run_dir/mysql-test/ndb test_dir=$run_dir/mysql-test/ndb
atrt=$test_dir/atrt atrt=$test_dir/atrt
html=$test_dir/make-html-reports.sh 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 export PATH
filter(){ filter(){
@ -125,17 +134,13 @@ hosts=`cat /tmp/hosts.$DATE`
if [ "$deploy" ] if [ "$deploy" ]
then then
(cd / && tar cfz /tmp/build.$DATE.tgz $run_dir )
for i in $hosts for i in $hosts
do do
ok=0 rsync -a --delete --force --ignore-errors $run_dir/ $i:$run_dir
scp /tmp/build.$DATE.tgz $i:/tmp/build.$DATE.$$.tgz && \ ok=$?
ssh $i "rm -rf /space/autotest/*" && \ if [ $ok -ne 0 ]
ssh $i "cd / && tar xfz /tmp/build.$DATE.$$.tgz" && \
ssh $i "rm /tmp/build.$DATE.$$.tgz" && ok=1
if [ $ok -eq 0 ]
then then
echo "$i failed during scp/ssh, excluding" echo "$i failed during rsync, excluding"
echo $i >> /tmp/failed.$DATE echo $i >> /tmp/failed.$DATE
fi fi
done done
@ -170,6 +175,18 @@ choose(){
cat $TMP1 cat $TMP1
rm -f $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(){ start(){
rm -rf report.txt result* log.txt rm -rf report.txt result* log.txt
$atrt -v -v -r -R --log-file=log.txt --testcase-file=$test_dir/$2-tests.txt & $atrt -v -v -r -R --log-file=log.txt --testcase-file=$test_dir/$2-tests.txt &
@ -186,11 +203,17 @@ start(){
p2=`pwd` p2=`pwd`
cd .. cd ..
tar cfz /tmp/res.$$.tgz `basename $p2`/$DATE tar cfz /tmp/res.$$.tgz `basename $p2`/$DATE
scp /tmp/res.$$.tgz $result_host:$result_path scp /tmp/res.$$.tgz $result_host:$result_path/res.$DATE.`hostname -s`.$2.$$.tgz
ssh $result_host "cd $result_path && tar xfz res.$$.tgz && rm -f res.$$.tgz"
rm -f /tmp/res.$$.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` p=`pwd`
for dir in $RUN for dir in $RUN
do do
@ -199,10 +222,11 @@ do
run_dir=$base_dir/run-$dir-mysql-$clone-$target run_dir=$base_dir/run-$dir-mysql-$clone-$target
res_dir=$base_dir/result-$dir-mysql-$clone-$target/$DATE res_dir=$base_dir/result-$dir-mysql-$clone-$target/$DATE
mkdir -p $res_dir mkdir -p $run_dir $res_dir
rm -rf $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_hosts=`filter /tmp/filter_hosts.$$ $hosts`
avail=`echo $avail_hosts | wc -w` avail=`echo $avail_hosts | wc -w`
if [ $count -gt $avail ] if [ $count -gt $avail ]
@ -213,11 +237,11 @@ do
fi fi
run_hosts=`echo $avail_hosts|awk '{for(i=1;i<='$count';i++)print $i;}'` 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
echo $run_hosts >> /tmp/filter_hosts.$$ echo $run_hosts >> /tmp/filter_hosts.$$
cd $run_dir cd $run_dir
choose $conf $run_hosts > d.tmp
$mkconfig d.tmp
start $dir-mysql-$clone-$target $dir $res_dir & start $dir-mysql-$clone-$target $dir $res_dir &
done done
cd $p cd $p

View File

@ -69,6 +69,7 @@ struct atrt_config {
struct atrt_testcase { struct atrt_testcase {
bool m_report; bool m_report;
bool m_run_all;
time_t m_max_time; time_t m_max_time;
BaseString m_command; BaseString m_command;
BaseString m_args; BaseString m_args;

View File

@ -282,6 +282,7 @@ convert(const Properties & src, SimpleCpcClient::Process & dst){
b &= src.get("stdout", dst.m_stdout); b &= src.get("stdout", dst.m_stdout);
b &= src.get("stderr", dst.m_stderr); b &= src.get("stderr", dst.m_stderr);
b &= src.get("ulimit", dst.m_ulimit); b &= src.get("ulimit", dst.m_ulimit);
b &= src.get("shutdown", dst.m_shutdown_options);
return b; 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("stdout", src.m_stdout.c_str());
b &= dst.put("stderr", src.m_stderr.c_str()); b &= dst.put("stderr", src.m_stderr.c_str());
b &= dst.put("ulimit", src.m_ulimit.c_str()); b &= dst.put("ulimit", src.m_ulimit.c_str());
b &= dst.put("shutdown", src.m_shutdown_options.c_str());
return b; return b;
} }
@ -372,6 +374,7 @@ SimpleCpcClient::list_processes(Vector<Process> &procs, Properties& reply) {
CPC_ARG("stdout",String, Mandatory, "Redirect stdout"), CPC_ARG("stdout",String, Mandatory, "Redirect stdout"),
CPC_ARG("stderr",String, Mandatory, "Redirect stderr"), CPC_ARG("stderr",String, Mandatory, "Redirect stderr"),
CPC_ARG("ulimit",String, Mandatory, "ulimit"), CPC_ARG("ulimit",String, Mandatory, "ulimit"),
CPC_ARG("shutdown",String, Mandatory, "shutdown"),
CPC_END() CPC_END()
}; };

View File

@ -15,6 +15,7 @@ MV="mv"
STRIP=1 STRIP=1
DEBUG=0 DEBUG=0
SILENT=0 SILENT=0
MACHINE=
TMP=/tmp TMP=/tmp
SUFFIX="" SUFFIX=""
NDBCLUSTER= NDBCLUSTER=
@ -26,6 +27,7 @@ parse_arguments() {
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--no-strip) STRIP=0 ;; --no-strip) STRIP=0 ;;
--machine) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
--silent) SILENT=1 ;; --silent) SILENT=1 ;;
--with-ndbcluster) NDBCLUSTER=1 ;; --with-ndbcluster) NDBCLUSTER=1 ;;
*) *)
@ -38,6 +40,8 @@ parse_arguments() {
parse_arguments "$@" parse_arguments "$@"
#make #make
# This should really be integrated with automake and not duplicate the # This should really be integrated with automake and not duplicate the
@ -294,8 +298,33 @@ if [ x$NDBCLUSTER = x1 ]; then
rm -rf $BASE/ndb-stage rm -rf $BASE/ndb-stage
fi fi
# Remove vendor from $system
system=`echo $system | sed -e 's/[a-z]*-\(.*\)/\1/g'`
# Map OS names to "our" OS names (eg. darwin6.8 -> osx10.2)
system=`echo $system | sed -e 's/darwin6.*/osx10.2/g'`
system=`echo $system | sed -e 's/darwin7.*/osx10.3/g'`
system=`echo $system | sed -e 's/darwin8.*/osx10.4/g'`
system=`echo $system | sed -e 's/\(aix4.3\).*/\1/g'`
system=`echo $system | sed -e 's/\(aix5.1\).*/\1/g'`
system=`echo $system | sed -e 's/\(aix5.2\).*/\1/g'`
system=`echo $system | sed -e 's/\(aix5.3\).*/\1/g'`
system=`echo $system | sed -e 's/osf5.1b/tru64/g'`
system=`echo $system | sed -e 's/linux-gnu/linux/g'`
system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'`
system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'`
# Use the override --machine if present
if [ $MACHINE != "" ] ; then
machine= $MACHINE
fi
# Change the distribution to a long descriptive name # Change the distribution to a long descriptive name
NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX
# Print the platform name for build logs
echo "PLATFORM NAME: $system-$machine"
BASE2=$TMP/$NEW_NAME BASE2=$TMP/$NEW_NAME
rm -r -f $BASE2 rm -r -f $BASE2
mv $BASE $BASE2 mv $BASE $BASE2

View File

@ -11,7 +11,6 @@ in_rpm=0
windows=0 windows=0
defaults="" defaults=""
user="" user=""
tmp_file=/tmp/mysql_install_db.$$
case "$1" in case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*) --no-defaults|--defaults-file=*|--defaults-extra-file=*)
@ -223,10 +222,8 @@ then
then then
echo "Fill help tables" echo "Fill help tables"
fi fi
echo "use mysql;" > $tmp_file (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line"
cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line"
res=$? res=$?
rm $tmp_file
if test $res != 0 if test $res != 0
then then
echo "" echo ""

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -21,7 +21,7 @@
that you can implement. that you can implement.
*/ */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -20,7 +20,7 @@
variables must declare the size_of() member function. variables must declare the size_of() member function.
*/ */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -19,7 +19,7 @@
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
#endif #endif
#include <mysql_priv.h> #include "mysql_priv.h"
#ifdef HAVE_BLACKHOLE_DB #ifdef HAVE_BLACKHOLE_DB
#include "ha_blackhole.h" #include "ha_blackhole.h"

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -21,7 +21,7 @@
Innodb Innodb
*/ */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -3050,8 +3050,10 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
m_rows_inserted= (ha_rows) 0; m_rows_inserted= (ha_rows) 0;
if (rows == (ha_rows) 0) if (rows == (ha_rows) 0)
{
/* We don't know how many will be inserted, guess */ /* We don't know how many will be inserted, guess */
m_rows_to_insert= m_autoincrement_prefetch; m_rows_to_insert= m_autoincrement_prefetch;
}
else else
m_rows_to_insert= rows; m_rows_to_insert= rows;
@ -4174,8 +4176,10 @@ ulonglong ha_ndbcluster::get_auto_increment()
Ndb *ndb= get_ndb(); Ndb *ndb= get_ndb();
if (m_rows_inserted > m_rows_to_insert) if (m_rows_inserted > m_rows_to_insert)
{
/* We guessed too low */ /* We guessed too low */
m_rows_to_insert+= m_autoincrement_prefetch; m_rows_to_insert+= m_autoincrement_prefetch;
}
cache_size= cache_size=
(int) (int)
(m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ? (m_rows_to_insert - m_rows_inserted < m_autoincrement_prefetch) ?
@ -6101,8 +6105,8 @@ const
COND* COND*
ha_ndbcluster::cond_push(const COND *cond) ha_ndbcluster::cond_push(const COND *cond)
{ {
Ndb_cond_stack *ndb_cond = new Ndb_cond_stack();
DBUG_ENTER("cond_push"); DBUG_ENTER("cond_push");
Ndb_cond_stack *ndb_cond = new Ndb_cond_stack();
DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname);); DBUG_EXECUTE("where",print_where((COND *)cond, m_tabname););
if (m_cond_stack) if (m_cond_stack)
ndb_cond->next= m_cond_stack; ndb_cond->next= m_cond_stack;
@ -6118,7 +6122,6 @@ ha_ndbcluster::cond_push(const COND *cond)
{ {
cond_pop(); cond_pop();
} }
DBUG_RETURN(cond); DBUG_RETURN(cond);
} }

View File

@ -21,7 +21,7 @@
/* The class defining a handle to an NDB Cluster table */ /* The class defining a handle to an NDB Cluster table */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* Definitions for parameters to do with handler-routines */ /* Definitions for parameters to do with handler-routines */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* compare and test functions */ /* compare and test functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -2533,6 +2533,28 @@ longlong Item_func_bit_count::val_int()
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
void udf_handler::cleanup()
{
if (!not_original)
{
if (initialized)
{
if (u_d->func_deinit != NULL)
{
void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*))
u_d->func_deinit;
(*deinit)(&initid);
}
free_udf(u_d);
initialized= FALSE;
}
if (buffers) // Because of bug in ecc
delete [] buffers;
buffers= 0;
}
}
bool bool
udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func, udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
uint arg_count, Item **arguments) uint arg_count, Item **arguments)
@ -2805,6 +2827,13 @@ my_decimal *udf_handler::val_decimal(my_bool *null_value, my_decimal *dec_buf)
} }
void Item_udf_func::cleanup()
{
udf.cleanup();
Item_func::cleanup();
}
double Item_func_udf_float::val_real() double Item_func_udf_float::val_real()
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
@ -2930,21 +2959,8 @@ String *Item_func_udf_str::val_str(String *str)
udf_handler::~udf_handler() udf_handler::~udf_handler()
{ {
if (!not_original) /* Everything should be properly cleaned up by this moment. */
{ DBUG_ASSERT(not_original || !(initialized || buffers));
if (initialized)
{
if (u_d->func_deinit != NULL)
{
void (*deinit)(UDF_INIT *) = (void (*)(UDF_INIT*))
u_d->func_deinit;
(*deinit)(&initid);
}
free_udf(u_d);
}
if (buffers) // Because of bug in ecc
delete [] buffers;
}
} }
#else #else

View File

@ -17,7 +17,7 @@
/* Function items used by mysql */ /* Function items used by mysql */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
@ -879,6 +879,7 @@ public:
fixed= 1; fixed= 1;
return res; return res;
} }
void cleanup();
Item_result result_type () const { return udf.result_type(); } Item_result result_type () const { return udf.result_type(); }
table_map not_null_tables() const { return 0; } table_map not_null_tables() const { return 0; }
}; };

View File

@ -19,7 +19,7 @@
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -1013,7 +1013,7 @@ String *Item_func_substr::val_str(String *str)
if ((null_value=(args[0]->null_value || args[1]->null_value || if ((null_value=(args[0]->null_value || args[1]->null_value ||
(arg_count == 3 && args[2]->null_value)))) (arg_count == 3 && args[2]->null_value))))
return 0; /* purecov: inspected */ 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); start=res->charpos(start);
length=res->charpos(length,start); length=res->charpos(length,start);
if (start < 0 || (uint) start+1 > res->length() || length <= 0) if (start < 0 || (uint) start+1 > res->length() || length <= 0)

View File

@ -17,7 +17,7 @@
/* This file defines all string functions */ /* This file defines all string functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -16,7 +16,7 @@
/* subselect Item */ /* subselect Item */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -2456,6 +2456,17 @@ bool Item_udf_sum::add()
DBUG_RETURN(0); 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) Item *Item_sum_udf_float::copy_or_same(THD* thd)
{ {
return new (thd->mem_root) Item_sum_udf_float(thd, this); return new (thd->mem_root) Item_sum_udf_float(thd, this);

View File

@ -17,7 +17,7 @@
/* classes for sum functions */ /* classes for sum functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
@ -667,6 +667,7 @@ public:
bool add(); bool add();
void reset_field() {}; void reset_field() {};
void update_field() {}; void update_field() {};
void cleanup();
}; };

View File

@ -17,7 +17,7 @@
/* Function items used by mysql */ /* Function items used by mysql */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -268,6 +268,9 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define OPTION_SCHEMA_TABLE (1L << 29) #define OPTION_SCHEMA_TABLE (1L << 29)
/* Flag set if setup_tables already done */ /* Flag set if setup_tables already done */
#define OPTION_SETUP_TABLES_DONE (1L << 30) #define OPTION_SETUP_TABLES_DONE (1L << 30)
/* Thr following is used to detect a conflict with DISTINCT
in the user query has requested */
#define SELECT_ALL (ULL(1) << 32)
/* /*
Maximum length of time zone name that we support Maximum length of time zone name that we support

View File

@ -6670,6 +6670,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
- NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in - NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in
GROUP BY and not referenced by MIN/MAX functions. GROUP BY and not referenced by MIN/MAX functions.
with the following properties specified below. with the following properties specified below.
B3. If Q has a GROUP BY WITH ROLLUP clause the access method is not
applicable.
SA1. There is at most one attribute in SA referenced by any number of SA1. There is at most one attribute in SA referenced by any number of
MIN and/or MAX functions which, which if present, is denoted as C. MIN and/or MAX functions which, which if present, is denoted as C.
@ -6754,6 +6756,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
other field as in: "select min(a) from t1 group by a" ? other field as in: "select min(a) from t1 group by a" ?
- We assume that the general correctness of the GROUP-BY query was checked - We assume that the general correctness of the GROUP-BY query was checked
before this point. Is this correct, or do we have to check it completely? before this point. Is this correct, or do we have to check it completely?
- Lift the limitation in condition (B3), that is, make this access method
applicable to ROLLUP queries.
RETURN RETURN
If mem_root != NULL If mem_root != NULL
@ -6793,7 +6797,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
DBUG_RETURN(NULL); /* This is not a select statement. */ DBUG_RETURN(NULL); /* This is not a select statement. */
if ((join->tables != 1) || /* The query must reference one table. */ if ((join->tables != 1) || /* The query must reference one table. */
((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */ ((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */
(!join->select_distinct))) (!join->select_distinct)) ||
(thd->lex->select_lex.olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
if (table->s->keys == 0) /* There are no indexes to use. */ if (table->s->keys == 0) /* There are no indexes to use. */
DBUG_RETURN(NULL); DBUG_RETURN(NULL);

View File

@ -20,7 +20,7 @@
#ifndef _opt_range_h #ifndef _opt_range_h
#define _opt_range_h #define _opt_range_h
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* When using sql procedures */ /* When using sql procedures */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -16,7 +16,7 @@
/* Classes to support the SET command */ /* Classes to support the SET command */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* Classes in mysql */ /* Classes in mysql */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -897,7 +897,11 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto err; goto err;
if ((error=table->file->update_row(table->record[1],table->record[0]))) if ((error=table->file->update_row(table->record[1],table->record[0])))
{
if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
break;
goto err; goto err;
}
info->updated++; info->updated++;
break; break;
} }

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -1433,9 +1433,6 @@ bool do_command(THD *thd)
} }
else else
{ {
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
thd->killed= THD::NOT_KILLED;
packet=(char*) net->read_pos; packet=(char*) net->read_pos;
command = (enum enum_server_command) (uchar) packet[0]; command = (enum enum_server_command) (uchar) packet[0];
if (command >= COM_END) if (command >= COM_END)
@ -1482,6 +1479,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
bool error= 0; bool error= 0;
DBUG_ENTER("dispatch_command"); DBUG_ENTER("dispatch_command");
if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA)
thd->killed= THD::NOT_KILLED;
thd->command=command; thd->command=command;
/* /*
Commands which will always take a long time should be marked with Commands which will always take a long time should be marked with

View File

@ -5403,10 +5403,15 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
tab->select_cond=sel->cond=tmp; tab->select_cond=sel->cond=tmp;
if (thd->variables.engine_condition_pushdown) if (thd->variables.engine_condition_pushdown)
{ {
COND *push_cond=
make_cond_for_table(cond,current_map,current_map);
tab->table->file->pushed_cond= NULL; tab->table->file->pushed_cond= NULL;
if (push_cond)
{
/* Push condition to handler */ /* Push condition to handler */
if (!tab->table->file->cond_push(tmp)) if (!tab->table->file->cond_push(push_cond))
tab->table->file->pushed_cond= tmp; tab->table->file->pushed_cond= push_cond;
}
} }
} }
else else
@ -5530,13 +5535,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
thd->memdup((gptr) sel, sizeof(SQL_SELECT)); thd->memdup((gptr) sel, sizeof(SQL_SELECT));
tab->cache.select->cond=tmp; tab->cache.select->cond=tmp;
tab->cache.select->read_tables=join->const_table_map; tab->cache.select->read_tables=join->const_table_map;
if (thd->variables.engine_condition_pushdown &&
(!tab->table->file->pushed_cond))
{
/* Push condition to handler */
if (!tab->table->file->cond_push(tmp))
tab->table->file->pushed_cond= tmp;
}
} }
} }
} }

View File

@ -17,7 +17,7 @@
/* classes to use when handling where clause */ /* classes to use when handling where clause */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -16,7 +16,7 @@
/* This file is originally from the mysql distribution. Coded by monty */ /* This file is originally from the mysql distribution. Coded by monty */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif

View File

@ -17,7 +17,7 @@
/* This file defines structures needed by udf functions */ /* This file defines structures needed by udf functions */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface #pragma interface
#endif #endif
@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc
bool get_arguments(); bool get_arguments();
bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item,
uint arg_count,Item **args); uint arg_count,Item **args);
void cleanup();
double val(my_bool *null_value) double val(my_bool *null_value)
{ {
if (get_arguments()) if (get_arguments())

View File

@ -4000,7 +4000,15 @@ select_option:
YYABORT; YYABORT;
Lex->lock_option= TL_READ_HIGH_PRIORITY; 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_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; } | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
| SQL_BUFFER_RESULT | SQL_BUFFER_RESULT
@ -4020,7 +4028,15 @@ select_option:
{ {
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE; 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: select_lock_type:
@ -4458,8 +4474,6 @@ simple_expr:
{ $$= new Item_func_export_set($3, $5, $7, $9); } { $$= new Item_func_export_set($3, $5, $7, $9); }
| EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')' | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')'
{ $$= new Item_func_export_set($3, $5, $7, $9, $11); } { $$= new Item_func_export_set($3, $5, $7, $9, $11); }
| FALSE_SYM
{ $$= new Item_int((char*) "FALSE",0,1); }
| FORMAT_SYM '(' expr ',' NUM ')' | FORMAT_SYM '(' expr ',' NUM ')'
{ $$= new Item_func_format($3,atoi($5.str)); } { $$= new Item_func_format($3,atoi($5.str)); }
| FROM_UNIXTIME '(' expr ')' | FROM_UNIXTIME '(' expr ')'
@ -4618,8 +4632,6 @@ simple_expr:
{ $$= new Item_func_trim($5,$3); } { $$= new Item_func_trim($5,$3); }
| TRUNCATE_SYM '(' expr ',' expr ')' | TRUNCATE_SYM '(' expr ',' expr ')'
{ $$= new Item_func_round($3,$5,1); } { $$= new Item_func_round($3,$5,1); }
| TRUE_SYM
{ $$= new Item_int((char*) "TRUE",1,1); }
| ident '.' ident '(' udf_expr_list ')' | ident '.' ident '(' udf_expr_list ')'
{ {
LEX *lex= Lex; LEX *lex= Lex;
@ -6834,6 +6846,8 @@ literal:
| NUM_literal { $$ = $1; } | NUM_literal { $$ = $1; }
| NULL_SYM { $$ = new Item_null(); | NULL_SYM { $$ = new Item_null();
Lex->next_state=MY_LEX_OPERATOR_OR_IDENT;} 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_hex_string($1.str, $1.length);} | HEX_NUM { $$ = new Item_hex_string($1.str, $1.length);}
| BIN_NUM { $$= new Item_bin_string($1.str, $1.length); } | BIN_NUM { $$= new Item_bin_string($1.str, $1.length); }
| UNDERSCORE_CHARSET HEX_NUM | UNDERSCORE_CHARSET HEX_NUM

View File

@ -59,6 +59,7 @@ static byte* get_field_name(Field **buff,uint *length,
3 Wrong data in .frm file 3 Wrong data in .frm file
4 Error (see frm_error) 4 Error (see frm_error)
5 Error (see frm_error: charset unavailable) 5 Error (see frm_error: charset unavailable)
6 Unknown .frm version
*/ */
int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
@ -135,10 +136,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
*fn_ext(share->table_name)='\0'; // Remove extension *fn_ext(share->table_name)='\0'; // Remove extension
*fn_ext(share->path)='\0'; // Remove extension *fn_ext(share->path)='\0'; // Remove extension
if (head[0] != (uchar) 254 || head[1] != 1 || if (head[0] != (uchar) 254 || head[1] != 1)
(head[2] != FRM_VER && head[2] != FRM_VER+1 &&
! (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4)))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
if (head[2] != FRM_VER && head[2] != FRM_VER+1 &&
! (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4))
{
error= 6;
goto err; /* purecov: inspected */
}
new_field_pack_flag=head[27]; new_field_pack_flag=head[27];
new_frm_ver= (head[2] - FRM_VER); new_frm_ver= (head[2] - FRM_VER);
field_pack_length= new_frm_ver < 2 ? 11 : 17; field_pack_length= new_frm_ver < 2 ? 11 : 17;
@ -1084,6 +1089,12 @@ static void frm_error(int error, TABLE *form, const char *name,
MYF(0), csname, real_name); MYF(0), csname, real_name);
break; 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 */ default: /* Better wrong error than none */
case 4: case 4:
my_error(ER_NOT_FORM_FILE, errortype, my_error(ER_NOT_FORM_FILE, errortype,

View File

@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef __GNUC__ #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class interface */ #pragma interface /* gcc class interface */
#endif #endif

View File

@ -4591,7 +4591,7 @@ uint my_well_formed_len_sjis(CHARSET_INFO *cs __attribute__((unused)),
{ {
const char *b0= b; const char *b0= b;
*error= 0; *error= 0;
while (pos && b < e) while (pos-- && b < e)
{ {
if ((uchar) b[0] < 128) if ((uchar) b[0] < 128)
{ {