Commit 4fcc6e09 authored by unknown's avatar unknown
Browse files

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1

into  perch.ndb.mysql.com:/home/jonas/src/mysql-4.1

parents 6caa2495 f37d6101
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -454,8 +454,7 @@ sub mtr_kill_leftovers () {

        if ( kill(0, @pids) )           # Check if some left
        {
          # FIXME maybe just mtr_warning() ?
          mtr_error("can't kill process(es) " . join(" ", @pids));
          mtr_warning("can't kill process(es) " . join(" ", @pids));
        }
      }
    }
@@ -468,7 +467,7 @@ sub mtr_kill_leftovers () {
  {
    if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
    {
      mtr_error("can't kill old mysqld holding port $srv->{'port'}");
      mtr_warning("can't kill old mysqld holding port $srv->{'port'}");
    }
  }
}
+8 −0
Original line number Diff line number Diff line
@@ -277,6 +277,8 @@ our $opt_udiff;

our $opt_skip_ndbcluster;
our $opt_with_ndbcluster;
our $opt_with_ndbcluster_only= 0;  # dummy, ignored

our $opt_with_openssl;

our $exe_ndb_mgm;
@@ -512,6 +514,7 @@ sub command_line_setup () {
             'force'                    => \$opt_force,
             'with-ndbcluster'          => \$opt_with_ndbcluster,
             'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
             'with-ndbcluster-only'     => \$opt_with_ndbcluster_only,
             'do-test=s'                => \$opt_do_test,
             'suite=s'                  => \$opt_suite,
             'skip-rpl'                 => \$opt_skip_rpl,
@@ -596,6 +599,11 @@ sub command_line_setup () {
    print '#' x 78, "\n\n";
  }

  if ( $opt_with_ndbcluster_only )
  {
    print "# Option '--with-ndbcluster-only' is ignored in this release.\n";
  }

  foreach my $arg ( @ARGV )
  {
    if ( $arg =~ /^--skip-/ )
+12 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ EXTRA_MYSQLDUMP_OPT=""
EXTRA_MYSQLBINLOG_OPT=""
USE_RUNNING_SERVER=""
USE_NDBCLUSTER=@USE_NDBCLUSTER@
USE_NDBCLUSTER_ONLY=0
USE_RUNNING_NDBCLUSTER=""
USE_PURIFY=""
PURIFY_LOGS=""
@@ -270,6 +271,8 @@ NDB_MGM_EXTRA_OPTS=
NDB_MGMD_EXTRA_OPTS=
NDBD_EXTRA_OPTS=

$ECHO "Logging: $0 $*"   # To ensure we see all arguments in the output, for the test analysis tool

while test $# -gt 0; do
  case "$1" in
    --embedded-server)
@@ -295,6 +298,10 @@ while test $# -gt 0; do
    --extern)  USE_RUNNING_SERVER="1" ;;
    --with-ndbcluster)
      USE_NDBCLUSTER="--ndbcluster" ;;
    --with-ndbcluster-only)
      USE_NDBCLUSTER="--ndbcluster"
      USE_NDBCLUSTER_SLAVE="--ndbcluster"
      USE_NDBCLUSTER_ONLY=1 ;;
    --ndb-connectstring=*)
      USE_NDBCLUSTER="--ndbcluster" ;
      USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
@@ -1524,6 +1531,11 @@ run_testcase ()
   disable_test $tname "$comment"
   return
 fi
 NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
 if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
   skip_test $tname
   return
 fi
 if [ "$USE_MANAGER" = 1 ] ; then
  many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
 fi
+128 −0
Original line number Diff line number Diff line
@@ -107,6 +107,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar;
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 '123.4567' at line 1
drop table t1,t2;
deallocate prepare stmt3;
deallocate prepare stmt4;
deallocate prepare stmt5;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
EXECUTE stmt1 USING @var;
@@ -252,6 +255,7 @@ set names latin1;
execute ``;
1234
1234
deallocate prepare ``;
set names default;
create table t1 (a varchar(10)) charset=utf8;
insert into t1 (a) values ('yahoo');
@@ -747,3 +751,127 @@ length(a)
10
drop table t1;
deallocate prepare stmt;
create table t1 (col1 integer, col2 integer);
insert into t1 values(100,100),(101,101),(102,102),(103,103);
prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
set @a=100, @b=100;
execute stmt using @a,@b;
col1	col2
100	100
set @a=101, @b=101;
execute stmt using @a,@b;
col1	col2
101	101
set @a=102, @b=102;
execute stmt using @a,@b;
col1	col2
102	102
set @a=102, @b=103;
execute stmt using @a,@b;
col1	col2
deallocate prepare stmt;
drop table t1;
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
show variables like 'max_prepared_stmt_count';
Variable_name	Value
max_prepared_stmt_count	16382
show variables like 'prepared_stmt_count';
Variable_name	Value
prepared_stmt_count	0
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
16382	0
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
0
set global max_prepared_stmt_count=10000000000000000;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1048576
set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
16382
set @@max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set @@prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set global prepared_stmt_count=1;
ERROR 42000: Incorrect argument type to variable 'prepared_stmt_count'
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1
set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
0	0
prepare stmt from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
0
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
prepare stmt1 from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
1
deallocate prepare stmt;
select @@prepared_stmt_count;
@@prepared_stmt_count
0
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
prepare stmt from "select 2";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
select @@prepared_stmt_count, @@max_prepared_stmt_count;
@@prepared_stmt_count	@@max_prepared_stmt_count
1	1
set global max_prepared_stmt_count=0;
prepare stmt from "select 1";
ERROR HY000: Unknown error
execute stmt;
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
select @@prepared_stmt_count;
@@prepared_stmt_count
0
prepare stmt from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
0
set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
3	0
prepare stmt from "select 1";
prepare stmt from "select 2";
prepare stmt1 from "select 3";
prepare stmt2 from "select 4";
ERROR HY000: Unknown error
prepare stmt2 from "select 4";
ERROR HY000: Unknown error
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
3	3
deallocate prepare stmt;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
3	0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
+141 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ set @fvar= 123.4567;
prepare stmt1 from @fvar;

drop table t1,t2;
deallocate prepare stmt3;
deallocate prepare stmt4;
deallocate prepare stmt5;

#
# Bug #4105: Server crash on attempt to prepare a statement with character
@@ -254,6 +257,7 @@ prepare `ü` from 'select 1234';
execute `ü` ;
set names latin1;
execute ``;
deallocate prepare ``;
set names default;


@@ -785,4 +789,141 @@ select length(a) from t1;
drop table t1;
deallocate prepare stmt;

#
# Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results":
# check that ROW implementation is reexecution-friendly.
#
create table t1 (col1 integer, col2 integer);
insert into t1 values(100,100),(101,101),(102,102),(103,103);
prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
set @a=100, @b=100;
execute stmt using @a,@b;
set @a=101, @b=101;
execute stmt using @a,@b;
set @a=102, @b=102;
execute stmt using @a,@b;
set @a=102, @b=103;
execute stmt using @a,@b;
deallocate prepare stmt;
drop table t1;

#
# Bug#16365 Prepared Statements: DoS with too many open statements
# Check that the limit @@max_prpeared_stmt_count works.
#
# Save the old value
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
#
# Disable prepared statement protocol: in this test we set
# @@max_prepared_stmt_count to 0 or 1 and would like to test the limit
# manually.
#
--disable_ps_protocol
#
# A. Check that the new variables are present in SHOW VARIABLES list.
#
show variables like 'max_prepared_stmt_count';
show variables like 'prepared_stmt_count';
#
# B. Check that the new variables are selectable.
#
select @@max_prepared_stmt_count, @@prepared_stmt_count;
#
# C. Check that max_prepared_stmt_count is settable (global only),
#    whereas prepared_stmt_count is readonly.
#
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
set global max_prepared_stmt_count=10000000000000000;
select @@max_prepared_stmt_count;
set global max_prepared_stmt_count=default;
select @@max_prepared_stmt_count;
--error 1229 # ER_GLOBAL_VARIABLE
set @@max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set local max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set local prepared_stmt_count=0;
--error 1229 # ER_GLOBAL_VARIABLE
set @@prepared_stmt_count=0;
--error 1232 # ER_WRONG_TYPE_FOR_VAR
set global prepared_stmt_count=1;
# set to a reasonable limit works
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
#
# D. Check that the variables actually work.
#
set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
select @@prepared_stmt_count;
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
select @@prepared_stmt_count;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt1 from "select 1";
select @@prepared_stmt_count;
deallocate prepare stmt;
select @@prepared_stmt_count;
#
# E. Check that we can prepare a statement with the same name 
# successfully, without hitting the limit.
#
prepare stmt from "select 1";
select @@prepared_stmt_count;
prepare stmt from "select 2";
select @@prepared_stmt_count;
#
# F. We can set the max below the current count. In this case no new 
# statements should be allowed to prepare.
#
select @@prepared_stmt_count, @@max_prepared_stmt_count;
set global max_prepared_stmt_count=0;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
# Result: the old statement is deallocated, the new is not created.
--error 1243 # ER_UNKNOWN_STMT_HANDLER
execute stmt;
select @@prepared_stmt_count;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
select @@prepared_stmt_count;
#
# G. Show that the variables are up to date even after a connection with all
# statements in it was terminated.
#
set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
prepare stmt from "select 1";
connect (con1,localhost,root,,);
connection con1;
prepare stmt from "select 2";
prepare stmt1 from "select 3";
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt2 from "select 4";
connection default;
--error 1105 # ER_UNKNOWN_ERROR 
prepare stmt2 from "select 4";
select @@max_prepared_stmt_count, @@prepared_stmt_count;
disconnect con1;
connection default;
# Wait for the connection to die: deal with a possible race
deallocate prepare stmt;
let $count= `select @@prepared_stmt_count`;
if ($count)
{
--sleep 2
  let $count= `select @@prepared_stmt_count`;
}
select @@max_prepared_stmt_count, @@prepared_stmt_count;
#
# Restore the old value.
#
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
--enable_ps_protocol

# End of 4.1 tests
Loading