Commit 8154355a authored by msvensson@pilot.mysql.com's avatar msvensson@pilot.mysql.com

Merge pilot.mysql.com:/home/msvensson/mysql/mysql-4.1

into  pilot.mysql.com:/home/msvensson/mysql/mysql-4.1-maint
parents a7862496 75d91ded
...@@ -95,7 +95,11 @@ dist-hook: ...@@ -95,7 +95,11 @@ dist-hook:
tags: tags:
support-files/build-tags support-files/build-tags
.PHONY: init-db bin-dist
.PHONY: init-db bin-dist \
test test-force test-full test-force-full test-force-mem \
test-pl test-force-pl test-full-pl test-force-full-pl test-force-pl-mem \
test-ps test-ns
# Target 'test' will run the regression test suite using the built server. # Target 'test' will run the regression test suite using the built server.
# #
...@@ -105,36 +109,33 @@ tags: ...@@ -105,36 +109,33 @@ tags:
# will then calculate the various port numbers it needs from this, # will then calculate the various port numbers it needs from this,
# making sure each user use different ports. # making sure each user use different ports.
test: test-ps:
cd mysql-test ; \ cd mysql-test ; \
./mysql-test-run && \ @PERL@ ./mysql-test-run.pl $(force) --ps-protocol
./mysql-test-run --ps-protocol
test-force: test-ns:
cd mysql-test; \ cd mysql-test ; \
./mysql-test-run --force && \ @PERL@ ./mysql-test-run.pl $(force)
./mysql-test-run --ps-protocol --force
test-force-mem: test: test-ns test-ps
cd mysql-test; \
./mysql-test-run --force --mem && \
./mysql-test-run --ps-protocol --force --mem
# To ease script-writing, although in 4.1 it is identical to 'test'
test-full: test
# We are testing a new Perl version of the test script test-force:
test-pl: $(MAKE) force=--force test
cd mysql-test; \
./mysql-test-run.pl && \
./mysql-test-run.pl --ps-protocol
test-force-pl: test-force-full:
cd mysql-test; \ $(MAKE) force=--force test-full
./mysql-test-run.pl --force && \
./mysql-test-run.pl --ps-protocol --force
#used by autopush.pl to run memory based tests #used by autopush.pl to run memory based tests
test-force-pl-mem: test-force-mem:
cd mysql-test; \ $(MAKE) 'force=--force --mem' test
./mysql-test-run.pl --force --mem && \
./mysql-test-run.pl --ps-protocol --force --mem # Keep these for a while
test-pl: test
test-full-pl: test-full
test-force-pl: test-force
test-force-pl-mem: test-force-mem
test-force-full-pl: test-force-full
...@@ -1240,7 +1240,9 @@ void var_set(const char *var_name, const char *var_name_end, ...@@ -1240,7 +1240,9 @@ void var_set(const char *var_name, const char *var_name_end,
v->int_dirty= 0; v->int_dirty= 0;
v->str_val_len= strlen(v->str_val); v->str_val_len= strlen(v->str_val);
} }
strxmov(buf, v->name, "=", v->str_val, NullS); my_snprintf(buf, sizeof(buf), "%.*s=%.*s",
v->name_len, v->name,
v->str_val_len, v->str_val);
if (!(v->env_s= my_strdup(buf, MYF(MY_WME)))) if (!(v->env_s= my_strdup(buf, MYF(MY_WME))))
die("Out of memory"); die("Out of memory");
putenv(v->env_s); putenv(v->env_s);
...@@ -2968,7 +2970,12 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, ...@@ -2968,7 +2970,12 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR || if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR ||
mysql_errno(mysql) == CR_CONNECTION_ERROR) && mysql_errno(mysql) == CR_CONNECTION_ERROR) &&
failed_attempts < opt_max_connect_retries) failed_attempts < opt_max_connect_retries)
{
verbose_msg("Connect attempt %d/%d failed: %d: %s", failed_attempts,
opt_max_connect_retries, mysql_errno(mysql),
mysql_error(mysql));
my_sleep(connection_retry_sleep); my_sleep(connection_retry_sleep);
}
else else
{ {
if (failed_attempts > 0) if (failed_attempts > 0)
...@@ -4678,10 +4685,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, ...@@ -4678,10 +4685,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
} }
/* /*
Store the result. If res is NULL, use mysql_field_count to Store the result of the query if it will return any fields
determine if that was expected
*/ */
if (!(res= mysql_store_result(mysql)) && mysql_field_count(mysql)) if (mysql_field_count(mysql) && ((res= mysql_store_result(mysql)) == 0))
{ {
handle_error(command, mysql_errno(mysql), mysql_error(mysql), handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds); mysql_sqlstate(mysql), ds);
...@@ -4733,7 +4739,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, ...@@ -4733,7 +4739,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
} }
if (res) if (res)
{
mysql_free_result(res); mysql_free_result(res);
res= 0;
}
counter++; counter++;
} while (!(err= mysql_next_result(mysql))); } while (!(err= mysql_next_result(mysql)));
if (err > 0) if (err > 0)
...@@ -4800,7 +4809,7 @@ void handle_error(struct st_command *command, ...@@ -4800,7 +4809,7 @@ void handle_error(struct st_command *command,
err_errno, err_error); err_errno, err_error);
/* Abort the run of this test, pass the failed query as reason */ /* Abort the run of this test, pass the failed query as reason */
abort_not_supported_test("Query '%s' failed, required functionality" \ abort_not_supported_test("Query '%s' failed, required functionality " \
"not supported", command->query); "not supported", command->query);
} }
......
...@@ -288,6 +288,7 @@ sub collect_one_test_case($$$$$$$) { ...@@ -288,6 +288,7 @@ sub collect_one_test_case($$$$$$$) {
$tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
$tinfo->{'slave_num'}= 0; # Default, no slave $tinfo->{'slave_num'}= 0; # Default, no slave
$tinfo->{'master_num'}= 1; # Default, 1 master
if ( defined mtr_match_prefix($tname,"rpl") ) if ( defined mtr_match_prefix($tname,"rpl") )
{ {
if ( $::opt_skip_rpl ) if ( $::opt_skip_rpl )
...@@ -297,13 +298,8 @@ sub collect_one_test_case($$$$$$$) { ...@@ -297,13 +298,8 @@ sub collect_one_test_case($$$$$$$) {
return; return;
} }
$tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave
if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
{
# $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange
}
} }
if ( defined mtr_match_prefix($tname,"federated") ) if ( defined mtr_match_prefix($tname,"federated") )
...@@ -582,6 +578,7 @@ our @tags= ...@@ -582,6 +578,7 @@ our @tags=
["include/have_debug.inc", "need_debug", 1], ["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1], ["include/have_ndb.inc", "ndb_test", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1],
["include/have_multi_ndb.inc", "master_num", 2],
["require_manager", "require_manager", 1], ["require_manager", "require_manager", 1],
); );
......
...@@ -220,7 +220,8 @@ sub spawn_parent_impl { ...@@ -220,7 +220,8 @@ sub spawn_parent_impl {
my $ret_pid= waitpid($pid,0); my $ret_pid= waitpid($pid,0);
if ( $ret_pid != $pid ) if ( $ret_pid != $pid )
{ {
mtr_error("$path ($pid) got lost somehow"); mtr_error("waitpid($pid, 0) returned $ret_pid " .
"when waiting for '$path'");
} }
return mtr_process_exit_status($?); return mtr_process_exit_status($?);
......
...@@ -222,10 +222,12 @@ our $opt_ndbconnectstring_slave; ...@@ -222,10 +222,12 @@ our $opt_ndbconnectstring_slave;
our $opt_record; our $opt_record;
our $opt_report_features; our $opt_report_features;
our $opt_check_testcases; our $opt_check_testcases;
our $opt_mark_progress;
our $opt_skip; our $opt_skip;
our $opt_skip_rpl; our $opt_skip_rpl;
our $max_slave_num= 0; our $max_slave_num= 0;
our $max_master_num= 0;
our $use_innodb; our $use_innodb;
our $opt_skip_test; our $opt_skip_test;
our $opt_skip_im; our $opt_skip_im;
...@@ -403,6 +405,15 @@ sub main () { ...@@ -403,6 +405,15 @@ sub main () {
$max_slave_num= $test->{slave_num}; $max_slave_num= $test->{slave_num};
mtr_error("Too many slaves") if $max_slave_num > 3; mtr_error("Too many slaves") if $max_slave_num > 3;
} }
# Count max number of masters used by a test case
if ( $test->{master_num} > $max_master_num)
{
$max_master_num= $test->{master_num};
mtr_error("Too many masters") if $max_master_num > 2;
mtr_error("Too few masters") if $max_master_num < 1;
}
$use_innodb||= $test->{'innodb_test'}; $use_innodb||= $test->{'innodb_test'};
} }
...@@ -555,6 +566,7 @@ sub command_line_setup () { ...@@ -555,6 +566,7 @@ sub command_line_setup () {
# Test case authoring # Test case authoring
'record' => \$opt_record, 'record' => \$opt_record,
'check-testcases' => \$opt_check_testcases, 'check-testcases' => \$opt_check_testcases,
'mark-progress' => \$opt_mark_progress,
# Extra options used when starting mysqld # Extra options used when starting mysqld
'mysqld=s' => \@opt_extra_mysqld_opt, 'mysqld=s' => \@opt_extra_mysqld_opt,
...@@ -1215,14 +1227,28 @@ sub command_line_setup () { ...@@ -1215,14 +1227,28 @@ sub command_line_setup () {
$path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
$path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
if ( $opt_valgrind and $opt_debug )
{
# When both --valgrind and --debug is selected, send
# all output to the trace file, making it possible to
# see the exact location where valgrind complains
foreach my $mysqld (@{$master}, @{$slave})
{
my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : "";
$mysqld->{path_myerr}=
"$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace";
}
}
} }
sub datadir_list_setup () { sub datadir_list_setup () {
# Make a list of all data_dirs # Make a list of all data_dirs
@data_dir_lst = ( for (my $idx= 0; $idx < $max_master_num; $idx++)
$master->[0]->{'path_myddir'}, {
$master->[1]->{'path_myddir'}); push(@data_dir_lst, $master->[$idx]->{'path_myddir'});
}
for (my $idx= 0; $idx < $max_slave_num; $idx++) for (my $idx= 0; $idx < $max_slave_num; $idx++)
{ {
...@@ -2629,8 +2655,10 @@ sub mysql_install_db () { ...@@ -2629,8 +2655,10 @@ sub mysql_install_db () {
install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[0]->{'path_myddir'});
# FIXME check if testcase really is using second master if ($max_master_num)
copy_install_db('master', $master->[1]->{'path_myddir'}); {
copy_install_db('master', $master->[1]->{'path_myddir'});
}
# Install the number of slave databses needed # Install the number of slave databses needed
for (my $idx= 0; $idx < $max_slave_num; $idx++) for (my $idx= 0; $idx < $max_slave_num; $idx++)
...@@ -3432,11 +3460,10 @@ sub mysqld_arguments ($$$$$) { ...@@ -3432,11 +3460,10 @@ sub mysqld_arguments ($$$$$) {
if ( $glob_use_embedded_server ) if ( $glob_use_embedded_server )
{ {
$prefix= "--server-arg="; $prefix= "--server-arg=";
} else {
# We can't pass embedded server --no-defaults
mtr_add_arg($args, "--no-defaults");
} }
mtr_add_arg($args, "%s--no-defaults", $prefix);
mtr_add_arg($args, "%s--console", $prefix); mtr_add_arg($args, "%s--console", $prefix);
mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
...@@ -4165,7 +4192,8 @@ sub run_testcase_start_servers($) { ...@@ -4165,7 +4192,8 @@ sub run_testcase_start_servers($) {
} }
if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} ) if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} and
$tinfo->{'master_num'} > 1 )
{ {
# Test needs cluster, start an extra mysqld connected to cluster # Test needs cluster, start an extra mysqld connected to cluster
...@@ -4376,6 +4404,10 @@ sub run_mysqltest ($) { ...@@ -4376,6 +4404,10 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
# Log line number and time for each line in .test file
mtr_add_arg($args, "--mark-progress")
if $opt_mark_progress;
if ($tinfo->{'component_id'} eq 'im') if ($tinfo->{'component_id'} eq 'im')
{ {
mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'}); mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
...@@ -4829,6 +4861,7 @@ Options for test case authoring ...@@ -4829,6 +4861,7 @@ Options for test case authoring
record TESTNAME (Re)genereate the result file for TESTNAME record TESTNAME (Re)genereate the result file for TESTNAME
check-testcases Check testcases for sideeffects check-testcases Check testcases for sideeffects
mark-progress Log line number and elapsed time to <testname>.progress
Options that pass on options Options that pass on options
......
DROP TABLE IF EXISTS t1;
SET NAMES hebrew;
CREATE TABLE t1 (a char(1)) DEFAULT CHARSET=hebrew;
INSERT INTO t1 VALUES (0xFD),(0xFE);
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SELECT HEX(a) FROM t1;
HEX(a)
E2808E
E2808F
DROP TABLE t1;
End of 4.1 tests
...@@ -923,24 +923,4 @@ SET @@myisam_repair_threads=1; ...@@ -923,24 +923,4 @@ SET @@myisam_repair_threads=1;
SHOW VARIABLES LIKE 'myisam_repair%'; SHOW VARIABLES LIKE 'myisam_repair%';
Variable_name Value Variable_name Value
myisam_repair_threads 1 myisam_repair_threads 1
show create table t1; End of 4.1 tests
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
create table t1 (a int) engine=myisam select 42 a;
select * from t1;
a
9
select * from t1;
a
99
select * from t1;
a
42
drop table t1;
...@@ -102,3 +102,25 @@ t1 CREATE TABLE `t1` ( ...@@ -102,3 +102,25 @@ t1 CREATE TABLE `t1` (
`i` int(11) default NULL `i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
create table t1 (a int) engine=myisam select 42 a;
select * from t1;
a
9
select * from t1;
a
99
select * from t1;
a
42
drop table t1;
End of 4.1 tests
...@@ -54,7 +54,7 @@ ushort smallint(5) unsigned zerofill NULL MUL 00000 # ...@@ -54,7 +54,7 @@ ushort smallint(5) unsigned zerofill NULL MUL 00000 #
umedium mediumint(8) unsigned NULL MUL 0 # umedium mediumint(8) unsigned NULL MUL 0 #
ulong int(11) unsigned NULL MUL 0 # ulong int(11) unsigned NULL MUL 0 #
ulonglong bigint(13) unsigned NULL MUL 0 # ulonglong bigint(13) unsigned NULL MUL 0 #
time_stamp timestamp NULL YES CURRENT_TIMESTAMP # time_stamp timestamp NULL CURRENT_TIMESTAMP #
date_field date NULL YES NULL # date_field date NULL YES NULL #
time_field time NULL YES NULL # time_field time NULL YES NULL #
date_time datetime NULL YES NULL # date_time datetime NULL YES NULL #
...@@ -222,7 +222,7 @@ ushort smallint(5) unsigned zerofill NULL 00000 # ...@@ -222,7 +222,7 @@ ushort smallint(5) unsigned zerofill NULL 00000 #
umedium mediumint(8) unsigned NULL MUL 0 # umedium mediumint(8) unsigned NULL MUL 0 #
ulong int(11) unsigned NULL MUL 0 # ulong int(11) unsigned NULL MUL 0 #
ulonglong bigint(13) unsigned NULL MUL 0 # ulonglong bigint(13) unsigned NULL MUL 0 #
time_stamp timestamp NULL YES CURRENT_TIMESTAMP # time_stamp timestamp NULL CURRENT_TIMESTAMP #
date_field varchar(10) latin1_swedish_ci YES NULL # date_field varchar(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL # time_field time NULL YES NULL #
date_time datetime NULL YES NULL # date_time datetime NULL YES NULL #
...@@ -248,7 +248,7 @@ ushort smallint(5) unsigned zerofill NULL 00000 # ...@@ -248,7 +248,7 @@ ushort smallint(5) unsigned zerofill NULL 00000 #
umedium mediumint(8) unsigned NULL 0 # umedium mediumint(8) unsigned NULL 0 #
ulong int(11) unsigned NULL 0 # ulong int(11) unsigned NULL 0 #
ulonglong bigint(13) unsigned NULL 0 # ulonglong bigint(13) unsigned NULL 0 #
time_stamp timestamp NULL YES 0000-00-00 00:00:00 # time_stamp timestamp NULL 0000-00-00 00:00:00 #
date_field varchar(10) latin1_swedish_ci YES NULL # date_field varchar(10) latin1_swedish_ci YES NULL #
time_field time NULL YES NULL # time_field time NULL YES NULL #
date_time datetime NULL YES NULL # date_time datetime NULL YES NULL #
......
...@@ -188,9 +188,9 @@ t1 CREATE TABLE `t1` ( ...@@ -188,9 +188,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
t1 timestamp YES 2003-01-01 00:00:00 t1 timestamp 2003-01-01 00:00:00
t2 datetime YES NULL t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00 t3 timestamp 0000-00-00 00:00:00
drop table t1; drop table t1;
create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp); create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp);
SET TIMESTAMP=1000000002; SET TIMESTAMP=1000000002;
...@@ -212,9 +212,9 @@ t1 CREATE TABLE `t1` ( ...@@ -212,9 +212,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP t1 timestamp CURRENT_TIMESTAMP
t2 datetime YES NULL t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00 t3 timestamp 0000-00-00 00:00:00
drop table t1; drop table t1;
create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime); create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime);
SET TIMESTAMP=1000000004; SET TIMESTAMP=1000000004;
...@@ -238,7 +238,7 @@ t1 CREATE TABLE `t1` ( ...@@ -238,7 +238,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
t1 timestamp YES 2003-01-01 00:00:00 t1 timestamp 2003-01-01 00:00:00
t2 datetime YES NULL t2 datetime YES NULL
drop table t1; drop table t1;
create table t1 (t1 timestamp default now() on update now(), t2 datetime); create table t1 (t1 timestamp default now() on update now(), t2 datetime);
...@@ -263,7 +263,7 @@ t1 CREATE TABLE `t1` ( ...@@ -263,7 +263,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP t1 timestamp CURRENT_TIMESTAMP
t2 datetime YES NULL t2 datetime YES NULL
drop table t1; drop table t1;
create table t1 (t1 timestamp, t2 datetime, t3 timestamp); create table t1 (t1 timestamp, t2 datetime, t3 timestamp);
...@@ -289,9 +289,9 @@ t1 CREATE TABLE `t1` ( ...@@ -289,9 +289,9 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP t1 timestamp CURRENT_TIMESTAMP
t2 datetime YES NULL t2 datetime YES NULL
t3 timestamp YES 0000-00-00 00:00:00 t3 timestamp 0000-00-00 00:00:00
drop table t1; drop table t1;
create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime); create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime);
SET TIMESTAMP=1000000009; SET TIMESTAMP=1000000009;
...@@ -315,7 +315,7 @@ t1 CREATE TABLE `t1` ( ...@@ -315,7 +315,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
t1 timestamp YES CURRENT_TIMESTAMP t1 timestamp CURRENT_TIMESTAMP
t2 datetime YES NULL t2 datetime YES NULL
delete from t1; delete from t1;
insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00'); insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
......
...@@ -6,3 +6,9 @@ use prn; ...@@ -6,3 +6,9 @@ use prn;
ERROR 42000: Unknown database 'prn' ERROR 42000: Unknown database 'prn'
create table nu (a int); create table nu (a int);
drop table nu; drop table nu;
drop table if exists t1;
CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
drop table t1;
#
# BUG #24037: Lossy Hebrew to Unicode conversion
#
# Test if LRM and RLM characters are correctly converted to UTF-8
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
SET NAMES hebrew;
CREATE TABLE t1 (a char(1)) DEFAULT CHARSET=hebrew;
INSERT INTO t1 VALUES (0xFD),(0xFE);
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SELECT HEX(a) FROM t1;
DROP TABLE t1;
--echo End of 4.1 tests
...@@ -70,11 +70,14 @@ insert into t2 select id from t1; ...@@ -70,11 +70,14 @@ insert into t2 select id from t1;
create table t3 (kill_id int); create table t3 (kill_id int);
insert into t3 values(connection_id()); insert into t3 values(connection_id());
connect (conn2, localhost, root,,);
connection conn2;
connection conn1;
-- disable_result_log -- disable_result_log
send select id from t1 where id in (select distinct id from t2); send select id from t1 where id in (select distinct id from t2);
-- enable_result_log -- enable_result_log
connect (conn2, localhost, root,,);
connection conn2; connection conn2;
select ((@id := kill_id) - kill_id) from t3; select ((@id := kill_id) - kill_id) from t3;
-- sleep 1 -- sleep 1
......
...@@ -854,40 +854,5 @@ DROP TABLE t1; ...@@ -854,40 +854,5 @@ DROP TABLE t1;
# #
SET @@myisam_repair_threads=1; SET @@myisam_repair_threads=1;
SHOW VARIABLES LIKE 'myisam_repair%'; SHOW VARIABLES LIKE 'myisam_repair%';
# Bug#8706 - temporary table with data directory option fails
#
connect (session1,localhost,root,,);
connect (session2,localhost,root,,);
connection session1;
disable_query_log;
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a;
enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show create table t1;
connection session2;
disable_query_log;
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a;
enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show create table t1;
connection default;
create table t1 (a int) engine=myisam select 42 a;
connection session1;
select * from t1;
disconnect session1;
connection session2;
select * from t1;
disconnect session2;
connection default;
select * from t1;
drop table t1;
# End of 4.1 tests --echo End of 4.1 tests
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
database=db1 database=db1
EOF EOF
--replace_regex /\/.*mysqladmin/mysqladmin/ --replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--error 7 --error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
...@@ -29,6 +29,6 @@ EOF ...@@ -29,6 +29,6 @@ EOF
loose-database=db2 loose-database=db2
EOF EOF
--replace_regex /Warning: .*mysqladmin/Warning: mysqladmin/ --replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1 --exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
...@@ -133,4 +133,41 @@ enable_query_log; ...@@ -133,4 +133,41 @@ enable_query_log;
show create table t1; show create table t1;
drop table t1; drop table t1;
# End of 4.1 tests #
# Bug#8706 - temporary table with data directory option fails
#
connect (session1,localhost,root,,);
connect (session2,localhost,root,,);
connection session1;
disable_query_log;
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a;
enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show create table t1;
connection session2;
disable_query_log;
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a;
enable_query_log;
# If running test suite with a non standard tmp dir, the "show create table"
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show create table t1;
connection default;
create table t1 (a int) engine=myisam select 42 a;
connection session1;
select * from t1;
disconnect session1;
connection session2;
select * from t1;
disconnect session2;
connection default;
select * from t1;
drop table t1;
--echo End of 4.1 tests
...@@ -17,4 +17,13 @@ use prn; ...@@ -17,4 +17,13 @@ use prn;
create table nu (a int); create table nu (a int);
drop table nu; drop table nu;
#
# Bug17489: ailed to put data file in custom directory use "data directory" option
#
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
drop table t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -49,6 +49,7 @@ const char *default_directories[]= { ...@@ -49,6 +49,7 @@ const char *default_directories[]= {
"sys:/etc/", "sys:/etc/",
#else #else
"/etc/", "/etc/",
"/etc/mysql/",
#endif #endif
#ifdef DATADIR #ifdef DATADIR
DATADIR, DATADIR,
......
...@@ -199,11 +199,11 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, ...@@ -199,11 +199,11 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
if (type != READ_NET && type != WRITE_NET) if (type != READ_NET && type != WRITE_NET)
{ {
/* Retry allocating memory in smaller blocks until we get one */ /* Retry allocating memory in smaller blocks until we get one */
cachesize=(uint) ((ulong) (cachesize + min_cache-1) &
(ulong) ~(min_cache-1));
for (;;) for (;;)
{ {
uint buffer_block; uint buffer_block;
cachesize=(uint) ((ulong) (cachesize + min_cache-1) &
(ulong) ~(min_cache-1));
if (cachesize < min_cache) if (cachesize < min_cache)
cachesize = min_cache; cachesize = min_cache;
buffer_block = cachesize; buffer_block = cachesize;
...@@ -222,7 +222,8 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize, ...@@ -222,7 +222,8 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
} }
if (cachesize == min_cache) if (cachesize == min_cache)
DBUG_RETURN(2); /* Can't alloc cache */ DBUG_RETURN(2); /* Can't alloc cache */
cachesize= (uint) ((long) cachesize*3/4); /* Try with less memory */ /* Try with less memory */
cachesize= (uint) ((ulong) cachesize*3/4 & (ulong)~(min_cache-1));
} }
} }
......
...@@ -132,7 +132,13 @@ if test -z "$VISUAL" ...@@ -132,7 +132,13 @@ if test -z "$VISUAL"
then then
if test -z "$EDITOR" if test -z "$EDITOR"
then then
EDIT=emacs # Honor debian sensible-editor
if test -x "/usr/bin/sensible-editor"
then
EDIT=/usr/bin/sensible-editor
else
EDIT=emacs
fi
else else
EDIT="$EDITOR" EDIT="$EDITOR"
fi fi
......
...@@ -437,6 +437,14 @@ sub find_groups ...@@ -437,6 +437,14 @@ sub find_groups
{ {
$data[$i] = $line; $data[$i] = $line;
} }
if (-f "/etc/mysql/my.cnf" && -r "/etc/mysql/my.cnf")
{
open(MY_CNF, "</etc/mysql/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
}
for (; ($line = shift @tmp); $i++)
{
$data[$i] = $line;
}
if (-f "$homedir/.my.cnf" && -r "$homedir/.my.cnf") if (-f "$homedir/.my.cnf" && -r "$homedir/.my.cnf")
{ {
open(MY_CNF, "<$homedir/.my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF); open(MY_CNF, "<$homedir/.my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
...@@ -446,7 +454,7 @@ sub find_groups ...@@ -446,7 +454,7 @@ sub find_groups
$data[$i] = $line; $data[$i] = $line;
} }
} }
chop @data; chomp @data;
# Make a list of the wanted group ids # Make a list of the wanted group ids
if (defined($raw_gids)) if (defined($raw_gids))
{ {
......
...@@ -195,6 +195,7 @@ if [ ! -d $mysql_unix_port_dir ] ...@@ -195,6 +195,7 @@ if [ ! -d $mysql_unix_port_dir ]
then then
mkdir $mysql_unix_port_dir mkdir $mysql_unix_port_dir
chown $user $mysql_unix_port_dir chown $user $mysql_unix_port_dir
chmod 755 $mysql_unix_port_dir
fi fi
# Use the mysqld-max binary by default if the user doesn't specify a binary # Use the mysqld-max binary by default if the user doesn't specify a binary
......
...@@ -40,6 +40,7 @@ unless (@ARGV) { ...@@ -40,6 +40,7 @@ unless (@ARGV) {
warn "basedir=$basedir\n" if $opt{v}; warn "basedir=$basedir\n" if $opt{v};
my $datadir = ($defaults =~ m/--datadir=(.*)/)[0]; my $datadir = ($defaults =~ m/--datadir=(.*)/)[0];
my $slowlog = ($defaults =~ m/--log-slow-queries=(.*)/)[0];
if (!$datadir or $opt{i}) { if (!$datadir or $opt{i}) {
# determine the datadir from the instances section of /etc/my.cnf, if any # determine the datadir from the instances section of /etc/my.cnf, if any
my $instances = `my_print_defaults instances`; my $instances = `my_print_defaults instances`;
...@@ -55,8 +56,13 @@ unless (@ARGV) { ...@@ -55,8 +56,13 @@ unless (@ARGV) {
warn "datadir=$datadir\n" if $opt{v}; warn "datadir=$datadir\n" if $opt{v};
} }
@ARGV = <$datadir/$opt{h}-slow.log>; if ( -f $slowlog ) {
die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV; @ARGV = ($slowlog);
die "Can't find '$slowlog'\n" unless @ARGV;
} else {
@ARGV = <$datadir/$opt{h}-slow.log>;
die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
}
} }
warn "\nReading mysql slow query log from @ARGV\n"; warn "\nReading mysql slow query log from @ARGV\n";
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00 02 02 02 02 02 02 02 02 02 02 02 00 00 20 20 00
</map> </map>
</ctype> </ctype>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017
05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF 05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF
05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000 05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 200E 200F 0000
</map> </map>
</unicode> </unicode>
......
...@@ -2485,6 +2485,12 @@ mysql_execute_command(THD *thd) ...@@ -2485,6 +2485,12 @@ mysql_execute_command(THD *thd)
goto unsent_create_error; goto unsent_create_error;
#ifndef HAVE_READLINK #ifndef HAVE_READLINK
if (lex->create_info.data_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"DATA DIRECTORY option ignored");
if (lex->create_info.index_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"INDEX DIRECTORY option ignored");
lex->create_info.data_file_name=lex->create_info.index_file_name=0; lex->create_info.data_file_name=lex->create_info.index_file_name=0;
#else #else
/* Fix names if symlinked tables */ /* Fix names if symlinked tables */
......
...@@ -714,16 +714,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, ...@@ -714,16 +714,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
if (verbose) if (verbose)
protocol->store(field->has_charset() ? field->charset()->name : "NULL", protocol->store(field->has_charset() ? field->charset()->name : "NULL",
system_charset_info); system_charset_info);
/* pos= (byte*) ((flags & NOT_NULL_FLAG) ? "" : "YES");
Even if TIMESTAMP field can't contain NULL as its value it
will accept NULL if you will try to insert such value and will
convert NULL value to current TIMESTAMP. So YES here means
that NULL is allowed for assignment (but may be won't be
returned).
*/
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
"" : "YES");
protocol->store((const char*) pos, system_charset_info); protocol->store((const char*) pos, system_charset_info);
pos=(byte*) ((field->flags & PRI_KEY_FLAG) ? "PRI" : pos=(byte*) ((field->flags & PRI_KEY_FLAG) ? "PRI" :
(field->flags & UNIQUE_KEY_FLAG) ? "UNI" : (field->flags & UNIQUE_KEY_FLAG) ? "UNI" :
......
...@@ -270,7 +270,14 @@ main(int argc, char **argv __attribute__((unused))) ...@@ -270,7 +270,14 @@ main(int argc, char **argv __attribute__((unused)))
} }
} }
fprintf(f, "/*\n");
fprintf(f, " This file was generated by the conf_to_src utility. "
"Do not edit it directly,\n");
fprintf(f, " edit the XML definitions in sql/share/charsets/ instead.\n\n");
fprintf(f, " To re-generate, run the following in the strings/ "
"directory:\n");
fprintf(f, " ./conf_to_src ../sql/share/charsets/ > FILE\n");
fprintf(f, "*/\n\n");
fprintf(f,"#include <my_global.h>\n"); fprintf(f,"#include <my_global.h>\n");
fprintf(f,"#include <m_ctype.h>\n\n"); fprintf(f,"#include <m_ctype.h>\n\n");
......
/*
This file was generated by the conf_to_src utility. Do not edit it directly,
edit the XML definitions in sql/share/charsets/ instead.
To re-generate, run the following in the strings/ directory:
./conf_to_src ../sql/share/charsets/ > FILE
*/
#include <my_global.h> #include <my_global.h>
#include <m_ctype.h> #include <m_ctype.h>
...@@ -1169,7 +1177,7 @@ uchar ctype_hebrew_general_ci[] = { ...@@ -1169,7 +1177,7 @@ uchar ctype_hebrew_general_ci[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x00
}; };
uchar to_lower_hebrew_general_ci[] = { uchar to_lower_hebrew_general_ci[] = {
...@@ -1261,7 +1269,7 @@ uint16 to_uni_hebrew_general_ci[] = { ...@@ -1261,7 +1269,7 @@ uint16 to_uni_hebrew_general_ci[] = {
0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,
0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,
0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,
0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000 0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x200E,0x200F,0x0000
}; };
#endif #endif
...@@ -5100,7 +5108,7 @@ uchar ctype_hebrew_bin[] = { ...@@ -5100,7 +5108,7 @@ uchar ctype_hebrew_bin[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x00 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x00
}; };
uchar to_lower_hebrew_bin[] = { uchar to_lower_hebrew_bin[] = {
...@@ -5173,7 +5181,7 @@ uint16 to_uni_hebrew_bin[] = { ...@@ -5173,7 +5181,7 @@ uint16 to_uni_hebrew_bin[] = {
0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7, 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,
0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF, 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,
0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7, 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,
0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x0000,0x0000,0x0000 0x05E8,0x05E9,0x05EA,0x0000,0x0000,0x200E,0x200F,0x0000
}; };
#endif #endif
......
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