Commit 38627075 authored by Mattias Jonsson's avatar Mattias Jonsson

merge

parents 1f1c2e22 29acd776
......@@ -447,7 +447,7 @@ struct st_command
char *query, *query_buf,*first_argument,*last_argument,*end;
DYNAMIC_STRING content;
int first_word_len, query_len;
my_bool abort_on_error;
my_bool abort_on_error, used_replace;
struct st_expected_errors expected_errors;
char require_file[FN_REFLEN];
enum enum_commands type;
......@@ -3414,7 +3414,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
if (ds_wild && ds_wild->length &&
wild_compare(file->name, ds_wild->str, 0))
continue;
dynstr_append(ds, file->name);
replace_dynstr_append(ds, file->name);
dynstr_append(ds, "\n");
}
set_wild_chars(0);
......@@ -3444,6 +3444,7 @@ static void do_list_files(struct st_command *command)
{"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"}
};
DBUG_ENTER("do_list_files");
command->used_replace= 1;
check_command_args(command, command->first_argument,
list_files_args,
......@@ -3485,6 +3486,7 @@ static void do_list_files_write_file_command(struct st_command *command,
{"file", ARG_STRING, FALSE, &ds_wild, "Filename (incl. wildcard)"}
};
DBUG_ENTER("do_list_files_write_file");
command->used_replace= 1;
check_command_args(command, command->first_argument,
list_files_args,
......@@ -8479,7 +8481,7 @@ int main(int argc, char **argv)
memset(&saved_expected_errors, 0, sizeof(saved_expected_errors));
}
if (command_executed != last_command_executed)
if (command_executed != last_command_executed || command->used_replace)
{
/*
As soon as any command has been executed,
......
......@@ -24,8 +24,6 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes
main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
parts.partition_alter4_innodb # Bug#45299 2010-06-28 alik Test "partition_alter4_innodb" is taking too long, timeout
rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again
rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically
rpl.rpl_innodb_bug28430* # Bug#46029
......
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb main.variables-big rpl_ndb.rpl_truncate_7ndb_2
drop table if exists t1, t2;
#
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
(id INT NOT NULL PRIMARY KEY,
name VARCHAR(16) NOT NULL,
year YEAR,
INDEX name (name(8))
)
PARTITION BY HASH(id) PARTITIONS 2;
INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
CREATE TABLE t2 (id INT);
INSERT INTO t2 VALUES (1),(2);
UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
DROP TABLE t1, t2;
#
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
#
CREATE TABLE t1 (
......@@ -551,12 +566,12 @@ create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
ERROR HY000: VALUES value must be of same type as partition function
ERROR HY000: VALUES value for partition 'p0' must have type INT
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
partition p1 values in (10));
ERROR HY000: VALUES value must be of same type as partition function
ERROR HY000: VALUES value for partition 'p0' must have type INT
create table t1 (a bigint unsigned)
partition by range (a)
(partition p0 values less than (100),
......
drop table if exists t1;
drop table if exists t1, t2;
#
# Bug#50036: Inconsistent errors when using TIMESTAMP
# columns/expressions
# 1. correct and appropriate errors in light of
# the fix for BUG#42849:
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t2 (c TIMESTAMP);
ALTER TABLE t2
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
DROP TABLE t2;
# 2. These errors where questionable before the fix:
# VALUES clause are checked first, clearified the error message.
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: VALUES value for partition 'p0' must have type INT
# TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP).
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: VALUES value for partition 'p0' must have type INT
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
DROP TABLE t1;
# Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY HASH (c) PARTITIONS 4;
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
SELECT * FROM t1;
a
2000-01-02 03:04:05
FLUSH TABLES;
SELECT * FROM t1;
a
2000-01-02 03:04:05
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
Warnings:
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a)) */
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a))
PARTITIONS 3 */
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
DROP TABLE t1;
#
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
#
......@@ -497,7 +617,7 @@ partition by range (a)
partitions 2
(partition x1 values less than (4.0) tablespace ts1,
partition x2 values less than (8) tablespace ts2);
ERROR HY000: VALUES value must be of same type as partition function
ERROR HY000: VALUES value for partition 'x1' must have type INT
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -736,7 +856,7 @@ partition by list (a)
partitions 2
(partition x1 values in (4.0, 12+8),
partition x2 values in (3, 21));
ERROR HY000: VALUES value must be of same type as partition function
ERROR HY000: VALUES value for partition 'x1' must have type INT
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -796,12 +916,12 @@ CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: The PARTITION function returns the wrong type
ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
ALTER TABLE old
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
ERROR HY000: The PARTITION function returns the wrong type
ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a+0) (
PARTITION p VALUES LESS THAN (20080819),
......
......@@ -26,10 +26,12 @@ if ($do_file_tests)
{
let $ls_file= $MYSQLD_DATADIR/test/tmp2;
# List the files belonging to the table t1
--replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP#
--list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
--chmod 0644 $ls_file
if ($with_directories)
{
--replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP#
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
}
eval SET @aux = load_file('$ls_file');
......@@ -60,16 +62,15 @@ if ($found_garbage)
--echo # <alter partitioning> worked incomplete.
--echo # We found:
# Print the list of files into the protocol
eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
AS "unified filelist"
eval SELECT file_list AS "unified filelist"
FROM t0_definition WHERE state = 'old';
}
# Do a manual cleanup, because the following tests should not suffer from
# remaining files
--exec rm -f $MYSQLD_DATADIR/test/t1* || true
--remove_files_wildcard $MYSQLD_DATADIR/test t1*
if ($with_directories)
{
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*
}
}
--enable_query_log
......@@ -3,7 +3,7 @@
--eval $create_statement
--eval $insert_statement
--echo # State before crash
--replace_result #p# #P#
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
......@@ -14,13 +14,13 @@ SELECT * FROM t1;
--error 2013
--eval $crash_statement
--echo # State after crash (before recovery)
--replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/
--replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/ /#sp#/#SP#/ /#tmp#/#TMP#/
--list_files $DATADIR/test
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # State after crash recovery
--replace_result #p# #P#
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
......
......@@ -3,6 +3,7 @@
--eval $create_statement
--eval $insert_statement
--echo # State before failure
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
......@@ -11,8 +12,29 @@ SELECT * FROM t1;
--eval $fail_statement
--enable_abort_on_error
--echo # State after failure
--replace_result #p# #P# #sp# #SP#
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
--echo # Same test under LOCK TABLE
--eval $create_statement
--eval $insert_statement
--echo # State before failure
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
LOCK TABLE t1 WRITE;
--disable_abort_on_error
--eval $fail_statement
--enable_abort_on_error
--echo # State after failure
--list_files $DATADIR/test
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
UNLOCK TABLES;
DROP TABLE t1;
......@@ -10,6 +10,6 @@ eval SHOW CREATE TABLE t1;
if ($ls)
{
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test t1*
}
......@@ -69,7 +69,7 @@ if ($do_file_tests)
if ($ls)
{
# Print the list of files into the protocol
replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP# part_n part_N;
SELECT file_list AS "unified filelist"
FROM t0_definition WHERE state = 'old';
}
......
......@@ -65,7 +65,7 @@ let $run= `SELECT @aux`;
if ($run)
{
--vertical_results
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP#
SELECT state,
REPLACE(create_command,'\n',' ') AS "Table definition",
REPLACE(file_list ,'\n',' ') AS "File list"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
call mtr.add_suppression("./test/t1_will_crash");
call mtr.add_suppression("t1_will_crash");
call mtr.add_suppression("Got an error from unknown thread");
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
......
......@@ -238,11 +238,10 @@ LOCK TABLE t1 READ;
# Third attempt: says that the table does not exist
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Check table returns the same
# Check table returns the same (not after fixing bug#56172!)
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Lock wait timeout exceeded; try restarting transaction
test.t1 check status Operation failed
test.t1 check status OK
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
......
......@@ -214,7 +214,7 @@ SET lock_wait_timeout = 2;
ALTER TABLE t1 COALESCE PARTITION 2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Connection 3 tries to load into the table:
LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f);
LOAD DATA INFILE 'load.in' INTO TABLE t1 (f);
# Connection 1 commits the transaction
COMMIT;
# Connection 3...
......
......@@ -28,6 +28,9 @@ let $do_long_tests= 1;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -46,6 +46,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -45,6 +45,9 @@ let $only_part_1= 1;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -45,6 +45,9 @@ let $only_part_2= 1;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -45,6 +45,9 @@ let $only_part_2= 1;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -43,6 +43,9 @@ let $more_pk_ui_tests= 0;
# The server must support partitioning.
--source include/have_partition.inc
# This test takes long time, so only run it with the --big mtr-flag.
--source include/big_test.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
......
......@@ -56,6 +56,7 @@ partition by range (a)
insert into t1 values (1), (11), (21), (33);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
--replace_result #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
......@@ -78,6 +79,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
disconnect con1;
connection default;
--reap
--replace_result #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test
SHOW CREATE TABLE t1;
SELECT * FROM t1;
......
# test the auto-recover (--myisam-recover) of partitioned myisam tables
call mtr.add_suppression("./test/t1_will_crash");
call mtr.add_suppression("t1_will_crash");
call mtr.add_suppression("Got an error from unknown thread");
--source include/have_partition.inc
......
......@@ -111,7 +111,7 @@ LOCK TABLE t1 READ;
--echo # Third attempt: says that the table does not exist
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
--echo # Check table returns the same
--echo # Check table returns the same (not after fixing bug#56172!)
CHECK TABLE t1;
--connection con1
......
......@@ -62,13 +62,14 @@ ALTER TABLE t1 COALESCE PARTITION 2;
--connect (con3,localhost,root,,)
perl;
open( LD, ">" . "/tmp/load.in" ) || die "Could not open file for writing " . $ENV{'MYSQLTEST_DATADIR'} . "/test/load.in";
print LD "1\n2\n3\n";
close( LD );
--let $MYSQLD_DATADIR= `SELECT @@datadir`
--write_file $MYSQLD_DATADIR/test/load.in
1
2
3
EOF
--echo # Connection 3 tries to load into the table:
send LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f);
send LOAD DATA INFILE 'load.in' INTO TABLE t1 (f);
--connection default
--real_sleep 1
......
......@@ -14,6 +14,28 @@
drop table if exists t1, t2;
--enable_warnings
--echo #
--echo # Bug#57113: ha_partition::extra(ha_extra_function):
--echo # Assertion `m_extra_cache' failed
CREATE TABLE t1
(id INT NOT NULL PRIMARY KEY,
name VARCHAR(16) NOT NULL,
year YEAR,
INDEX name (name(8))
)
PARTITION BY HASH(id) PARTITIONS 2;
INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
CREATE TABLE t2 (id INT);
INSERT INTO t2 VALUES (1),(2);
UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
DROP TABLE t1, t2;
--echo #
--echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
--echo #
......@@ -458,12 +480,12 @@ drop table t1;
#
# BUG 16002: Handle unsigned integer functions properly
#
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
......
......@@ -8,10 +8,8 @@ DROP TABLE IF EXISTS t1;
--echo #
--echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
--echo # partitioned MyISAM table
perl;
open( INIT, ">init_file.txt");
print INIT "abcd\n";
close( INIT );
--write_file init_file.txt
abcd
EOF
CREATE TABLE t1
......
......@@ -5,11 +5,103 @@
-- source include/have_partition.inc
--disable_warnings
drop table if exists t1;
drop table if exists t1, t2;
--enable_warnings
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # Bug#50036: Inconsistent errors when using TIMESTAMP
--echo # columns/expressions
--echo # 1. correct and appropriate errors in light of
--echo # the fix for BUG#42849:
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
CREATE TABLE t2 (c TIMESTAMP);
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE t2
PARTITION BY RANGE (TO_DAYS(c))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
DROP TABLE t2;
--echo # 2. These errors where questionable before the fix:
--echo # VALUES clause are checked first, clearified the error message.
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (c)
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
--echo # TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP).
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY RANGE (UNIX_TIMESTAMP(c))
(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP('2000-01-01 00:00:00')),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
DROP TABLE t1;
--echo # Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY HASH (c) PARTITIONS 4;
--echo # Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
--sorted_result
SELECT * FROM t1;
FLUSH TABLES;
--remove_file $MYSQLD_DATADIR/test/t1.frm
--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm
--sorted_result
SELECT * FROM t1;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
--sorted_result
SELECT * FROM t1;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
--echo #
......@@ -536,7 +628,7 @@ partitions 2
#
# Partition by range, inconsistent partition function and constants
#
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -849,7 +941,7 @@ partitions 2
#
# Partition by list, wrong constant result type (not INT)
#
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
CREATE TABLE t1 (
a int not null,
b int not null,
......@@ -939,13 +1031,13 @@ PARTITION pmax VALUES LESS THAN MAXVALUE);
# Check that allowed arithmetic/math functions involving TIMESTAMP values result
# in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
PARTITION pmax VALUES LESS THAN MAXVALUE);
--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
--error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
ALTER TABLE old
PARTITION BY RANGE (a) (
PARTITION p VALUES LESS THAN (20080819),
......
......@@ -5698,7 +5698,6 @@ int ha_partition::extra(enum ha_extra_function operation)
DBUG_RETURN(prepare_for_rename());
break;
case HA_EXTRA_PREPARE_FOR_UPDATE:
DBUG_ASSERT(m_extra_cache);
/*
Needs to be run on the first partition in the range now, and
later in late_extra_cache, when switching to a new partition to scan.
......@@ -5706,6 +5705,8 @@ int ha_partition::extra(enum ha_extra_function operation)
m_extra_prepare_for_update= TRUE;
if (m_part_spec.start_part != NO_CURRENT_PART_ID)
{
if (!m_extra_cache)
m_extra_cache_part_id= m_part_spec.start_part;
DBUG_ASSERT(m_extra_cache_part_id == m_part_spec.start_part);
(void) m_file[m_part_spec.start_part]->extra(HA_EXTRA_PREPARE_FOR_UPDATE);
}
......@@ -5977,19 +5978,22 @@ void ha_partition::late_extra_cache(uint partition_id)
{
handler *file;
DBUG_ENTER("ha_partition::late_extra_cache");
DBUG_PRINT("info", ("extra_cache %u partid %u size %u", m_extra_cache,
DBUG_PRINT("info", ("extra_cache %u prepare %u partid %u size %u",
m_extra_cache, m_extra_prepare_for_update,
partition_id, m_extra_cache_size));
if (!m_extra_cache && !m_extra_prepare_for_update)
DBUG_VOID_RETURN;
file= m_file[partition_id];
if (m_extra_cache_size == 0)
(void) file->extra(HA_EXTRA_CACHE);
else
(void) file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size);
if (m_extra_cache)
{
if (m_extra_cache_size == 0)
(void) file->extra(HA_EXTRA_CACHE);
else
(void) file->extra_opt(HA_EXTRA_CACHE, m_extra_cache_size);
}
if (m_extra_prepare_for_update)
{
DBUG_ASSERT(m_extra_cache);
(void) file->extra(HA_EXTRA_PREPARE_FOR_UPDATE);
}
m_extra_cache_part_id= partition_id;
......
......@@ -742,7 +742,6 @@ bool partition_info::check_range_constants(THD *thd)
longlong part_range_value;
bool signed_flag= !part_expr->unsigned_flag;
part_result_type= INT_RESULT;
range_int_array= (longlong*)sql_alloc(num_parts * sizeof(longlong));
if (unlikely(range_int_array == NULL))
{
......@@ -917,7 +916,6 @@ bool partition_info::check_list_constants(THD *thd)
List_iterator<partition_element> list_func_it(partitions);
DBUG_ENTER("partition_info::check_list_constants");
part_result_type= INT_RESULT;
num_list_values= 0;
/*
We begin by calculating the number of list values that have been
......@@ -1608,6 +1606,52 @@ id_err:
return 1;
}
/**
Check what kind of error to report
@param use_subpart_expr Use the subpart_expr instead of part_expr
@param part_str Name of partition to report error (or NULL)
*/
void partition_info::report_part_expr_error(bool use_subpart_expr)
{
Item *expr= part_expr;
DBUG_ENTER("partition_info::report_part_expr_error");
if (use_subpart_expr)
expr= subpart_expr;
if (expr->type() == Item::FIELD_ITEM)
{
partition_type type= part_type;
bool list_of_fields= list_of_part_fields;
Item_field *item_field= (Item_field*) expr;
/*
The expression consists of a single field.
It must be of integer type unless KEY or COLUMNS partitioning.
*/
if (use_subpart_expr)
{
type= subpart_type;
list_of_fields= list_of_subpart_fields;
}
if (!column_list &&
item_field->field &&
item_field->field->result_type() != INT_RESULT &&
!(type == HASH_PARTITION && list_of_fields))
{
my_error(ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD, MYF(0),
item_field->name);
DBUG_VOID_RETURN;
}
}
if (use_subpart_expr)
my_error(ER_PARTITION_FUNC_NOT_ALLOWED_ERROR, MYF(0), "SUBPARTITION");
else
my_error(ER_PARTITION_FUNC_NOT_ALLOWED_ERROR, MYF(0), "PARTITION");
DBUG_VOID_RETURN;
}
/*
Create a new column value in current list with maxvalue
Called from parser
......@@ -1891,7 +1935,7 @@ int partition_info::reorganize_into_single_field_col_val()
code.
SYNOPSIS
fix_func_partition()
fix_partition_values()
thd Thread object
col_val Array of one value
part_elem The partition instance
......@@ -1901,13 +1945,13 @@ int partition_info::reorganize_into_single_field_col_val()
TRUE Failure
FALSE Success
*/
int partition_info::fix_func_partition(THD *thd,
part_elem_value *val,
partition_element *part_elem,
uint part_id)
int partition_info::fix_partition_values(THD *thd,
part_elem_value *val,
partition_element *part_elem,
uint part_id)
{
part_column_list_val *col_val= val->col_val_array;
DBUG_ENTER("partition_info::fix_func_partition");
DBUG_ENTER("partition_info::fix_partition_values");
if (col_val->fixed)
{
......@@ -1953,7 +1997,8 @@ int partition_info::fix_func_partition(THD *thd,
}
else if (item_expr->result_type() != INT_RESULT)
{
my_error(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR, MYF(0));
my_error(ER_VALUES_IS_NOT_INT_TYPE_ERROR, MYF(0),
part_elem->partition_name);
DBUG_RETURN(TRUE);
}
if (part_type == RANGE_PARTITION)
......@@ -2168,7 +2213,7 @@ int partition_info::fix_parser_data(THD *thd)
}
else
{
if (fix_func_partition(thd, val, part_elem, i))
if (fix_partition_values(thd, val, part_elem, i))
{
DBUG_RETURN(TRUE);
}
......
......@@ -166,7 +166,6 @@ public:
key_map some_fields_in_PF;
handlerton *default_engine_type;
Item_result part_result_type;
partition_type part_type;
partition_type subpart_type;
......@@ -226,7 +225,6 @@ public:
curr_part_elem(NULL), current_partition(NULL),
curr_list_object(0), num_columns(0),
default_engine_type(NULL),
part_result_type(INT_RESULT),
part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION),
part_info_len(0),
part_func_len(0), subpart_func_len(0),
......@@ -279,10 +277,10 @@ public:
void print_no_partition_found(TABLE *table);
void print_debug(const char *str, uint*);
Item* get_column_item(Item *item, Field *field);
int fix_func_partition(THD *thd,
part_elem_value *val,
partition_element *part_elem,
uint part_id);
int fix_partition_values(THD *thd,
part_elem_value *val,
partition_element *part_elem,
uint part_id);
bool fix_column_value_functions(THD *thd,
part_elem_value *val,
uint part_id);
......@@ -299,6 +297,7 @@ public:
bool init_column_part();
bool add_column_list_value(THD *thd, Item *item);
void set_show_version_string(String *packet);
void report_part_expr_error(bool use_subpart_expr);
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
......
......@@ -6346,3 +6346,7 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN
ER_FAILED_READ_FROM_PAR_FILE
eng "Failed to read from the .par file"
swe "Misslyckades läsa från .par filen"
ER_VALUES_IS_NOT_INT_TYPE_ERROR
eng "VALUES value for partition '%-.64s' must have type INT"
swe "Värden i VALUES för partition '%-.64s' måste ha typen INT"
This diff is collapsed.
......@@ -54,6 +54,7 @@ typedef struct st_lock_param_type
HA_CREATE_INFO *create_info;
Alter_info *alter_info;
TABLE *table;
TABLE *old_table;
KEY *key_info_buffer;
const char *db;
const char *table_name;
......@@ -252,14 +253,17 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
TABLE_LIST *table_list,
char *db,
const char *table_name,
uint fast_alter_partition);
TABLE *fast_alter_table);
uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
enum partition_state part_state);
uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
HA_CREATE_INFO *create_info,
handlerton *old_db_type,
bool *partition_changed,
uint *fast_alter_partition);
char *db,
const char *table_name,
const char *path,
TABLE **fast_alter_table);
char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc,
bool show_partition_options,
......
......@@ -1725,8 +1725,6 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
CHF_DELETE_FLAG, NULL) ||
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos) ||
(sync_ddl_log(), FALSE) ||
#endif
#ifdef WITH_PARTITION_STORAGE_ENGINE
mysql_file_rename(key_file_frm,
shadow_frm_name, frm_name, MYF(MY_WME)) ||
lpt->table->file->ha_create_handler_files(path, shadow_path,
......@@ -5605,7 +5603,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
handlerton *old_db_type, *new_db_type, *save_old_db_type;
enum_alter_table_change_level need_copy_table= ALTER_TABLE_METADATA_ONLY;
#ifdef WITH_PARTITION_STORAGE_ENGINE
uint fast_alter_partition= 0;
TABLE *table_for_fast_alter_partition= NULL;
bool partition_changed= FALSE;
#endif
bool need_lock_for_indexes= TRUE;
......@@ -5975,7 +5973,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (prep_alter_part_table(thd, table, alter_info, create_info, old_db_type,
&partition_changed, &fast_alter_partition))
&partition_changed,
db, table_name, path,
&table_for_fast_alter_partition))
goto err;
#endif
/*
......@@ -6208,12 +6208,12 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info->frm_only= 1;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (fast_alter_partition)
if (table_for_fast_alter_partition)
{
DBUG_RETURN(fast_alter_partition_table(thd, table, alter_info,
create_info, table_list,
db, table_name,
fast_alter_partition));
table_for_fast_alter_partition));
}
#endif
......@@ -6693,6 +6693,11 @@ err_new_table_cleanup:
create_info->frm_only ? FN_IS_TMP | FRM_ONLY : FN_IS_TMP);
err:
#ifdef WITH_PARTITION_STORAGE_ENGINE
/* If prep_alter_part_table created an intermediate table, destroy it. */
if (table_for_fast_alter_partition)
close_temporary(table_for_fast_alter_partition, 1, 0);
#endif /* WITH_PARTITION_STORAGE_ENGINE */
/*
No default value was provided for a DATE/DATETIME field, the
current sql_mode doesn't allow the '0000-00-00' value and
......
......@@ -4814,7 +4814,7 @@ part_value_expr_item:
if (!lex->safe_to_cache_query)
{
my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
my_parse_error(ER(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR));
MYSQL_YYABORT;
}
if (part_info->add_column_list_value(YYTHD, part_expr))
......
......@@ -426,6 +426,18 @@ void TABLE_SHARE::destroy()
info_it->flags= 0;
}
}
if (ha_data_destroy)
{
ha_data_destroy(ha_data);
ha_data_destroy= NULL;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (ha_part_data_destroy)
{
ha_part_data_destroy(ha_part_data);
ha_part_data_destroy= NULL;
}
#endif /* WITH_PARTITION_STORAGE_ENGINE */
/*
Make a copy since the share is allocated in its own root,
and free_root() updates its argument after freeing the memory.
......@@ -1704,11 +1716,17 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
delete handler_file;
my_hash_free(&share->name_hash);
if (share->ha_data_destroy)
{
share->ha_data_destroy(share->ha_data);
share->ha_data_destroy= NULL;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (share->ha_part_data_destroy)
{
share->ha_part_data_destroy(share->ha_part_data);
#endif
share->ha_data_destroy= NULL;
}
#endif /* WITH_PARTITION_STORAGE_ENGINE */
open_table_error(share, error, share->open_errno, errarg);
DBUG_RETURN(error);
......
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