Commit d36659c4 authored by Sandeep Doddaballapur's avatar Sandeep Doddaballapur

No commit message

No commit message
parents ae789b6e 4e47db3a
...@@ -7255,7 +7255,11 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command, ...@@ -7255,7 +7255,11 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
mysql_free_result(res); /* Free normal result set with meta data */ mysql_free_result(res); /* Free normal result set with meta data */
/* Clear prepare warnings */ /*
Clear prepare warnings if there are execute warnings,
since they are probably duplicated.
*/
if (ds_execute_warnings.length || mysql->warning_count)
dynstr_set(&ds_prepare_warnings, NULL); dynstr_set(&ds_prepare_warnings, NULL);
} }
else else
......
...@@ -4093,8 +4093,10 @@ sub check_expected_crash_and_restart { ...@@ -4093,8 +4093,10 @@ sub check_expected_crash_and_restart {
{ {
mtr_verbose("Crash was expected, file '$expect_file' exists"); mtr_verbose("Crash was expected, file '$expect_file' exists");
for (my $waits = 0; $waits < 50; $waits++) for (my $waits = 0; $waits < 50; mtr_milli_sleep(100), $waits++)
{ {
# Race condition seen on Windows: try again until file not empty
next if -z $expect_file;
# If last line in expect file starts with "wait" # If last line in expect file starts with "wait"
# sleep a little and try again, thus allowing the # sleep a little and try again, thus allowing the
# test script to control when the server should start # test script to control when the server should start
...@@ -4103,10 +4105,11 @@ sub check_expected_crash_and_restart { ...@@ -4103,10 +4105,11 @@ sub check_expected_crash_and_restart {
if ($last_line =~ /^wait/ ) if ($last_line =~ /^wait/ )
{ {
mtr_verbose("Test says wait before restart") if $waits == 0; mtr_verbose("Test says wait before restart") if $waits == 0;
mtr_milli_sleep(100);
next; next;
} }
# Ignore any partial or unknown command
next unless $last_line =~ /^restart/;
# If last line begins "restart:", the rest of the line is read as # If last line begins "restart:", the rest of the line is read as
# extra command line options to add to the restarted mysqld. # extra command line options to add to the restarted mysqld.
# Anything other than 'wait' or 'restart:' (with a colon) will # Anything other than 'wait' or 'restart:' (with a colon) will
...@@ -4471,6 +4474,8 @@ sub mysqld_start ($$) { ...@@ -4471,6 +4474,8 @@ sub mysqld_start ($$) {
my @all_opts= @$extra_opts; my @all_opts= @$extra_opts;
if (exists $mysqld->{'restart_opts'}) { if (exists $mysqld->{'restart_opts'}) {
push (@all_opts, @{$mysqld->{'restart_opts'}}); push (@all_opts, @{$mysqld->{'restart_opts'}});
mtr_verbose(My::Options::toStr("mysqld_start restart",
@{$mysqld->{'restart_opts'}}));
} }
mysqld_arguments($args,$mysqld,\@all_opts); mysqld_arguments($args,$mysqld,\@all_opts);
......
drop table if exists t1; drop table if exists t1;
# #
# Bug#57924: crash when creating partitioned table with
# multiple columns in the partition key
#
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
PARTITION BY KEY(a, b, a);
ERROR HY000: Field in list of fields for partition function not found in table
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
PARTITION BY KEY(A, b);
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
PARTITION BY KEY(a, b, A);
ERROR HY000: Field in list of fields for partition function not found in table
#
# Bug#54483: valgrind errors when making warnings for multiline inserts # Bug#54483: valgrind errors when making warnings for multiline inserts
# into partition # into partition
# #
......
...@@ -585,6 +585,8 @@ c127 int, ...@@ -585,6 +585,8 @@ c127 int,
c128 int, c128 int,
primary key using hash(c1)) engine=ndb partition by key(c1); primary key using hash(c1)) engine=ndb partition by key(c1);
drop table t1; drop table t1;
create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
ERROR HY000: Field in list of fields for partition function not found in table
create table t1 ( create table t1 (
a1234567890123456789012345678901234567890 int primary key, a1234567890123456789012345678901234567890 int primary key,
a12345678901234567890123456789a1234567890 int, a12345678901234567890123456789a1234567890 int,
......
...@@ -547,6 +547,13 @@ c128 int, ...@@ -547,6 +547,13 @@ c128 int,
primary key using hash(c1)) engine=ndb partition by key(c1); primary key using hash(c1)) engine=ndb partition by key(c1);
drop table t1; drop table t1;
#
# test bug#53354 - crash when creating partitioned table with multiple columns in the partition key
#
--error ER_FIELD_NOT_FOUND_PART_ERROR
create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
# #
# test max size of attribute name and truncation # test max size of attribute name and truncation
# #
......
...@@ -13,3 +13,5 @@ ...@@ -13,3 +13,5 @@
rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576 rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576
rpl_log_pos : BUG#55675 Sep 10 2010 27 2010 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle rpl_log_pos : BUG#55675 Sep 10 2010 27 2010 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
...@@ -10,6 +10,21 @@ drop table if exists t1; ...@@ -10,6 +10,21 @@ drop table if exists t1;
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Bug#57924: crash when creating partitioned table with
--echo # multiple columns in the partition key
--echo #
--error ER_FIELD_NOT_FOUND_PART_ERROR
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
PARTITION BY KEY(a, b, a);
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
PARTITION BY KEY(A, b);
DROP TABLE t1;
--error ER_FIELD_NOT_FOUND_PART_ERROR
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
PARTITION BY KEY(a, b, A);
--echo # --echo #
--echo # Bug#54483: valgrind errors when making warnings for multiline inserts --echo # Bug#54483: valgrind errors when making warnings for multiline inserts
--echo # into partition --echo # into partition
...@@ -673,7 +688,6 @@ PARTITION BY HASH (TIME_TO_SEC(a)); ...@@ -673,7 +688,6 @@ PARTITION BY HASH (TIME_TO_SEC(a));
CREATE TABLE t1 (a INT) CREATE TABLE t1 (a INT)
PARTITION BY HASH (TIME_TO_SEC(a)); PARTITION BY HASH (TIME_TO_SEC(a));
--echo # --echo #
--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) --echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
--echo # --echo #
......
...@@ -761,6 +761,9 @@ static bool handle_list_of_fields(List_iterator<char> it, ...@@ -761,6 +761,9 @@ static bool handle_list_of_fields(List_iterator<char> it,
bool result; bool result;
char *field_name; char *field_name;
bool is_list_empty= TRUE; bool is_list_empty= TRUE;
int fields_handled = 0;
char* field_name_array[MAX_KEY];
DBUG_ENTER("handle_list_of_fields"); DBUG_ENTER("handle_list_of_fields");
while ((field_name= it++)) while ((field_name= it++))
...@@ -776,6 +779,25 @@ static bool handle_list_of_fields(List_iterator<char> it, ...@@ -776,6 +779,25 @@ static bool handle_list_of_fields(List_iterator<char> it,
result= TRUE; result= TRUE;
goto end; goto end;
} }
/*
Check for duplicate fields in the list.
Assuming that there are not many fields in the partition key list.
If there were, it would be better to replace the for-loop
with a more efficient algorithm.
*/
field_name_array[fields_handled] = field_name;
for (int i = 0; i < fields_handled; ++i)
{
if (my_strcasecmp(system_charset_info,
field_name_array[i], field_name) == 0)
{
my_error(ER_FIELD_NOT_FOUND_PART_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
}
fields_handled++;
} }
if (is_list_empty) if (is_list_empty)
{ {
......
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