62 changed files with 1436 additions and 285 deletions
-
1.bzrignore
-
7mysql-test/collections/default.experimental
-
35mysql-test/include/rpl_loaddata_charset.inc
-
14mysql-test/r/auto_increment.result
-
2mysql-test/r/disabled_partition.require
-
16mysql-test/r/handler_myisam.result
-
12mysql-test/r/merge.result
-
45mysql-test/r/not_partition.result
-
51mysql-test/r/partition.result
-
93mysql-test/r/partition_disabled.result
-
220mysql-test/r/type_newdecimal.result
-
38mysql-test/r/view.result
-
3mysql-test/std_data/loaddata_utf8.dat
-
BINmysql-test/std_data/parts/t1.frm
-
2mysql-test/suite/rpl/r/rpl_concurrency_error.result
-
33mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
-
22mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result
-
41mysql-test/suite/rpl/r/rpl_loaddata_charset.result
-
15mysql-test/suite/rpl/t/rpl_concurrency_error.test
-
70mysql-test/suite/rpl/t/rpl_create_if_not_exists.test
-
41mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test
-
17mysql-test/suite/rpl/t/rpl_loaddata_charset.test
-
18mysql-test/t/auto_increment.test
-
19mysql-test/t/handler_myisam.test
-
11mysql-test/t/merge.test
-
25mysql-test/t/not_partition.test
-
47mysql-test/t/partition.test
-
1mysql-test/t/partition_disabled-master.opt
-
85mysql-test/t/partition_disabled.test
-
134mysql-test/t/type_newdecimal.test
-
46mysql-test/t/view.test
-
12server-tools/instance-manager/mysql_connection.cc
-
3sql-common/client.c
-
8sql/client_settings.h
-
85sql/field.cc
-
9sql/field.h
-
33sql/ha_partition.cc
-
8sql/handler.h
-
25sql/item.cc
-
3sql/item.h
-
6sql/item_cmpfunc.cc
-
52sql/item_func.cc
-
1sql/item_func.h
-
3sql/item_sum.cc
-
22sql/log_event.cc
-
14sql/my_decimal.h
-
11sql/opt_range.cc
-
28sql/slave.cc
-
7sql/sql_db.cc
-
4sql/sql_delete.cc
-
52sql/sql_insert.cc
-
3sql/sql_partition.cc
-
41sql/sql_select.cc
-
2sql/sql_show.cc
-
83sql/sql_table.cc
-
1sql/sql_update.cc
-
12sql/sql_yacc.yy
-
9sql/table.cc
-
6sql/table.h
-
2storage/innobase/include/btr0cur.h
-
2storage/innobase/include/trx0types.h
-
10storage/myisam/mi_search.c
@ -0,0 +1,35 @@ |
|||
connection master; |
|||
--disable_warnings |
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
--enable_warnings |
|||
|
|||
CREATE DATABASE mysqltest CHARSET UTF8; |
|||
USE mysqltest; |
|||
CREATE TABLE t (cl varchar(100)) CHARSET UTF8; |
|||
|
|||
if (!$LOAD_LOCAL) |
|||
{ |
|||
LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t |
|||
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; |
|||
} |
|||
if ($LOAD_LOCAL) |
|||
{ |
|||
LOAD DATA LOCAL INFILE './std_data/loaddata_utf8.dat' INTO TABLE t |
|||
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; |
|||
} |
|||
|
|||
save_master_pos; |
|||
echo ----------content on master----------; |
|||
SELECT hex(cl) FROM t; |
|||
|
|||
connection slave; |
|||
sync_with_master; |
|||
echo ----------content on slave----------; |
|||
USE mysqltest; |
|||
SELECT hex(cl) FROM t; |
|||
|
|||
connection master; |
|||
DROP DATABASE mysqltest; |
|||
save_master_pos; |
|||
connection slave; |
|||
sync_with_master; |
|||
@ -0,0 +1,2 @@ |
|||
Variable_name Value |
|||
have_partitioning DISABLED |
|||
@ -0,0 +1,93 @@ |
|||
DROP TABLE IF EXISTS t1; |
|||
FLUSH TABLES; |
|||
SELECT * FROM t1; |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
TRUNCATE TABLE t1; |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
ANALYZE TABLE t1; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 analyze error Corrupt |
|||
CHECK TABLE t1; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 check error Corrupt |
|||
OPTIMIZE TABLE t1; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 optimize Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 optimize error Corrupt |
|||
REPAIR TABLE t1; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 repair Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 repair error Corrupt |
|||
ALTER TABLE t1 REPAIR PARTITION ALL; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 repair Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 repair error Corrupt |
|||
ALTER TABLE t1 CHECK PARTITION ALL; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 check Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 check error Corrupt |
|||
ALTER TABLE t1 OPTIMIZE PARTITION ALL; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 optimize Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 optimize error Corrupt |
|||
ALTER TABLE t1 ANALYZE PARTITION ALL; |
|||
Table Op Msg_type Msg_text |
|||
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
test.t1 analyze error Corrupt |
|||
ALTER TABLE t1 REBUILD PARTITION ALL; |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
ALTER TABLE t1 ENGINE Memory; |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
ALTER TABLE t1 ADD (new INT); |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
DROP TABLE t1; |
|||
CREATE TABLE t1 ( |
|||
firstname VARCHAR(25) NOT NULL, |
|||
lastname VARCHAR(25) NOT NULL, |
|||
username VARCHAR(16) NOT NULL, |
|||
email VARCHAR(35), |
|||
joined DATE NOT NULL |
|||
) |
|||
PARTITION BY KEY(joined) |
|||
PARTITIONS 6; |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2; |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
drop table t1; |
|||
ERROR 42S02: Unknown table 't1' |
|||
CREATE TABLE t1 ( |
|||
firstname VARCHAR(25) NOT NULL, |
|||
lastname VARCHAR(25) NOT NULL, |
|||
username VARCHAR(16) NOT NULL, |
|||
email VARCHAR(35), |
|||
joined DATE NOT NULL |
|||
) |
|||
PARTITION BY RANGE( YEAR(joined) ) ( |
|||
PARTITION p0 VALUES LESS THAN (1960), |
|||
PARTITION p1 VALUES LESS THAN (1970), |
|||
PARTITION p2 VALUES LESS THAN (1980), |
|||
PARTITION p3 VALUES LESS THAN (1990), |
|||
PARTITION p4 VALUES LESS THAN MAXVALUE |
|||
); |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
drop table t1; |
|||
ERROR 42S02: Unknown table 't1' |
|||
CREATE TABLE t1 (id INT, purchased DATE) |
|||
PARTITION BY RANGE( YEAR(purchased) ) |
|||
SUBPARTITION BY HASH( TO_DAYS(purchased) ) |
|||
SUBPARTITIONS 2 ( |
|||
PARTITION p0 VALUES LESS THAN (1990), |
|||
PARTITION p1 VALUES LESS THAN (2000), |
|||
PARTITION p2 VALUES LESS THAN MAXVALUE |
|||
); |
|||
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement |
|||
drop table t1; |
|||
ERROR 42S02: Unknown table 't1' |
|||
create table t1 (a varchar(10) charset latin1 collate latin1_bin); |
|||
insert into t1 values (''),(' '),('a'),('a '),('a '); |
|||
explain partitions select * from t1 where a='a ' OR a='a'; |
|||
id select_type table partitions type possible_keys key key_len ref rows Extra |
|||
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where |
|||
drop table t1; |
|||
@ -0,0 +1,3 @@ |
|||
一二三 |
|||
四五六 |
|||
七八九 |
|||
@ -0,0 +1,33 @@ |
|||
stop slave; |
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; |
|||
reset master; |
|||
reset slave; |
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; |
|||
start slave; |
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
CREATE DATABASE IF NOT EXISTS mysqltest; |
|||
USE mysqltest; |
|||
CREATE TABLE IF NOT EXISTS t(c1 int); |
|||
CREATE TABLE IF NOT EXISTS t1 LIKE t; |
|||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t; |
|||
CREATE EVENT IF NOT EXISTS e |
|||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR |
|||
DO SELECT now(); |
|||
DROP DATABASE mysqltest; |
|||
CREATE DATABASE IF NOT EXISTS mysqltest; |
|||
USE mysqltest; |
|||
CREATE TABLE IF NOT EXISTS t(c1 int); |
|||
CREATE TABLE IF NOT EXISTS t1 LIKE t; |
|||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t; |
|||
CREATE EVENT IF NOT EXISTS e |
|||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR |
|||
DO SELECT now(); |
|||
SHOW TABLES in mysqltest; |
|||
Tables_in_mysqltest |
|||
t |
|||
t1 |
|||
t2 |
|||
SHOW EVENTS in mysqltest; |
|||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation |
|||
mysqltest e @ SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci |
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
@ -0,0 +1,22 @@ |
|||
stop slave; |
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; |
|||
reset master; |
|||
reset slave; |
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; |
|||
start slave; |
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; |
|||
show binlog events from <binlog_start>; |
|||
Log_name Pos Event_type Server_id End_log_pos Info |
|||
master-bin.000001 # Query # # DROP DATABASE IF EXISTS mysqltest |
|||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int) |
|||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int) |
|||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp |
|||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp |
|||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp |
|||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp |
|||
@ -0,0 +1,70 @@ |
|||
# BUG#45574: |
|||
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists. |
|||
# |
|||
# There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and |
|||
# CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are |
|||
# binlogged even if either the DB, TABLE or EVENT does not exist. In |
|||
# contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT |
|||
# exists. |
|||
# |
|||
# This problem caused some of the tests to fail randomly on PB or PB2. |
|||
# |
|||
# Description: |
|||
# Fixed this bug by adding calls to write_bin_log in: |
|||
# mysql_create_db |
|||
# mysql_create_table_no_lock |
|||
# mysql_create_like_table |
|||
# create_table_from_items |
|||
# |
|||
# Test is implemented as follows: |
|||
# i) test each "CREATE IF NOT EXISTS" (DDL), found in MySQL 5.1 manual |
|||
# exclude CREATE TEMPORARY TABLE, on existent objects; |
|||
# |
|||
# Note: |
|||
# rpl_create_tmp_table_if_not_exists.test tests CREATE TEMPORARY TABLE cases. |
|||
# |
|||
# References: |
|||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html |
|||
# |
|||
|
|||
source include/master-slave.inc; |
|||
disable_warnings; |
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
|
|||
CREATE DATABASE IF NOT EXISTS mysqltest; |
|||
USE mysqltest; |
|||
CREATE TABLE IF NOT EXISTS t(c1 int); |
|||
CREATE TABLE IF NOT EXISTS t1 LIKE t; |
|||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t; |
|||
CREATE EVENT IF NOT EXISTS e |
|||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR |
|||
DO SELECT now(); |
|||
sync_slave_with_master; |
|||
|
|||
connection slave; |
|||
#DROP database from slave. |
|||
#The database and all tables can be recreated in slave |
|||
#if binlog of the second CREATE command is recorded and sent from master to slave. |
|||
DROP DATABASE mysqltest; |
|||
|
|||
connection master; |
|||
CREATE DATABASE IF NOT EXISTS mysqltest; |
|||
USE mysqltest; |
|||
CREATE TABLE IF NOT EXISTS t(c1 int); |
|||
CREATE TABLE IF NOT EXISTS t1 LIKE t; |
|||
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t; |
|||
CREATE EVENT IF NOT EXISTS e |
|||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR |
|||
DO SELECT now(); |
|||
sync_slave_with_master; |
|||
|
|||
connection slave; |
|||
SHOW TABLES in mysqltest; |
|||
#Execution time changes in each run. So we disregard it by calling replace_column. |
|||
replace_column 6 #; |
|||
SHOW EVENTS in mysqltest; |
|||
|
|||
|
|||
connection master; |
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
source include/master-slave-end.inc; |
|||
@ -0,0 +1,41 @@ |
|||
# BUG#45574: |
|||
# SP: CREATE DATABASE|TABLE IF NOT EXISTS not binlogged if routine exists. |
|||
# |
|||
# There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and |
|||
# CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are |
|||
# binlogged even if either the DB, TABLE or EVENT does not exist. In |
|||
# contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT |
|||
# exists. |
|||
# |
|||
# This problem caused some of the tests to fail randomly on PB or PB2. |
|||
# |
|||
# Test is implemented as follows: |
|||
# |
|||
# i) test each "CREATE TEMPORARY TABLE IF EXISTS" (DDL), found in MySQL |
|||
# 5.1 manual, on existent objects; |
|||
# ii) show binlog events; |
|||
# |
|||
# Note: |
|||
# rpl_create_if_not_exists.test tests other cases. |
|||
# |
|||
# References: |
|||
# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html |
|||
# |
|||
|
|||
source include/master-slave.inc; |
|||
#CREATE TEMPORARY TABLE statements are not binlogged in row mode, |
|||
#So it must be test by itself. |
|||
source include/have_binlog_format_mixed_or_statement.inc; |
|||
disable_warnings; |
|||
|
|||
DROP DATABASE IF EXISTS mysqltest; |
|||
|
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp(c1 int); |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp1 LIKE tmp; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; |
|||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp2 SELECT * FROM tmp; |
|||
source include/show_binlog_events.inc; |
|||
|
|||
source include/master-slave-end.inc; |
|||
@ -0,0 +1 @@ |
|||
--loose-skip-partition |
|||
@ -0,0 +1,85 @@ |
|||
--disable_abort_on_error |
|||
# Run this test only when mysqld has partitioning, but it is disabled. |
|||
# The statements are not expected to work, just check that we |
|||
# can't crash the server. |
|||
--require r/disabled_partition.require |
|||
--disable_query_log |
|||
show variables like "have_partitioning"; |
|||
--enable_query_log |
|||
--disable_warnings |
|||
DROP TABLE IF EXISTS t1; |
|||
--enable_warnings |
|||
let $MYSQLD_DATADIR= `SELECT @@datadir`; |
|||
|
|||
# |
|||
# Bug#39893: Crash if select on a partitioned table, |
|||
# when partitioning is disabled |
|||
FLUSH TABLES; |
|||
--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm |
|||
SELECT * FROM t1; |
|||
TRUNCATE TABLE t1; |
|||
ANALYZE TABLE t1; |
|||
CHECK TABLE t1; |
|||
OPTIMIZE TABLE t1; |
|||
REPAIR TABLE t1; |
|||
ALTER TABLE t1 REPAIR PARTITION ALL; |
|||
ALTER TABLE t1 CHECK PARTITION ALL; |
|||
ALTER TABLE t1 OPTIMIZE PARTITION ALL; |
|||
ALTER TABLE t1 ANALYZE PARTITION ALL; |
|||
ALTER TABLE t1 REBUILD PARTITION ALL; |
|||
ALTER TABLE t1 ENGINE Memory; |
|||
ALTER TABLE t1 ADD (new INT); |
|||
DROP TABLE t1; |
|||
|
|||
--error ER_OPTION_PREVENTS_STATEMENT |
|||
CREATE TABLE t1 ( |
|||
firstname VARCHAR(25) NOT NULL, |
|||
lastname VARCHAR(25) NOT NULL, |
|||
username VARCHAR(16) NOT NULL, |
|||
email VARCHAR(35), |
|||
joined DATE NOT NULL |
|||
) |
|||
PARTITION BY KEY(joined) |
|||
PARTITIONS 6; |
|||
|
|||
--error ER_OPTION_PREVENTS_STATEMENT |
|||
ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2; |
|||
|
|||
--error ER_BAD_TABLE_ERROR |
|||
drop table t1; |
|||
|
|||
--error ER_OPTION_PREVENTS_STATEMENT |
|||
CREATE TABLE t1 ( |
|||
firstname VARCHAR(25) NOT NULL, |
|||
lastname VARCHAR(25) NOT NULL, |
|||
username VARCHAR(16) NOT NULL, |
|||
email VARCHAR(35), |
|||
joined DATE NOT NULL |
|||
) |
|||
PARTITION BY RANGE( YEAR(joined) ) ( |
|||
PARTITION p0 VALUES LESS THAN (1960), |
|||
PARTITION p1 VALUES LESS THAN (1970), |
|||
PARTITION p2 VALUES LESS THAN (1980), |
|||
PARTITION p3 VALUES LESS THAN (1990), |
|||
PARTITION p4 VALUES LESS THAN MAXVALUE |
|||
); |
|||
--error ER_BAD_TABLE_ERROR |
|||
drop table t1; |
|||
|
|||
--error ER_OPTION_PREVENTS_STATEMENT |
|||
CREATE TABLE t1 (id INT, purchased DATE) |
|||
PARTITION BY RANGE( YEAR(purchased) ) |
|||
SUBPARTITION BY HASH( TO_DAYS(purchased) ) |
|||
SUBPARTITIONS 2 ( |
|||
PARTITION p0 VALUES LESS THAN (1990), |
|||
PARTITION p1 VALUES LESS THAN (2000), |
|||
PARTITION p2 VALUES LESS THAN MAXVALUE |
|||
); |
|||
--error ER_BAD_TABLE_ERROR |
|||
drop table t1; |
|||
|
|||
# Create a table without partitions to test "EXPLAIN PARTITIONS" |
|||
create table t1 (a varchar(10) charset latin1 collate latin1_bin); |
|||
insert into t1 values (''),(' '),('a'),('a '),('a '); |
|||
explain partitions select * from t1 where a='a ' OR a='a'; |
|||
drop table t1; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue