Commit 9dc0da7c authored by jimw@mysql.com's avatar jimw@mysql.com

Merge mysql.com:/home/jimw/my/mysql-4.1-11280

into  mysql.com:/home/jimw/my/mysql-4.1-clean
parents 2ef8b1e7 375dc153
......@@ -116,3 +116,8 @@ test:
--master_port=$(MYSQL_TEST_MASTER_PORT) \
--slave_port=$(MYSQL_TEST_SLAVE_PORT) \
--ndbcluster_port=$(MYSQL_TEST_NDB_PORT)
test-force:
cd mysql-test; \
./mysql-test-run --force ;\
./mysql-test-run --ps-protocol --force
This diff is collapsed.
......@@ -2043,6 +2043,13 @@ AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
# Test whether madvise() is declared in C++ code -- it is not on some
# systems, such as Solaris
AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
#include <sys/types.h>
#include <sys/mman.h>
#endif])
# Do not treat warnings as errors if we are linking against other libc
# this is to work around gcc not being permissive on non-system includes
# with respect to ANSI C++
......
......@@ -310,6 +310,10 @@ C_MODE_END
#undef setrlimit
#define setrlimit cma_setrlimit64
#endif
/* Declare madvise where it is not declared for C++, like Solaris */
#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus)
extern "C" int madvise(void *addr, size_t len, int behav);
#endif
#ifdef __QNXNTO__
/* This has to be after include limits.h */
......
......@@ -67,7 +67,7 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function)
break;
}
#endif
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if ((info->options & HA_OPTION_COMPRESS_RECORD))
{
pthread_mutex_lock(&info->s->intern_lock);
......@@ -144,7 +144,7 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function)
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
error=end_io_cache(&info->rec_cache);
}
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
madvise(info->s->file_map,info->s->state.data_file_length,MADV_RANDOM);
#endif
......
......@@ -62,7 +62,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
if (share->base.blobs)
mi_alloc_rec_buff(info, -1, &info->rec_buff);
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
#endif
......@@ -93,7 +93,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
my_errno=EACCES;
break;
}
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if ((share->options & HA_OPTION_COMPRESS_RECORD))
{
pthread_mutex_lock(&share->intern_lock);
......@@ -177,7 +177,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
error=end_io_cache(&info->rec_cache);
/* Sergei will insert full text index caching here */
}
#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
#endif
......
let $1 = 10;
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
while ($1)
{
echo $1;
dec $1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
--require r/true.require
disable_query_log;
select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") as "TRUE";
enable_query_log;
......@@ -12,16 +12,17 @@ use strict;
#use POSIX ":sys_wait_h";
use POSIX 'WNOHANG';
sub mtr_run ($$$$$$);
sub mtr_spawn ($$$$$$);
sub mtr_run ($$$$$$;$);
sub mtr_spawn ($$$$$$;$);
sub mtr_stop_mysqld_servers ($);
sub mtr_kill_leftovers ();
sub mtr_record_dead_children ();
sub mtr_exit ($);
sub sleep_until_file_created ($$$);
sub mtr_kill_processes ($);
# static in C
sub spawn_impl ($$$$$$$);
sub spawn_impl ($$$$$$$$);
##############################################################################
#
......@@ -32,37 +33,43 @@ sub spawn_impl ($$$$$$$);
# This function try to mimic the C version used in "netware/mysql_test_run.c"
# FIXME learn it to handle append mode as well, a "new" flag or a "append"
sub mtr_run ($$$$$$) {
sub mtr_run ($$$$$$;$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
my $pid_file= shift;
my $spawn_opts= shift;
return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file);
return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file,
$spawn_opts);
}
sub mtr_run_test ($$$$$$) {
sub mtr_run_test ($$$$$$;$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
my $pid_file= shift;
my $spawn_opts= shift;
return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file);
return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file,
$spawn_opts);
}
sub mtr_spawn ($$$$$$) {
sub mtr_spawn ($$$$$$;$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
my $pid_file= shift;
my $spawn_opts= shift;
return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file);
return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file,
$spawn_opts);
}
......@@ -72,7 +79,7 @@ sub mtr_spawn ($$$$$$) {
#
##############################################################################
sub spawn_impl ($$$$$$$) {
sub spawn_impl ($$$$$$$$) {
my $path= shift;
my $arg_list_t= shift;
my $mode= shift;
......@@ -80,6 +87,7 @@ sub spawn_impl ($$$$$$$) {
my $output= shift;
my $error= shift;
my $pid_file= shift; # FIXME
my $spawn_opts= shift;
if ( $::opt_script_debug )
{
......@@ -89,6 +97,18 @@ sub spawn_impl ($$$$$$$) {
print STDERR "#### ", "STDOUT $output\n" if $output;
print STDERR "#### ", "STDERR $error\n" if $error;
print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n";
print STDERR "#### ", "spawn options:\n";
if ($spawn_opts)
{
foreach my $key (sort keys %{$spawn_opts})
{
print STDERR "#### ", " - $key: $spawn_opts->{$key}\n";
}
}
else
{
print STDERR "#### ", " none\n";
}
print STDERR "#### ", "-" x 78, "\n";
}
......@@ -135,9 +155,16 @@ sub spawn_impl ($$$$$$$) {
# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c";
}
my $log_file_open_mode = '>';
if ($spawn_opts and $spawn_opts->{'append_log_file'})
{
$log_file_open_mode = '>>';
}
if ( $output )
{
if ( ! open(STDOUT,">",$output) )
if ( ! open(STDOUT,$log_file_open_mode,$output) )
{
mtr_error("can't redirect STDOUT to \"$output\": $!");
}
......@@ -154,9 +181,9 @@ sub spawn_impl ($$$$$$$) {
}
else
{
if ( ! open(STDERR,">",$error) )
if ( ! open(STDERR,$log_file_open_mode,$error) )
{
mtr_error("can't redirect STDERR to \"$output\": $!");
mtr_error("can't redirect STDERR to \"$error\": $!");
}
}
}
......@@ -533,17 +560,8 @@ sub mtr_stop_mysqld_servers ($) {
start_reap_all(); # Avoid zombies
SIGNAL:
foreach my $sig (15,9)
{
my $retries= 20; # FIXME 20 seconds, this is silly!
kill($sig, keys %mysqld_pids);
while ( $retries-- and kill(0, keys %mysqld_pids) )
{
mtr_debug("Sleep 1 second waiting for processes to die");
sleep(1) # Wait one second
}
}
my @mysqld_pids= keys %mysqld_pids;
mtr_kill_processes(\@mysqld_pids);
stop_reap_all(); # Get into control again
......@@ -826,6 +844,21 @@ sub sleep_until_file_created ($$$) {
}
sub mtr_kill_processes ($) {
my $pids = shift;
foreach my $sig (15,9)
{
my $retries= 20; # FIXME 20 seconds, this is silly!
kill($sig, @{$pids});
while ( $retries-- and kill(0, @{$pids}) )
{
mtr_debug("Sleep 1 second waiting for processes to die");
sleep(1) # Wait one second
}
}
}
##############################################################################
#
# When we exit, we kill off all children
......@@ -841,6 +874,7 @@ sub sleep_until_file_created ($$$) {
sub mtr_exit ($) {
my $code= shift;
# cluck("Called mtr_exit()");
mtr_timer_stop_all($::glob_timers);
local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$);
sleep 2;
......
......@@ -177,7 +177,7 @@ sub mtr_report_stats ($) {
"%.2f\% were successful.\n\n", $ratio;
print
"The log files in var/log may give you some hint\n",
"of what when wrong.\n",
"of what went wrong.\n",
"If you want to report this error, please read first ",
"the documentation at\n",
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
......@@ -223,7 +223,8 @@ sub mtr_report_stats ($) {
if ( $tot_failed != 0 )
{
print "mysql-test-run: *** Failing the test(s):";
my $test_mode= join(" ", @::glob_test_mode) || "default";
print "mysql-test-run in $test_mode mode: *** Failing the test(s):";
foreach my $tinfo (@$tests)
{
......
......@@ -15,6 +15,7 @@ use POSIX 'WNOHANG';
sub mtr_init_timers ();
sub mtr_timer_start($$$);
sub mtr_timer_stop($$);
sub mtr_timer_stop_all($);
sub mtr_timer_waitpid($$$);
##############################################################################
......@@ -113,6 +114,17 @@ sub mtr_timer_stop ($$) {
}
sub mtr_timer_stop_all ($) {
my $timers= shift;
foreach my $name ( keys %{$timers->{'timers'}} )
{
mtr_timer_stop($timers, $name);
}
return 1;
}
sub mtr_timer_timeout ($$) {
my ($timers,$pid)= @_;
......
......@@ -142,6 +142,7 @@ our $glob_timers= undef;
our $glob_use_running_server= 0;
our $glob_use_running_ndbcluster= 0;
our $glob_use_embedded_server= 0;
our @glob_test_mode;
our $glob_basedir;
......@@ -606,6 +607,7 @@ sub command_line_setup () {
if ( $opt_embedded_server )
{
$glob_use_embedded_server= 1;
push(@glob_test_mode, "embedded");
$opt_skip_rpl= 1; # We never run replication with embedded
if ( $opt_extern )
......@@ -614,6 +616,11 @@ sub command_line_setup () {
}
}
if ( $opt_ps_protocol )
{
push(@glob_test_mode, "ps-protocol");
}
# FIXME don't understand what this is
# if ( $opt_local_master )
# {
......@@ -999,25 +1006,19 @@ sub kill_and_cleanup () {
# FIXME do we really need to create these all, or are they
# created for us when tables are created?
rmtree("$master->[0]->{'path_myddir'}");
mkpath("$master->[0]->{'path_myddir'}/mysql");
mkpath("$master->[0]->{'path_myddir'}/test");
rmtree("$master->[1]->{'path_myddir'}");
mkpath("$master->[1]->{'path_myddir'}/mysql");
mkpath("$master->[1]->{'path_myddir'}/test");
rmtree("$slave->[0]->{'path_myddir'}");
mkpath("$slave->[0]->{'path_myddir'}/mysql");
mkpath("$slave->[0]->{'path_myddir'}/test");
rmtree("$slave->[1]->{'path_myddir'}");
mkpath("$slave->[1]->{'path_myddir'}/mysql");
mkpath("$slave->[1]->{'path_myddir'}/test");
rmtree("$slave->[2]->{'path_myddir'}");
mkpath("$slave->[2]->{'path_myddir'}/mysql");
mkpath("$slave->[2]->{'path_myddir'}/test");
my @data_dir_lst = (
$master->[0]->{'path_myddir'},
$master->[1]->{'path_myddir'},
$slave->[0]->{'path_myddir'},
$slave->[1]->{'path_myddir'},
$slave->[2]->{'path_myddir'});
foreach my $data_dir (@data_dir_lst)
{
rmtree("$data_dir");
mkpath("$data_dir/mysql");
mkpath("$data_dir/test");
}
# To make some old test cases work, we create a soft
# link from the old "var" location to the new one
......@@ -1565,8 +1566,9 @@ sub report_failure_and_restart ($) {
print "\n";
if ( ! $opt_force )
{
print "Aborting: $tinfo->{'name'} failed. To continue, re-run with '--force'.";
print "\n";
my $test_mode= join(" ", @::glob_test_mode) || "default";
print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
print "To continue, re-run with '--force'.\n";
if ( ! $opt_gdb and ! $glob_use_running_server and
! $opt_ddd and ! $glob_use_embedded_server )
{
......@@ -1612,6 +1614,7 @@ sub do_before_start_master ($$) {
}
}
# FIXME only remove the ones that are tied to this master
# Remove old master.info and relay-log.info files
unlink("$master->[0]->{'path_myddir'}/master.info");
unlink("$master->[0]->{'path_myddir'}/relay-log.info");
......@@ -2194,6 +2197,11 @@ sub run_mysqltest ($) {
mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]);
}
# ----------------------------------------------------------------------
# export MYSQL_TEST variable containing <path>/mysqltest <args>
# ----------------------------------------------------------------------
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
return mtr_run_test($exe,$args,$tinfo->{'path'},"",$path_timefile,"");
}
......
......@@ -714,6 +714,7 @@ if [ x$USE_TIMER = x1 ] ; then
fi
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
export MYSQL_TEST
GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
......
......@@ -548,3 +548,6 @@ FROM t1 JOIN t2 ON t1.bID = t2.bID;
COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
2 test
DROP TABLE t1,t2;
select * from (select group_concat('c') from DUAL) t;
group_concat('c')
NULL
......@@ -122,3 +122,12 @@ flush privileges;
drop database mysqltest_1;
set password = password("changed");
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
lock table mysql.user write;
flush privileges;
grant all on *.* to 'mysqltest_1'@'localhost';
unlock tables;
lock table mysql.user write;
set password for 'mysqltest_1'@'localhost' = password('');
revoke all on *.* from 'mysqltest_1'@'localhost';
unlock tables;
drop user 'mysqltest_1'@'localhost';
......@@ -83,9 +83,3 @@ create table t2 like T1;
drop table t1, t2;
show tables;
Tables_in_test
use lpt1;
ERROR 42000: Unknown database 'lpt1'
use com1;
ERROR 42000: Unknown database 'com1'
use prn;
ERROR 42000: Unknown database 'prn'
......@@ -7,18 +7,16 @@ otto
select otto from (select 1 as otto) as t1;
otto
1
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed: 1054: Unknown column 'friedrich' in 'field list'
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
select otto from (select 1 as otto) as t1;
otto
1
select otto from (select 1 as otto) as t1;
otto
1
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000...
select otto from (select 1 as otto) as t1;
otto
1
......@@ -135,6 +133,8 @@ ERROR 42S02: Table 'test.t1' doesn't exist
select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error
1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
garbage ;
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 'garbage' at line 1
select 1064 as "after_--enable_abort_on_error" ;
......@@ -142,3 +142,213 @@ after_--enable_abort_on_error
1064
select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064...
mysqltest: At line 1: query 'select 3 from t1' failed: 1146: Table 'test.t1' doesn't exist
hello
hello
;;;;;;;;
# MySQL: -- The
mysqltest: At line 1: End of line junk detected: "6"
mysqltest: At line 1: End of line junk detected: "6"
mysqltest: At line 1: Missing delimiter
mysqltest: At line 1: Extra delimiter ";" found
MySQL
"MySQL"
MySQL: The world''s most popular open source database
"MySQL: The world's most popular open source database"
MySQL: The world''s
most popular open
source database
# MySQL: The world''s
# most popular open
# source database
- MySQL: The world''s
- most popular open
- source database
- MySQL: The world''s
-- most popular open
-- source database
# MySQL: The
--world''s
# most popular
-- open
- source database
"MySQL: The world's most popular; open source database"
"MySQL: The world's most popular ; open source database"
"MySQL: The world's most popular ;open source database"
echo message echo message
mysqltest: At line 1: Empty variable
mysqltest: At line 1: command "';' 2> /dev/null" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
MySQL: The
world''s most
popular open
source database
# MySQL: The
# world''s most
# popular open
# source database
-- MySQL: The
-- world''s most
-- popular open
-- source database
# MySQL: The
- world''s most
-- popular open
# source database
'$message'
"$message"
hej
hej
hej
1
a long variable content
a long variable content
a long $where variable content
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Variable name in hi=hi does not start with '$'
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Variable name in =hi does not start with '$'
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing file name in source
mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: In included file "./var/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "./var/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1
2 = outer loop variable after while
here is the sourced script
2 = outer loop variable before dec
1 = outer loop variable after dec
1 = outer loop variable after while
here is the sourced script
1 = outer loop variable before dec
0 = outer loop variable after dec
2 = outer loop variable after while
here is the sourced script
2 = outer loop variable before dec
1 = outer loop variable after dec
1 = outer loop variable after while
here is the sourced script
1 = outer loop variable before dec
0 = outer loop variable after dec
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
1
2
101
hej
1
mysqltest: At line 1: Missing arguments to inc
mysqltest: At line 1: First argument to inc must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
4
4
-1
-2
99
hej
-1
mysqltest: At line 1: Missing arguments to dec
mysqltest: At line 1: First argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'NonExistsinfComamdn 2> /dev/null' failed
test
test2
test3
test4
1
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while
mysqltest: At line 1: Missing '{' after while. Found "dec $i"
mysqltest: At line 1: Stray '}' - end of block before beginning
mysqltest: At line 1: Stray 'end' command - end of block before beginning
mysqltest: At line 1: query '' failed: 1065: Query was empty
mysqltest: At line 1: Missing '{' after while. Found "echo hej"
mysqltest: At line 3: Missing end of block
mysqltest: At line 1: Missing newline between while and '{'
mysqltest: At line 1: missing '(' in if
mysqltest: At line 1: Stray 'end' command - end of block before beginning
select "b" bs col1, "c" bs col2;
col1 col2
b c
seledt "b" bs dol1, "d" bs dol2;
dol1 dol2
b d
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a '
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c '
select "a" as col1, "c" as col2;
col1 col2
b c
select "a" as col1, "c" as col2;
col1 col2
b d
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a'
mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_column 1'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1'
mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c '
mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a"
failing_statement;
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 'failing_statement' at line 1
failing_statement;
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 'failing_statement' at line 1
SELECT 1 as a;
a
1
......@@ -4,10 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
start slave;
stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
start slave;
......
......@@ -29,3 +29,14 @@ drop table if exists t1,t2,t11;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1340 slave-relay-bin.000002 1384 master-bin.000001 Yes Yes test.t1 0 0 1340 1384 None 0 No #
create table t1 (ts timestamp);
set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00');
set one_shot time_zone='met';
select * from t1;
ts
2005-08-12 00:00:00
set one_shot time_zone='met';
select * from t1;
ts
2005-08-12 00:00:00
......@@ -491,6 +491,11 @@ SHOW VARIABLES LIKE 'table_cache';
Variable_name Value
table_cache 1
SET GLOBAL table_cache=DEFAULT;
set character_set_results=NULL;
select ifnull(@@character_set_results,"really null");
ifnull(@@character_set_results,"really null")
really null
set names latin1;
select @@have_innodb;
@@have_innodb
#
use lpt1;
ERROR 42000: Unknown database 'lpt1'
use com1;
ERROR 42000: Unknown database 'com1'
use prn;
ERROR 42000: Unknown database 'prn'
create table nu (a int);
drop table nu;
......@@ -238,7 +238,7 @@ drop table t1;
create table `t1 `(a int);
--error 1102
create database `db1 `;
--error 1166;
--error 1166
create table t1(`a ` int);
#
......
......@@ -11,21 +11,21 @@ drop table if exists t1, t2;
--enable_warnings
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error 1062;
--error 1062
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146;
--error 1146
select * from t2;
--error 1062;
--error 1062
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146;
--error 1146
select * from t2;
--error 1062;
--error 1062
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146;
--error 1146
select * from t2;
--error 1062;
--error 1062
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146;
--error 1146
select * from t2;
# End of 4.1 tests
......@@ -6,13 +6,13 @@ drop database if exists mysqltest;
drop database if exists client_test_db;
--enable_warnings
--error 1051;
--error 1051
drop table t1;
create table t1(n int);
insert into t1 values(1);
create temporary table t1( n int);
insert into t1 values(2);
--error 1050;
--error 1050
create table t1(n int);
drop table t1;
select * from t1;
......@@ -56,13 +56,13 @@ drop database mysqltest;
# test drop/create database and FLUSH TABLES WITH READ LOCK
flush tables with read lock;
--error 1209,1223;
--error 1209,1223
create database mysqltest;
unlock tables;
create database mysqltest;
show databases;
flush tables with read lock;
--error 1208,1223;
--error 1208,1223
drop database mysqltest;
unlock tables;
drop database mysqltest;
......@@ -73,7 +73,7 @@ drop database mysqltest;
# test create table and FLUSH TABLES WITH READ LOCK
drop table t1;
flush tables with read lock;
--error 1223;
--error 1223
create table t1(n int);
unlock tables;
create table t1(n int);
......
......@@ -37,7 +37,7 @@ connection con1;
select * from t1;
connection con2;
flush tables with read lock;
--error 1099;
--error 1099
drop table t2;
connection con1;
send drop table t2;
......
......@@ -343,4 +343,9 @@ SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
DROP TABLE t1,t2;
#
# Bug #12861 hang with group_concat insubquery FROM DUAL
#
select * from (select group_concat('c') from DUAL) t;
# End of 4.1 tests
......@@ -163,4 +163,47 @@ set password = password("changed");
disconnect n5;
connection default;
# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# multi-threaded environment". We should be able to execute FLUSH
# PRIVILEGES and SET PASSWORD simultaneously with other account
# management commands (such as GRANT and REVOKE) without causing
# deadlocks. To achieve this we should ensure that all account
# management commands take table and internal locks in the same order.
connect (con2root,localhost,root,,);
connect (con3root,localhost,root,,);
# Check that we can execute FLUSH PRIVILEGES and GRANT simultaneously
# This will check that locks are taken in proper order during both
# user/db-level and table/column-level privileges reloading.
connection default;
lock table mysql.user write;
connection con2root;
send flush privileges;
connection con3root;
send grant all on *.* to 'mysqltest_1'@'localhost';
connection default;
unlock tables;
connection con2root;
reap;
connection con3root;
reap;
# Check for simultaneous SET PASSWORD and REVOKE.
connection default;
lock table mysql.user write;
connection con2root;
send set password for 'mysqltest_1'@'localhost' = password('');
connection con3root;
send revoke all on *.* from 'mysqltest_1'@'localhost';
connection default;
unlock tables;
connection con2root;
reap;
connection con3root;
reap;
connection default;
# Clean-up
drop user 'mysqltest_1'@'localhost';
disconnect con2root;
disconnect con3root;
# End of 4.1 tests
......@@ -300,7 +300,7 @@ handler t5 open as h5;
handler h5 read first limit 9;
# close first
alter table t1 engine=MyISAM;
--error 1109;
--error 1109
handler h1 read first limit 9;
handler h2 read first limit 9;
handler h3 read first limit 9;
......@@ -308,22 +308,22 @@ handler h4 read first limit 9;
handler h5 read first limit 9;
# close last
alter table t5 engine=MyISAM;
--error 1109;
--error 1109
handler h1 read first limit 9;
handler h2 read first limit 9;
handler h3 read first limit 9;
handler h4 read first limit 9;
--error 1109;
--error 1109
handler h5 read first limit 9;
# close middle
alter table t3 engine=MyISAM;
--error 1109;
--error 1109
handler h1 read first limit 9;
handler h2 read first limit 9;
--error 1109;
--error 1109
handler h3 read first limit 9;
handler h4 read first limit 9;
--error 1109;
--error 1109
handler h5 read first limit 9;
handler h2 close;
handler h4 close;
......@@ -335,11 +335,11 @@ handler h1_1 read first limit 9;
handler h1_2 read first limit 9;
handler h1_3 read first limit 9;
alter table t1 engine=MyISAM;
--error 1109;
--error 1109
handler h1_1 read first limit 9;
--error 1109;
--error 1109
handler h1_2 read first limit 9;
--error 1109;
--error 1109
handler h1_3 read first limit 9;
drop table t1;
drop table t2;
......
......@@ -25,7 +25,7 @@ set autocommit=0;
# The following query should hang because con1 is locking the page
--send
update t1 set x=2 where id = 0;
--sleep 2;
--sleep 2
connection con1;
update t1 set x=1 where id = 0;
......@@ -63,7 +63,7 @@ set autocommit=0;
# The following query should hang because con1 is locking the page
--send
update t1 set x=2 where id = 0;
--sleep 2;
--sleep 2
connection con1;
update t1 set x=1 where id = 0;
......@@ -97,7 +97,7 @@ update t2 set a=2 where b = 0;
select * from t2;
--send
update t1 set x=2 where id = 0;
--sleep 2;
--sleep 2
connection con1;
update t1 set x=1 where id = 0;
......
......@@ -39,7 +39,7 @@ set autocommit=0;
# The following statement should hang because con1 is locking the page
--send
lock table t1 write;
--sleep 2;
--sleep 2
connection con1;
update t1 set x=1 where id = 0;
......
......@@ -1183,7 +1183,7 @@ drop table t1;
#
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1214;
--error 1214
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1;
......
......@@ -83,14 +83,4 @@ drop table t1, t2;
show tables;
#
#Bug 9148: Denial of service
#
--error 1049
use lpt1;
--error 1049
use com1;
--error 1049
use prn;
# End of 4.1 tests
This diff is collapsed.
......@@ -6,7 +6,7 @@
# The previous step has simply removed the frm file
# from disk, but left the table in NDB
#
--sleep 3;
--sleep 3
select * from t9 order by a;
# handler_discover should be 1
......
......@@ -89,7 +89,7 @@ kill @id;
# We don't drop t3 as this is a temporary table
drop table t2;
connection master;
--error 1053;
--error 1053
reap;
connection slave;
# The SQL slave thread should now have stopped because the query was killed on
......
......@@ -22,7 +22,7 @@ set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
save_master_pos;
--error 1062;
--error 1062
insert into t1 values(1),(2);
drop table t1;
save_master_pos;
......
......@@ -8,7 +8,7 @@ insert into t1 values(1+get_lock("a",15)*0);
insert into t1 values(2);
save_master_pos;
connection slave;
--real_sleep 3; # can't sync_with_master as we should be blocked
--real_sleep 3 # can't sync_with_master as we should be blocked
stop slave;
select * from t1;
--replace_result $MASTER_MYPORT MASTER_MYPORT
......
......@@ -58,7 +58,7 @@ while ($1)
enable_query_log;
select * from t1 for update;
start slave;
--sleep 3; # hope that slave is blocked now
--sleep 3 # hope that slave is blocked now
insert into t2 values(22); # provoke deadlock, slave should be victim
commit;
sync_with_master;
......@@ -76,7 +76,7 @@ change master to master_log_pos=401; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
--sleep 10; # slave should have blocked, and be retrying
--sleep 10 # slave should have blocked, and be retrying
commit;
sync_with_master;
select * from t1; # check that slave succeeded finally
......@@ -97,7 +97,7 @@ change master to master_log_pos=401;
begin;
select * from t2 for update;
start slave;
--sleep 10;
--sleep 10
commit;
sync_with_master;
select * from t1;
......
......@@ -5,7 +5,7 @@ source include/master-slave.inc;
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int);
--error 1051;
--error 1051
drop table t1, t2;
save_master_pos;
connection slave;
......
......@@ -9,7 +9,7 @@ sync_slave_with_master;
connection master;
disconnect master;
connection slave;
--real_sleep 3; # time for DROP to be written
--real_sleep 3 # time for DROP to be written
show status like 'Slave_open_temp_tables';
connection default;
drop database mysqltest;
......
......@@ -6,7 +6,7 @@ source include/master-slave.inc;
connection master;
create table t1 (a int primary key);
# generate an error that goes to the binlog
--error 1062;
--error 1062
insert into t1 values (1),(1);
save_master_pos;
connection slave;
......@@ -45,7 +45,7 @@ select (@id := id) - id from t3;
kill @id;
drop table t2,t3;
connection master;
--error 0,1053;
--error 0,1053
reap;
connection master1;
show binlog events from 79;
......
# Testing if "flush logs" command bouncing resulting in logs created in a loop
# in case of bi-directional replication
source include/master-slave.inc
source include/master-slave.inc;
connection slave;
stop slave;
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
start slave;
connection master;
stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
......
......@@ -4,7 +4,7 @@
# We also check how the foreign_key_check variable is replicated
source include/master-slave.inc;
source include/have_innodb.inc
source include/have_innodb.inc;
connection master;
create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b));
......
......@@ -123,7 +123,7 @@ connection master;
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day));
--error 1062;
--error 1062
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
......
......@@ -36,4 +36,22 @@ sync_with_master;
--replace_column 1 # 33 #
show slave status;
#
# BUG#12542
# TEST: "SET ONE_SHOT should always be executed on slave"
#
# We could use any timezone different than server default in this test
#
connection master;
create table t1 (ts timestamp);
set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00');
set one_shot time_zone='met';
select * from t1;
sync_slave_with_master;
connection slave;
set one_shot time_zone='met';
select * from t1;
# End of 4.1 tests
......@@ -102,7 +102,7 @@ show master logs;
purge binary logs to 'master-bin.000002';
show binary logs;
# sleeping 10 seconds or more would make the slave believe connection is down
--real_sleep 1;
--real_sleep 1
purge master logs before now();
show binary logs;
insert into t2 values (65);
......
# Test case for BUG #10780
source include/master-slave.inc
--source include/master-slave.inc
connection master;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
connection slave;
......
......@@ -60,7 +60,7 @@ stop slave;
# this should stop immideately
start slave until master_log_file='master-bin.000001', master_log_pos=561;
# 2 is not enough when running with valgrind
real_sleep 4
--real_sleep 4
# here the sql slave thread should be stopped
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
--replace_column 1 # 9 # 23 # 33 #
......
......@@ -380,6 +380,14 @@ SET GLOBAL table_cache=-1;
SHOW VARIABLES LIKE 'table_cache';
SET GLOBAL table_cache=DEFAULT;
#
# Bugs12363: character_set_results is nullable,
# but value_ptr returns string "NULL"
#
set character_set_results=NULL;
select ifnull(@@character_set_results,"really null");
set names latin1;
# End of 4.1 tests
#
......
# Windows-specific tests
--source include/windows.inc
#
# Bug 9148: Denial of service
#
--error 1049
use lpt1;
--error 1049
use com1;
--error 1049
use prn;
#
# Bug #12325: Can't create table named 'nu'
#
create table nu (a int);
drop table nu;
# End of 4.1 tests
......@@ -105,7 +105,7 @@ int check_if_legal_filename(const char *path)
{
if (*reserved != my_toupper(&my_charset_latin1, *name))
break;
if (++name == end)
if (++name == end && !reserved[1])
DBUG_RETURN(1); /* Found wrong path */
} while (*++reserved);
}
......
noinst_LIBRARIES = libdbdih.a
EXTRA_PROGRAMS = ndbd_sysfile_reader
libdbdih_a_SOURCES = DbdihInit.cpp DbdihMain.cpp
ndbd_sysfile_reader_SOURCES = printSysfile/printSysfile.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_kernel.mk.am
LDADD += \
$(top_builddir)/ndb/src/common/util/libgeneral.la \
$(top_builddir)/ndb/src/common/portlib/libportlib.la
# Don't update the files from bitkeeper
%::SCCS/s.%
......
......@@ -239,6 +239,17 @@ bool PageHeader::check() {
return true;
}
bool PageHeader::lastPage()
{
return m_next_page == 0xffffff00;
}
Uint32 PageHeader::lastWord()
{
return m_current_page_index;
}
NdbOut& operator<<(NdbOut& no, const PageHeader& ph) {
no << "------------PAGE HEADER------------------------" << endl << endl;
ndbout_c("%-30s%-12s%-12s\n", "", "Decimal", "Hex");
......
......@@ -132,6 +132,8 @@ class PageHeader {
public:
bool check();
Uint32 getLogRecordSize();
bool lastPage();
Uint32 lastWord();
protected:
Uint32 m_checksum;
Uint32 m_lap;
......
......@@ -1909,47 +1909,54 @@ CommandInterpreter::executeEventReporting(int processId,
return;
}
BaseString tmp(parameters);
Vector<BaseString> spec;
tmp.split(spec, "=");
if(spec.size() != 2){
ndbout << "Invalid loglevel specification: " << parameters << endl;
return;
}
Vector<BaseString> specs;
tmp.split(specs, " ");
spec[0].trim().ndb_toupper();
int category = ndb_mgm_match_event_category(spec[0].c_str());
if(category == NDB_MGM_ILLEGAL_EVENT_CATEGORY){
if(!convert(spec[0].c_str(), category) ||
category < NDB_MGM_MIN_EVENT_CATEGORY ||
category > NDB_MGM_MAX_EVENT_CATEGORY){
ndbout << "Unknown category: \"" << spec[0].c_str() << "\"" << endl;
return;
for (int i=0; i < specs.size(); i++)
{
Vector<BaseString> spec;
specs[i].split(spec, "=");
if(spec.size() != 2){
ndbout << "Invalid loglevel specification: " << specs[i] << endl;
continue;
}
}
int level;
if (!convert(spec[1].c_str(),level))
{
ndbout << "Invalid level: " << spec[1].c_str() << endl;
return;
}
spec[0].trim().ndb_toupper();
int category = ndb_mgm_match_event_category(spec[0].c_str());
if(category == NDB_MGM_ILLEGAL_EVENT_CATEGORY){
if(!convert(spec[0].c_str(), category) ||
category < NDB_MGM_MIN_EVENT_CATEGORY ||
category > NDB_MGM_MAX_EVENT_CATEGORY){
ndbout << "Unknown category: \"" << spec[0].c_str() << "\"" << endl;
continue;
}
}
ndbout << "Executing CLUSTERLOG on node " << processId << flush;
int level;
if (!convert(spec[1].c_str(),level))
{
ndbout << "Invalid level: " << spec[1].c_str() << endl;
continue;
}
struct ndb_mgm_reply reply;
int result;
result = ndb_mgm_set_loglevel_clusterlog(m_mgmsrv,
processId,
(ndb_mgm_event_category)category,
level,
&reply);
ndbout << "Executing CLUSTERLOG " << spec[0] << "=" << spec[1]
<< " on node " << processId << flush;
struct ndb_mgm_reply reply;
int result;
result = ndb_mgm_set_loglevel_clusterlog(m_mgmsrv,
processId,
(ndb_mgm_event_category)category,
level,
&reply);
if (result != 0) {
ndbout_c(" failed.");
printError();
} else {
ndbout_c(" OK!");
}
if (result != 0) {
ndbout_c(" failed.");
printError();
} else {
ndbout_c(" OK!");
}
}
}
/*****************************************************************************
......
......@@ -2136,7 +2136,17 @@ const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
/****************************************************************************
* Ctor
****************************************************************************/
static void require(bool v) { if(!v) abort();}
static void require(bool v)
{
if(!v)
{
#ifndef DBUG_OFF
abort();
#else
exit(-1);
#endif
}
}
ConfigInfo::ConfigInfo()
: m_info(true), m_systemDefaults(true)
......@@ -2277,7 +2287,7 @@ ConfigInfo::ConfigInfo()
****************************************************************************/
inline void warning(const char * src, const char * arg){
ndbout << "Illegal call to ConfigInfo::" << src << "() - " << arg << endl;
abort();
require(false);
}
const Properties *
......@@ -3394,7 +3404,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){
}
case PropertiesType_Properties:
default:
abort();
::require(false);
}
}
return true;
......@@ -3406,7 +3416,7 @@ static bool
saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
const Properties * sec;
if(!ctx.m_currentInfo->get(ctx.fname, &sec)){
abort();
require(false);
return false;
}
......@@ -3477,7 +3487,7 @@ saveInConfigValues(InitConfigFileParser::Context & ctx, const char * data){
break;
}
default:
abort();
require(false);
}
require(ok);
}
......
......@@ -127,6 +127,7 @@ SUFFIXES = .sh
-e 's!@''innodb_system_libs''@!@innodb_system_libs@!' \
-e 's!@''openssl_libs''@!@openssl_libs@!' \
-e 's!@''VERSION''@!@VERSION@!' \
-e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
-e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \
-e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \
......
......@@ -225,7 +225,7 @@ int ha_archive::write_data_header(gzFile file_to_write)
data_buffer[1]= (uchar)ARCHIVE_VERSION;
if (gzwrite(file_to_write, &data_buffer, DATA_BUFFER_SIZE) !=
sizeof(DATA_BUFFER_SIZE))
DATA_BUFFER_SIZE)
goto error;
DBUG_PRINT("ha_archive::write_data_header", ("Check %u", (uint)data_buffer[0]));
DBUG_PRINT("ha_archive::write_data_header", ("Version %u", (uint)data_buffer[1]));
......
......@@ -608,7 +608,9 @@ int ha_tina::rnd_init(bool scan)
current_position= next_position= 0;
records= 0;
chain_ptr= chain;
#ifdef HAVE_MADVISE
(void)madvise(share->mapped_file,share->file_stat.st_size,MADV_SEQUENTIAL);
#endif
DBUG_RETURN(0);
}
......
......@@ -1916,7 +1916,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
thd->allow_sum_func= 0;
maybe_null= 0;
maybe_null= 1;
item_thd= thd;
/*
......@@ -1929,8 +1929,6 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
args[i]->fix_fields(thd, tables, args + i)) ||
args[i]->check_cols(1))
return 1;
if (i < arg_count_field)
maybe_null|= args[i]->maybe_null;
}
if (agg_item_charsets(collation, func_name(),
......
......@@ -1008,6 +1008,16 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
#endif
clear_all_errors(thd, rli);
/*
Note: We do not need to execute reset_one_shot_variables() if this
db_ok() test fails.
Reason: The db stored in binlog events is the same for SET and for
its companion query. If the SET is ignored because of
db_ok(), the companion query will also be ignored, and if
the companion query is ignored in the db_ok() test of
::exec_event(), then the companion SET also have so we
don't need to reset_one_shot_variables().
*/
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
......@@ -1762,6 +1772,16 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
Create_file_log_event::exec_event() and then discarding Append_block and
al. Another way is do the filtering in the I/O thread (more efficient: no
disk writes at all).
Note: We do not need to execute reset_one_shot_variables() if this
db_ok() test fails.
Reason: The db stored in binlog events is the same for SET and for
its companion query. If the SET is ignored because of
db_ok(), the companion query will also be ignored, and if
the companion query is ignored in the db_ok() test of
::exec_event(), then the companion SET also have so we
don't need to reset_one_shot_variables().
*/
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
......
......@@ -3080,7 +3080,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
*/
error_handler_hook = my_message_sql;
start_signal_handler(); // Creates pidfile
if (acl_init((THD *)0, opt_noacl) ||
if (acl_init(opt_noacl) ||
my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
{
abort_loop=1;
......@@ -3097,7 +3097,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
exit(1);
}
if (!opt_noacl)
(void) grant_init((THD *)0);
(void) grant_init();
#ifdef HAVE_DLOPEN
if (!opt_noacl)
......
......@@ -1602,11 +1602,17 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1);
case SHOW_CHAR:
{
Item_string *tmp;
Item *tmp;
pthread_mutex_lock(&LOCK_global_system_variables);
char *str= (char*) value_ptr(thd, var_type, base);
tmp= new Item_string(str, strlen(str),
system_charset_info, DERIVATION_SYSCONST);
if (str)
tmp= new Item_string(str, strlen(str),
system_charset_info, DERIVATION_SYSCONST);
else
{
tmp= new Item_null();
tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
}
pthread_mutex_unlock(&LOCK_global_system_variables);
return tmp;
}
......@@ -1896,7 +1902,7 @@ byte *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ci_ptr(thd,type)[0];
return cs ? (byte*) cs->csname : (byte*) "NULL";
return cs ? (byte*) cs->csname : (byte*) NULL;
}
......
This diff is collapsed.
......@@ -134,8 +134,8 @@ public:
/* prototypes */
bool hostname_requires_resolving(const char *hostname);
my_bool acl_init(THD *thd, bool dont_read_acl_tables);
void acl_reload(THD *thd);
my_bool acl_init(bool dont_read_acl_tables);
my_bool acl_reload(THD *thd);
void acl_free(bool end=0);
ulong acl_get(const char *host, const char *ip,
const char *user, const char *db, my_bool db_is_pattern);
......@@ -151,9 +151,9 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
List <LEX_COLUMN> &column_list, ulong rights,
bool revoke);
my_bool grant_init(THD *thd);
my_bool grant_init();
void grant_free(void);
void grant_reload(THD *thd);
my_bool grant_reload(THD *thd);
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
uint show_command, uint number, bool dont_print_error);
bool check_grant_column (THD *thd,TABLE *table, const char *name, uint length,
......
......@@ -120,6 +120,9 @@ static bool end_active_trans(THD *thd)
#ifdef HAVE_REPLICATION
/*
Returns true if all tables should be ignored
*/
inline bool all_tables_not_ok(THD *thd, TABLE_LIST *tables)
{
return (table_rules_on && tables && !tables_ok(thd,tables) &&
......@@ -1915,6 +1918,23 @@ bool alloc_query(THD *thd, char *packet, ulong packet_length)
return 0;
}
static void reset_one_shot_variables(THD *thd)
{
thd->variables.character_set_client=
global_system_variables.character_set_client;
thd->variables.collation_connection=
global_system_variables.collation_connection;
thd->variables.collation_database=
global_system_variables.collation_database;
thd->variables.collation_server=
global_system_variables.collation_server;
thd->update_charset();
thd->variables.time_zone=
global_system_variables.time_zone;
thd->one_shot_set= 0;
}
/****************************************************************************
** mysql_execute_command
** Execute command saved in thd and current_lex->sql_command
......@@ -1975,16 +1995,22 @@ mysql_execute_command(THD *thd)
/*
Skip if we are in the slave thread, some table rules have been
given and the table list says the query should not be replicated.
Exception is DROP TEMPORARY TABLE IF EXISTS: we always execute it
(otherwise we have stale files on slave caused by exclusion of one tmp
table).
Exceptions are:
- SET: we always execute it (Not that many SET commands exists in
the binary log anyway -- only 4.1 masters write SET statements,
in 5.0 there are no SET statements in the binary log)
- DROP TEMPORARY TABLE IF EXISTS: we always execute it (otherwise we
have stale files on slave caused by exclusion of one tmp table).
*/
if (!(lex->sql_command == SQLCOM_DROP_TABLE &&
if (!(lex->sql_command == SQLCOM_SET_OPTION) &&
!(lex->sql_command == SQLCOM_DROP_TABLE &&
lex->drop_temporary && lex->drop_if_exists) &&
all_tables_not_ok(thd,tables))
{
/* we warn the slave SQL thread */
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
reset_one_shot_variables(thd);
DBUG_VOID_RETURN;
}
#ifndef TO_BE_DELETED
......@@ -3309,6 +3335,7 @@ purposes internal to the MySQL server", MYF(0));
!db_ok_with_wild_table(lex->name)))
{
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
reset_one_shot_variables(thd);
break;
}
#endif
......@@ -3344,6 +3371,7 @@ purposes internal to the MySQL server", MYF(0));
!db_ok_with_wild_table(lex->name)))
{
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
reset_one_shot_variables(thd);
break;
}
#endif
......@@ -3384,6 +3412,7 @@ purposes internal to the MySQL server", MYF(0));
!db_ok_with_wild_table(db)))
{
my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
reset_one_shot_variables(thd);
break;
}
#endif
......@@ -3718,30 +3747,19 @@ purposes internal to the MySQL server", MYF(0));
break;
}
thd->proc_info="query end"; // QQ
if (thd->one_shot_set)
{
/*
If this is a SET, do nothing. This is to allow mysqlbinlog to print
many SET commands (in this case we want the charset temp setting to
live until the real query). This is also needed so that SET
CHARACTER_SET_CLIENT... does not cancel itself immediately.
*/
if (lex->sql_command != SQLCOM_SET_OPTION)
{
thd->variables.character_set_client=
global_system_variables.character_set_client;
thd->variables.collation_connection=
global_system_variables.collation_connection;
thd->variables.collation_database=
global_system_variables.collation_database;
thd->variables.collation_server=
global_system_variables.collation_server;
thd->update_charset();
thd->variables.time_zone=
global_system_variables.time_zone;
thd->one_shot_set= 0;
}
}
/*
Reset system variables temporarily modified by SET ONE SHOT.
Exception: If this is a SET, do nothing. This is to allow
mysqlbinlog to print many SET commands (in this case we want the
charset temp setting to live until the real query). This is also
needed so that SET CHARACTER_SET_CLIENT... does not cancel itself
immediately.
*/
if (thd->one_shot_set && lex->sql_command != SQLCOM_SET_OPTION)
reset_one_shot_variables(thd);
if (res < 0)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0);
......@@ -4988,10 +5006,27 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (options & REFRESH_GRANT)
{
acl_reload(thd);
grant_reload(thd);
if (mqh_used)
reset_mqh(thd,(LEX_USER *) NULL,TRUE);
THD *tmp_thd= 0;
/*
If reload_acl_and_cache() is called from SIGHUP handler we have to
allocate temporary THD for execution of acl_reload()/grant_reload().
*/
if (!thd && (thd= (tmp_thd= new THD)))
thd->store_globals();
if (thd)
{
(void)acl_reload(thd);
(void)grant_reload(thd);
if (mqh_used)
reset_mqh(thd, (LEX_USER *) NULL, TRUE);
}
if (tmp_thd)
{
delete tmp_thd;
/* Remember that we don't have a THD */
my_pthread_setspecific_ptr(THR_THD, 0);
thd= 0;
}
}
#endif
if (options & REFRESH_LOG)
......
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