Commit 90c926d9 authored by unknown's avatar unknown

Merge shellback.(none):/home/msvensson/mysql/mysql-5.0

into  shellback.(none):/home/msvensson/mysql/mysql-5.1


client/mysqltest.c:
  Auto merged
include/config-win.h:
  Auto merged
include/m_ctype.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
strings/ctype-bin.c:
  Auto merged
strings/ctype-euc_kr.c:
  Auto merged
strings/ctype-gb2312.c:
  Auto merged
strings/ctype-ucs2.c:
  Auto merged
parents 045d42e5 a1c46189
...@@ -463,6 +463,7 @@ static VAR* var_init(VAR* v, const char *name, int name_len, const char *val, ...@@ -463,6 +463,7 @@ static VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
static void var_free(void* v); static void var_free(void* v);
void dump_result_to_reject_file(const char *record_file, char *buf, int size); void dump_result_to_reject_file(const char *record_file, char *buf, int size);
void dump_result_to_log_file(const char *record_file, char *buf, int size);
int close_connection(struct st_query*); int close_connection(struct st_query*);
static void set_charset(struct st_query*); static void set_charset(struct st_query*);
...@@ -671,9 +672,9 @@ static void die(const char *fmt, ...) ...@@ -671,9 +672,9 @@ static void die(const char *fmt, ...)
} }
va_end(args); va_end(args);
/* Dump the result that has been accumulated so far to reject file */ /* Dump the result that has been accumulated so far to .log file */
if (result_file && ds_res.length) if (result_file && ds_res.length)
dump_result_to_reject_file(result_file, ds_res.str, ds_res.length); dump_result_to_log_file(result_file, ds_res.str, ds_res.length);
/* Clean up and exit */ /* Clean up and exit */
free_used_memory(); free_used_memory();
...@@ -3500,6 +3501,12 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size) ...@@ -3500,6 +3501,12 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size)
str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size); str_to_file(fn_format(reject_file, record_file,"",".reject",2), buf, size);
} }
void dump_result_to_log_file(const char *record_file, char *buf, int size)
{
char log_file[FN_REFLEN];
str_to_file(fn_format(log_file, record_file,"",".log",2), buf, size);
}
static void check_regerr(my_regex_t* r, int err) static void check_regerr(my_regex_t* r, int err)
{ {
char err_buf[1024]; char err_buf[1024];
......
...@@ -422,8 +422,15 @@ inline double ulonglong2double(ulonglong value) ...@@ -422,8 +422,15 @@ inline double ulonglong2double(ulonglong value)
#define shared_memory_buffer_length 16000 #define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL" #define default_shared_memory_base_name "MYSQL"
#ifdef CYBOZU
#define MYSQL_DEFAULT_CHARSET_NAME "utf8"
#define MYSQL_DEFAULT_COLLATION_NAME "utf8_general_cs"
#define HAVE_UTF8_GENERAL_CS 1
#else
#define MYSQL_DEFAULT_CHARSET_NAME "latin1" #define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#endif
#define HAVE_SPATIAL 1 #define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1 #define HAVE_RTREE_KEYS 1
...@@ -435,8 +442,10 @@ inline double ulonglong2double(ulonglong value) ...@@ -435,8 +442,10 @@ inline double ulonglong2double(ulonglong value)
/* Define charsets you want */ /* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */ /* #undef HAVE_CHARSET_ascii */
#ifndef CYBOZU
#define HAVE_CHARSET_big5 1 #define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp1250 1 #define HAVE_CHARSET_cp1250 1
#endif
/* #undef HAVE_CHARSET_cp1251 */ /* #undef HAVE_CHARSET_cp1251 */
/* #undef HAVE_CHARSET_cp1256 */ /* #undef HAVE_CHARSET_cp1256 */
/* #undef HAVE_CHARSET_cp1257 */ /* #undef HAVE_CHARSET_cp1257 */
...@@ -445,27 +454,33 @@ inline double ulonglong2double(ulonglong value) ...@@ -445,27 +454,33 @@ inline double ulonglong2double(ulonglong value)
/* #undef HAVE_CHARSET_cp866 */ /* #undef HAVE_CHARSET_cp866 */
#define HAVE_CHARSET_cp932 1 #define HAVE_CHARSET_cp932 1
/* #undef HAVE_CHARSET_dec8 */ /* #undef HAVE_CHARSET_dec8 */
#ifndef CYBOZU
#define HAVE_CHARSET_eucjpms 1 #define HAVE_CHARSET_eucjpms 1
#define HAVE_CHARSET_euckr 1 #define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1 #define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1 #define HAVE_CHARSET_gbk 1
#endif
/* #undef HAVE_CHARSET_greek */ /* #undef HAVE_CHARSET_greek */
/* #undef HAVE_CHARSET_hebrew */ /* #undef HAVE_CHARSET_hebrew */
/* #undef HAVE_CHARSET_hp8 */ /* #undef HAVE_CHARSET_hp8 */
/* #undef HAVE_CHARSET_keybcs2 */ /* #undef HAVE_CHARSET_keybcs2 */
/* #undef HAVE_CHARSET_koi8r */ /* #undef HAVE_CHARSET_koi8r */
/* #undef HAVE_CHARSET_koi8u */ /* #undef HAVE_CHARSET_koi8u */
#ifndef CYBOZU
#define HAVE_CHARSET_latin1 1 #define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_latin2 1 #define HAVE_CHARSET_latin2 1
#endif
/* #undef HAVE_CHARSET_latin5 */ /* #undef HAVE_CHARSET_latin5 */
/* #undef HAVE_CHARSET_latin7 */ /* #undef HAVE_CHARSET_latin7 */
/* #undef HAVE_CHARSET_macce */ /* #undef HAVE_CHARSET_macce */
/* #undef HAVE_CHARSET_macroman */ /* #undef HAVE_CHARSET_macroman */
#define HAVE_CHARSET_sjis 1 #define HAVE_CHARSET_sjis 1
/* #undef HAVE_CHARSET_swe7 */ /* #undef HAVE_CHARSET_swe7 */
#ifndef CYBOZU
#define HAVE_CHARSET_tis620 1 #define HAVE_CHARSET_tis620 1
#define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ucs2 1
#define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_ujis 1
#endif
#define HAVE_CHARSET_utf8 1 #define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1 #define HAVE_UCA_COLLATIONS 1
...@@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) { ...@@ -36,6 +36,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject"; my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result"; my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval"; my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" ) if ( $::opt_suite ne "main" )
...@@ -43,6 +44,7 @@ sub mtr_show_failed_diff ($) { ...@@ -43,6 +44,7 @@ sub mtr_show_failed_diff ($) {
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file"; $reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file"; $result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
$eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file"; $eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
$log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
} }
if ( -f $eval_file ) if ( -f $eval_file )
...@@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) { ...@@ -70,6 +72,12 @@ sub mtr_show_failed_diff ($) {
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n"; print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n"; print "to find the reason to this problem and how to report this.\n\n";
} }
if ( -f $log_file )
{
print "Result from queries before failure can be found in $log_file\n";
# FIXME Maybe a tail -f -n 10 $log_file here
}
} }
sub mtr_report_test_name ($) { sub mtr_report_test_name ($) {
......
...@@ -232,6 +232,8 @@ our $opt_client_ddd; ...@@ -232,6 +232,8 @@ our $opt_client_ddd;
our $opt_manual_gdb; our $opt_manual_gdb;
our $opt_manual_ddd; our $opt_manual_ddd;
our $opt_manual_debug; our $opt_manual_debug;
our $opt_debugger;
our $opt_client_debugger;
our $opt_gprof; our $opt_gprof;
our $opt_gprof_dir; our $opt_gprof_dir;
...@@ -622,6 +624,8 @@ sub command_line_setup () { ...@@ -622,6 +624,8 @@ sub command_line_setup () {
'manual-debug' => \$opt_manual_debug, 'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd, 'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd, 'client-ddd' => \$opt_client_ddd,
'debugger=s' => \$opt_debugger,
'client-debugger=s' => \$opt_client_debugger,
'strace-client' => \$opt_strace_client, 'strace-client' => \$opt_strace_client,
'master-binary=s' => \$exe_master_mysqld, 'master-binary=s' => \$exe_master_mysqld,
'slave-binary=s' => \$exe_slave_mysqld, 'slave-binary=s' => \$exe_slave_mysqld,
...@@ -812,7 +816,8 @@ sub command_line_setup () { ...@@ -812,7 +816,8 @@ sub command_line_setup () {
# Check debug related options # Check debug related options
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug) $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
$opt_debugger || $opt_client_debugger )
{ {
# Indicate that we are using debugger # Indicate that we are using debugger
$glob_debugger= 1; $glob_debugger= 1;
...@@ -2786,11 +2791,15 @@ sub mysqld_start ($$$$$) { ...@@ -2786,11 +2791,15 @@ sub mysqld_start ($$$$$) {
if ( $opt_gdb || $opt_manual_gdb) if ( $opt_gdb || $opt_manual_gdb)
{ {
gdb_arguments(\$args, \$exe, $type); gdb_arguments(\$args, \$exe, "$type"."_$idx");
} }
elsif ( $opt_ddd || $opt_manual_ddd ) elsif ( $opt_ddd || $opt_manual_ddd )
{ {
ddd_arguments(\$args, \$exe, $type); ddd_arguments(\$args, \$exe, "$type"."_$idx");
}
elsif ( $opt_debugger )
{
debugger_arguments(\$args, \$exe, "$type"."_$idx");
} }
elsif ( $opt_manual_debug ) elsif ( $opt_manual_debug )
{ {
...@@ -3324,10 +3333,15 @@ sub run_mysqltest ($) { ...@@ -3324,10 +3333,15 @@ sub run_mysqltest ($) {
{ {
ddd_arguments(\$args, \$exe, "client"); ddd_arguments(\$args, \$exe, "client");
} }
elsif ( $opt_client_debugger )
{
debugger_arguments(\$args, \$exe, "client");
}
if ($glob_use_libtool) if ($glob_use_libtool and $opt_valgrind)
{ {
# Add "libtool --mode-execute" before the test to execute # Add "libtool --mode-execute" before the test to execute
# if running in valgrind(to avoid valgrinding bash)
unshift(@$args, "--mode=execute", $exe); unshift(@$args, "--mode=execute", $exe);
$exe= "libtool"; $exe= "libtool";
} }
...@@ -3361,6 +3375,9 @@ sub gdb_arguments { ...@@ -3361,6 +3375,9 @@ sub gdb_arguments {
my $str= join(" ", @$$args); my $str= join(" ", @$$args);
my $gdb_init_file= "$opt_tmpdir/gdbinit.$type"; my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
# Remove the old gdbinit file
unlink($gdb_init_file);
if ( $type eq "client" ) if ( $type eq "client" )
{ {
# write init file for client # write init file for client
...@@ -3382,7 +3399,7 @@ sub gdb_arguments { ...@@ -3382,7 +3399,7 @@ sub gdb_arguments {
if ( $opt_manual_gdb ) if ( $opt_manual_gdb )
{ {
print "\nTo start gdb for$type, type in another window:\n"; print "\nTo start gdb for $type, type in another window:\n";
print "cd $glob_mysql_test_dir;\n"; print "cd $glob_mysql_test_dir;\n";
print "gdb -x $gdb_init_file $$exe\n"; print "gdb -x $gdb_init_file $$exe\n";
...@@ -3422,6 +3439,9 @@ sub ddd_arguments { ...@@ -3422,6 +3439,9 @@ sub ddd_arguments {
my $str= join(" ", @$$args); my $str= join(" ", @$$args);
my $gdb_init_file= "$opt_tmpdir/gdbinit.$type"; my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
# Remove the old gdbinit file
unlink($gdb_init_file);
if ( $type eq "client" ) if ( $type eq "client" )
{ {
# write init file for client # write init file for client
...@@ -3444,7 +3464,7 @@ sub ddd_arguments { ...@@ -3444,7 +3464,7 @@ sub ddd_arguments {
if ( $opt_manual_ddd ) if ( $opt_manual_ddd )
{ {
print "\nTo start ddd for$type, type in another window:\n"; print "\nTo start ddd for $type, type in another window:\n";
print "cd $glob_mysql_test_dir;\n"; print "cd $glob_mysql_test_dir;\n";
print "ddd -x $gdb_init_file $$exe\n"; print "ddd -x $gdb_init_file $$exe\n";
...@@ -3469,6 +3489,42 @@ sub ddd_arguments { ...@@ -3469,6 +3489,42 @@ sub ddd_arguments {
mtr_add_arg($$args, "$save_exe"); mtr_add_arg($$args, "$save_exe");
} }
#
# Modify the exe and args so that program is run in the selected debugger
#
sub debugger_arguments {
my $args= shift;
my $exe= shift;
my $debugger= $opt_debugger || $opt_client_debugger;
if ( $debugger eq "vcexpress" or $debugger eq "vc")
{
# vc[express] /debugexe exe arg1 .. argn
# Add /debugexe and name of the exe before args
unshift(@$$args, "/debugexe");
unshift(@$$args, "$$exe");
}
elsif ( $debugger eq "windbg" )
{
# windbg exe arg1 .. argn
# Add name of the exe before args
unshift(@$$args, "$$exe");
}
else
{
mtr_error("Unknown argument \"$debugger\" passed to --debugger");
}
# Set exe to debuggername
$$exe= $debugger;
}
# #
# Modify the exe and args so that program is run in valgrind # Modify the exe and args so that program is run in valgrind
# #
...@@ -3578,6 +3634,8 @@ Options for debugging the product ...@@ -3578,6 +3634,8 @@ Options for debugging the product
client-gdb Start mysqltest client in gdb client-gdb Start mysqltest client in gdb
ddd Start mysqld in ddd ddd Start mysqld in ddd
client-ddd Start mysqltest client in ddd client-ddd Start mysqltest client in ddd
debugger=NAME Start mysqld in the selected debugger
client-debugger=NAME Start mysqltest in the selected debugger
strace-client FIXME strace-client FIXME
master-binary=PATH Specify the master "mysqld" to use master-binary=PATH Specify the master "mysqld" to use
slave-binary=PATH Specify the slave "mysqld" to use slave-binary=PATH Specify the slave "mysqld" to use
......
...@@ -3163,3 +3163,9 @@ t ...@@ -3163,3 +3163,9 @@ t
crash1 crash1
crash1 crash1
drop table t1; drop table t1;
create table t1 (c int, key(c));
insert into t1 values (1142477582), (1142455969);
create table t2 (a int, b int);
insert into t2 values (2, 1), (1, 0);
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
...@@ -2074,3 +2074,14 @@ create table t1( f1 int,f2 int); ...@@ -2074,3 +2074,14 @@ create table t1( f1 int,f2 int);
insert into t1 values (1,1),(2,2); insert into t1 values (1,1),(2,2);
select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1'; select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
drop table t1; drop table t1;
#
# Bug #18306: server crash on delete using subquery.
#
create table t1 (c int, key(c));
insert into t1 values (1142477582), (1142455969);
create table t2 (a int, b int);
insert into t2 values (2, 1), (1, 0);
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
...@@ -398,14 +398,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) ...@@ -398,14 +398,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
tmp_file[2]='*'; tmp_file[2]='*';
tmp_file[3]='\0'; tmp_file[3]='\0';
#ifdef __BORLANDC__
if ((handle= findfirst(tmp_path,&find,0)) == -1L)
goto error;
#else
if ((handle=_findfirst(tmp_path,&find)) == -1L)
goto error;
#endif
if (!(buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) + if (!(buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) +
ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) + ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) +
sizeof(MEM_ROOT), MyFlags))) sizeof(MEM_ROOT), MyFlags)))
...@@ -426,6 +418,22 @@ MY_DIR *my_dir(const char *path, myf MyFlags) ...@@ -426,6 +418,22 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
/* MY_DIR structure is allocated and completly initialized at this point */ /* MY_DIR structure is allocated and completly initialized at this point */
result= (MY_DIR*)buffer; result= (MY_DIR*)buffer;
#ifdef __BORLANDC__
if ((handle= findfirst(tmp_path,&find,0)) == -1L)
#else
if ((handle=_findfirst(tmp_path,&find)) == -1L)
#endif
{
DBUG_PRINT("info", ("find_first returned error"));
if (errno != EINVAL)
goto error;
/*
Could not read the directory, no read access.
Probably because by "chmod -r".
continue and return zero files in dir
*/
}
do do
{ {
#ifdef __BORLANDC__ #ifdef __BORLANDC__
......
...@@ -4799,9 +4799,18 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond) ...@@ -4799,9 +4799,18 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
/* Here when simple cond */ /* Here when simple cond */
if (cond->const_item()) if (cond->const_item())
{ {
if (cond->val_int()) /*
DBUG_RETURN(new SEL_TREE(SEL_TREE::ALWAYS)); During the cond->val_int() evaluation we can come across a subselect
DBUG_RETURN(new SEL_TREE(SEL_TREE::IMPOSSIBLE)); item which may allocate memory on the thd->mem_root and assumes
all the memory allocated has the same life span as the subselect
item itself. So we have to restore the thread's mem_root here.
*/
MEM_ROOT *tmp_root= param->mem_root;
param->thd->mem_root= param->old_root;
tree= cond->val_int() ? new(tmp_root) SEL_TREE(SEL_TREE::ALWAYS) :
new(tmp_root) SEL_TREE(SEL_TREE::IMPOSSIBLE);
param->thd->mem_root= tmp_root;
DBUG_RETURN(tree);
} }
table_map ref_tables= 0; table_map ref_tables= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment