Commit 84197bd4 authored by lars@mysql.com's avatar lars@mysql.com

Merge lthalmann@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/users/lthalmann/bkroot/mysql-5.1-new
parents 6bbb1de9 a7666569
......@@ -343,7 +343,7 @@ MYSQL_PROG_AR
# libmysqlclient versioning when linked with GNU ld.
if $LD --version 2>/dev/null|grep -q GNU; then
LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver"
LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
AC_CONFIG_FILES(libmysql/libmysql.ver)
fi
AC_SUBST(LD_VERSION_SCRIPT)
......
......@@ -136,6 +136,7 @@ typedef struct st_heap_share
HP_KEYDEF *keydef;
ulong min_records,max_records; /* Params to open */
ulong data_length,index_length,max_table_size;
uint key_stat_version; /* version to indicate insert/delete */
uint records; /* records */
uint blength; /* records rounded up to 2^n */
uint deleted; /* Deleted records in database */
......
......@@ -5036,6 +5036,12 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
{
DBUG_ENTER("mysql_stmt_reset");
DBUG_ASSERT(stmt != 0);
if (!stmt->mysql)
{
/* mysql can be reset in mysql_close called from mysql_reconnect */
set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);
DBUG_RETURN(1);
}
/* Reset the client and server sides of the prepared statement */
DBUG_RETURN(reset_stmt_handle(stmt, RESET_SERVER_SIDE | RESET_LONG_DATA));
}
......
#
# Test forced timestamp
#
-- source include/master-slave.inc
# Don't log table creating to the slave as we want to test LOAD TABLE
set SQL_LOG_BIN=0,timestamp=200006;
create table t1(t timestamp not null,a char(1));
insert into t1 ( a) values ('F');
select unix_timestamp(t) from t1;
connection slave;
load table t1 from master;
select unix_timestamp(t) from t1;
# Delete the created table on master and slave
connection master;
set SQL_LOG_BIN=1,timestamp=default;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
connection master;
#
# Test copying table with checksum
#
# Don't log table creating to the slave as we want to test LOAD TABLE
set SQL_LOG_BIN=0;
eval CREATE TABLE t1 (
a int not null
) ENGINE=$engine_type MAX_ROWS=4000 CHECKSUM=1;
INSERT INTO t1 VALUES (1);
save_master_pos;
connection slave;
sync_with_master;
load table t1 from master;
check table t1;
drop table t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
###########################################################
# 2006-02-01: By JBM: Added 1022, ORDER BY
###########################################################
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
############################################################
# REQUIREMENT
# Auto increment should work for a table with an auto_increment
# column and index but without primary key.
##############################################################
# We also check how the foreign_key_check variable is replicated
......@@ -15,8 +24,8 @@ insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
#check if multi-line inserts,
#which set last_insert_id to the first id inserted,
......@@ -49,13 +58,13 @@ create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1;
select * from t2;
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
drop table t1;
drop table t2;
......@@ -71,7 +80,8 @@ connection master;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
--error 1062
# Duplicate Key Errors
--error 1022, 1062
INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master;
......
###########################################################
# 2006-02-08: By JBM:
###########################################################
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
############################################################
# REQUIREMENT
# Auto increment should work for a table with auto_increment column
# and primary key.
##############################################################
# We also check how the foreign_key_check variable is replicated
-- source include/master-slave.inc
#should work for both SBR and RBR
connection master;
create table t1(a int auto_increment, primary key(a));
create table t2(b int auto_increment, c int, primary key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
#check if multi-line inserts,
#which set last_insert_id to the first id inserted,
#are replicated the same way
drop table t1;
drop table t2;
--disable_warnings
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
--enable_warnings
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t2;
connection master;
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
drop table t2;
drop table t1;
create table t1(a int auto_increment, primary key(a));
create table t2(b int auto_increment, c int, primary key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
save_master_pos;
connection slave;
sync_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
drop table t1;
drop table t2;
save_master_pos;
connection slave;
sync_with_master;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS
#
connection master;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
# Duplicate Key Errors codes
--error 1022, 1062
INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master;
# End of 4.1 tests
......@@ -30,21 +30,25 @@ let $VERSION=`select version()`;
connection master;
reset master;
create table t1(n int not null auto_increment primary key);
eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null);
eval create table t1 (word char(20) not null)ENGINE=$engine_type;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
drop table t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events from 102 limit 1;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events from 102 limit 2;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events from 102 limit 2,1;
flush logs;
......@@ -64,7 +68,7 @@ flush logs;
# To make it predictable, we do a useless update now, but which has the
# interest of making the slave catch both rotate events.
create table t5 (a int);
eval create table t5 (a int)ENGINE=$engine_type;
drop table t5;
# Sync slave and force it to start on another binary log
......@@ -82,14 +86,16 @@ connection master;
# Create some entries for second log
create table t1 (n int);
eval create table t1 (n int)ENGINE=$engine_type;
insert into t1 values (1);
drop table t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events in 'master-bin.000002';
show binary logs;
save_master_pos;
......@@ -99,9 +105,11 @@ sync_with_master;
show binary logs;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events in 'slave-bin.000001' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\//
show binlog events in 'slave-bin.000002' from 4;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
......
......@@ -5,7 +5,7 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval LOAD DATA LOCAL INFILE '$MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 LIMIT 10;
SELECT * FROM t1 ORDER BY word LIMIT 10;
#
# Test slave with wrong password
......@@ -30,7 +30,7 @@ sleep 2;
CREATE TABLE t3(n INT);
INSERT INTO t3 VALUES(1),(2);
sync_slave_with_master;
SELECT * FROM t3;
SELECT * FROM t3 ORDER BY n;
SELECT SUM(LENGTH(word)) FROM t1;
connection master;
DROP TABLE t1,t3;
......
......@@ -20,12 +20,11 @@ DROP TABLE IF EXISTS test.t2;
--echo ***** Table Create Section ****
--echo
--disable_warnings
--replace_result $engine_type engine_type
CREATE TABLE test.t1 (c1 int not null auto_increment,
--replace_result $engine_type #
eval CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
--enable_warnings
--echo
--echo **** Data Insert Section test.t1 *****
--echo
INSERT INTO test.t1 VALUES (NULL, NULL);
......@@ -77,8 +76,8 @@ connection master;
--echo **** Create Table test.t2 ****
--echo
--disable_warnings
--replace_result $engine_type engine_type
CREATE TABLE test.t2 (
--replace_result $engine_type #
eval CREATE TABLE test.t2 (
c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
......
......@@ -3,6 +3,10 @@
# Change Date: 2006-01-17
# Change: Added order by in select
####################
# Change Date: 2006-02-02
# Change: renamed to make bettre sense,
# and wrapped per Engine test
############################
source include/master-slave.inc;
#
......@@ -10,7 +14,7 @@ source include/master-slave.inc;
#
SHOW VARIABLES LIKE 'relay_log_space_limit';
CREATE TABLE t1 (name varchar(64), age smallint(3));
eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type;
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
INSERT into t1 SET name='Caleb', age=1;
......
......@@ -202,7 +202,14 @@ SYST=0
REALT=0
FAST_START=""
MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
SLAVE_LOAD_TMPDIR=../../var/tmp #needs to be same length to test logging
# Use a relative path for where the slave will find the dumps
# generated by "LOAD DATA" on the master. The path is relative
# since it must have fixed length to test logging
# i.e otherwise the output from "SHOW MASTER STATUS" will vary
# with the strlen() of MYSQL_TEST_DIR
SLAVE_LOAD_TMPDIR=../tmp
RES_SPACE=" "
MYSQLD_SRC_DIRS="strings mysys include extra regex myisam \
myisammrg heap sql"
......@@ -651,8 +658,10 @@ fi
[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
ln -s $MYSQL_TEST_DIR/std_data $MYSQL_TEST_DIR/var/std_data_ln
if ! test -L $MYSQL_TEST_DIR/var/std_data_ln ; then
ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln
fi
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
E=`$EXPR $COLUMNS - 8`
DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E`
......
......@@ -12537,4 +12537,59 @@ SELECT c FROM t5 WHERE a IN (32, 23, 5);
c
NULL
posterity
drop table t1;
create table t1 (v varchar(32));
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1;
v
def
abc
hij
3r4f
alter table t1 change v v2 varchar(32);
select * from t1;
v2
def
abc
hij
3r4f
alter table t1 change v2 v varchar(64);
select * from t1;
v
def
abc
hij
3r4f
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
v
def
abc
lmn
3r4f
alter table t1 add i int auto_increment not null primary key first;
select * from t1;
i v
1 def
2 abc
3 lmn
4 3r4f
update t1 set i=5 where i=3;
select * from t1;
i v
1 def
2 abc
5 lmn
4 3r4f
alter table t1 change i i bigint;
select * from t1;
i v
1 def
2 abc
5 lmn
4 3r4f
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
i v
4 3r4f
drop table t1, t2, t4, t5;
......@@ -5017,3 +5017,58 @@ insert t1 values (1),(2),(3),(4),(5);
truncate table t1;
affected rows: 0
drop table t1;
create table t1 (v varchar(32));
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1;
v
def
abc
hij
3r4f
alter table t1 change v v2 varchar(32);
select * from t1;
v2
def
abc
hij
3r4f
alter table t1 change v2 v varchar(64);
select * from t1;
v
def
abc
hij
3r4f
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
v
def
abc
lmn
3r4f
alter table t1 add i int auto_increment not null primary key first;
select * from t1;
i v
1 def
2 abc
3 lmn
4 3r4f
update t1 set i=5 where i=3;
select * from t1;
i v
1 def
2 abc
5 lmn
4 3r4f
alter table t1 change i i bigint;
select * from t1;
i v
1 def
2 abc
5 lmn
4 3r4f
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
i v
4 3r4f
drop table t1;
......@@ -506,3 +506,12 @@ d1 d2
02 February
01 January
drop table t1;
select str_to_date( 1, NULL );
str_to_date( 1, NULL )
NULL
select str_to_date( NULL, 1 );
str_to_date( NULL, 1 )
NULL
select str_to_date( 1, IF(1=1,NULL,NULL) );
str_to_date( 1, IF(1=1,NULL,NULL) )
NULL
......@@ -1530,7 +1530,7 @@ CREATE TABLE federated.t1 (
PRIMARY KEY (`id`)
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:9308/federated/t1';
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
......
......@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 1 Using where
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
......@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 1 Using where
1 SIMPLE t1 ref a a 5 const 2 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
......@@ -701,6 +701,16 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert delayed into t1 values (0);
delete from t1;
select * from t1;
a
insert delayed into t1 values (0), (1);
select * from t1 where a = 0;
a
0
drop table t1;
create table t1 (c char(10)) engine=memory;
create table t2 (c varchar(10)) engine=memory;
show table status like 't_';
......
......@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
explain select * from t1 where btn="a" and new_col="a";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref btn btn 11 const,const 1 Using where
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
......@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 5 const 1 Using where
1 SIMPLE t1 ref a a 5 const 2 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
......@@ -220,16 +220,16 @@ insert into t1 values ('aaag', 'prefill-hash=3',0);
insert into t1 values ('aaah', 'prefill-hash=6',0);
explain select * from t1 where a='aaaa';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where
1 SIMPLE t1 ref a a 8 const 2 Using where
explain select * from t1 where a='aaab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where
1 SIMPLE t1 ref a a 8 const 2 Using where
explain select * from t1 where a='aaac';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where
1 SIMPLE t1 ref a a 8 const 2 Using where
explain select * from t1 where a='aaad';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 8 const 1 Using where
1 SIMPLE t1 ref a a 8 const 2 Using where
insert into t1 select * from t1;
flush tables;
explain select * from t1 where a='aaaa';
......@@ -291,25 +291,25 @@ insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
insert into t2 select * from t1;
explain select * from t1 where name='matt';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where
explain select * from t2 where name='matt';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where
explain select * from t1 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where
explain select * from t2 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where
explain select * from t1 where name='Phil';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where
explain select * from t2 where name='Phil';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where
explain select * from t1 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 22 const 1 Using where
1 SIMPLE t1 ref heap_idx,btree_idx btree_idx 22 const 1 Using where
explain select * from t2 where name='Lilu';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 22 const 1 Using where
......@@ -364,5 +364,5 @@ a
3
explain select a from t1 where a in (1,3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 2 Using where
1 SIMPLE t1 range a a 5 NULL 4 Using where
drop table t1;
drop table if exists t1;
drop table if exists t1, t2, t3;
create table t1 (kill_id int);
insert into t1 values(connection_id());
select ((@id := kill_id) - kill_id) from t1;
......@@ -15,6 +15,18 @@ select 4;
4
4
drop table t1;
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
insert into t2 select id from t1;
create table t3 (kill_id int);
insert into t3 values(connection_id());
select id from t1 where id in (select distinct id from t2);
select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id)
0
kill @id;
ERROR 08S01: Server shutdown in progress
drop table t1, t2, t3;
select get_lock("a", 10);
get_lock("a", 10)
1
......
......@@ -567,7 +567,7 @@ Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a NULL 1000 NULL NULL YES HASH
t1 1 a 1 a NULL 500 NULL NULL YES HASH
drop table t1,t2;
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
insert into t1 values (null,''), (null,'');
......
Table Op Msg_type Msg_text
test.t1 check status OK
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;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word));
load data infile '../std_data_ln/words.dat' into table t1;
create table t2 (word char(20) not null);
load data infile '../std_data_ln/words.dat' into table t2;
create table t3 (word char(20) not null primary key);
load table t1 from master;
load table t2 from master;
load table t3 from master;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select count(*) from t2;
count(*)
70
select count(*) from t3;
count(*)
0
set SQL_LOG_BIN=1;
drop table if exists t1,t2,t3;
create table t1(n int);
drop table t1;
......@@ -4,118 +4,114 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
DELETE FROM test.t1 WHERE a = 'abashed';
DELETE FROM test.t1;
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
SELECT * FROM test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
a
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
SELECT * FROM test.t1;
a
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
Abernathy
Aberdeen
Abelson
Abelian
Abel
abed
Abe
abducts
abductors
abductor
abductions
abduction
abducted
abduct
abdominal
abdomens
abdomen
Abby
abbreviations
abbreviation
abbreviating
abbreviates
abbreviated
abbreviate
Abbott
abbots
abbot
abbeys
abbey
abbe
Abba
abating
abates
abater
abatements
abatement
abated
abate
abasing
abashing
abashes
abashed
abash
abases
abasements
abasement
abased
abase
SELECT * FROM test.t1 ORDER BY a DESC;
a
aberration
DROP PROCEDURE IF EXISTS test.p1;
Warnings:
Note 1305 PROCEDURE p1 does not exist
aberrant
Abernathy
Aberdeen
Abelson
Abelian
Abel
abed
Abe
abducts
abductors
abductor
abductions
abduction
abducted
abduct
abdominal
abdomens
abdomen
Abby
abbreviations
abbreviation
abbreviating
abbreviates
abbreviated
abbreviate
Abbott
abbots
abbot
abbeys
abbey
abbe
Abba
abating
abates
abater
abatements
abatement
abated
abate
abasing
abashing
abashes
abashed
abash
abases
abasements
abasement
abased
abase
DROP TABLE test.t1;
......@@ -61,16 +61,14 @@ mysql
mysqltest_prometheus
mysqltest_sisyfos
test
SHOW CREATE TABLE mysqltest_prometheus.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE mysqltest_sisyfos.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
USE mysqltest_prometheus;
SHOW TABLES;
Tables_in_mysqltest_prometheus
t1
USE mysqltest_sisyfos;
SHOW TABLES;
Tables_in_mysqltest_sisyfos
t2
DROP DATABASE IF EXISTS mysqltest_prometheus;
DROP DATABASE IF EXISTS mysqltest_sisyfos;
DROP DATABASE IF EXISTS mysqltest_bob;
......@@ -5,8 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database if not exists mysqltest;
create temporary table mysqltest.t1 (n int);
create temporary table mysqltest.t2 (n int);
create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
show status like 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
......
......@@ -7,14 +7,14 @@ start slave;
create table t1 (a int primary key);
create table t4 (a int primary key);
insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
Got one of the listed errors
insert into t4 values (1),(2);
show tables like 't1';
Tables_in_test (t1)
show tables like 't4';
Tables_in_test (t4)
t4
SELECT * FROM test.t4;
SELECT * FROM test.t4 ORDER BY a;
a
1
2
......@@ -33,7 +33,7 @@ select (@id := id) - id from t3;
kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
SELECT * FROM test.t4;
SELECT * FROM test.t4 ORDER BY a;
a
1
2
......
......@@ -9,13 +9,13 @@ create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
select * from t1;
select * from t1 ORDER BY a;
a
1
2
3
4
select * from t2;
select * from t2 ORDER BY b;
b c
1 4
drop table t1;
......@@ -45,21 +45,21 @@ create table t2(b int auto_increment, c int, key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1;
select * from t2;
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
b c
5 0
6 10
7 11
8 12
9 13
select * from t1;
select * from t1 ORDER BY a;
a
10
11
12
13
select * from t2;
select * from t2 ORDER BY b;
b c
5 0
6 10
......@@ -72,4 +72,4 @@ SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
Got one of the listed errors
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;
create table t1(a int auto_increment, primary key(a));
create table t2(b int auto_increment, c int, primary key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
select * from t1 ORDER BY a;
a
1
2
3
4
select * from t2 ORDER BY b;
b c
1 4
drop table t1;
drop table t2;
create table t1(a int auto_increment, key(a)) engine=innodb;
create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=innodb;
SET FOREIGN_KEY_CHECKS=0;
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
select * from t1;
a
10
11
12
13
select * from t2;
b c
5 0
6 11
drop table t2;
drop table t1;
create table t1(a int auto_increment, primary key(a));
create table t2(b int auto_increment, c int, primary key(b));
insert into t1 values (10);
insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
b c
5 0
6 10
7 11
8 12
9 13
select * from t1 ORDER BY a;
a
10
11
12
13
select * from t2 ORDER BY b;
b c
5 0
6 10
7 11
8 12
9 13
drop table t1;
drop table t2;
SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1);
Got one of the listed errors
......@@ -13,11 +13,11 @@ drop database if exists mysqltest3;
create database mysqltest2;
create database mysqltest;
create database mysqltest2;
create table mysqltest2.foo (n int);
create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(4);
create table mysqltest2.foo (n int);
create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(5);
create table mysqltest.bar (m int);
create table mysqltest.bar (m int)ENGINE=MyISAM;
insert into mysqltest.bar values(15);
select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
n m
......@@ -38,12 +38,12 @@ mysql
mysqltest
mysqltest2
test
create table mysqltest2.t1(n int, s char(20));
create table mysqltest2.t2(n int, s text);
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
create table mysqltest.t1(n int, s char(20));
create table mysqltest.t2(n int, s text);
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
(13, 'thirteen test');
......@@ -55,17 +55,17 @@ cluster_replication
mysql
test
create database mysqltest2;
create table mysqltest2.t1(n int, s char(20));
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'original foo.t1');
create table mysqltest2.t3(n int, s char(20));
create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t3 values (1, 'original foo.t3');
create database mysqltest3;
create table mysqltest3.t1(n int, s char(20));
create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest3.t1 values (1, 'original foo2.t1');
create database mysqltest;
create table mysqltest.t1(n int, s char(20));
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'original bar.t1');
create table mysqltest.t3(n int, s char(20));
create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
show databases;
......
......@@ -4,9 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set SQL_LOG_BIN=0,timestamp=200006;
create table t1(t timestamp not null,a char(1));
insert into t1 ( a) values ('F');
"******************** Test Requirment 1 *************"
SET SQL_LOG_BIN=0,timestamp=200006;
CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
INSERT INTO t1 ( a) VALUE ('F');
select unix_timestamp(t) from t1;
unix_timestamp(t)
200006
......@@ -17,9 +18,8 @@ unix_timestamp(t)
set SQL_LOG_BIN=1,timestamp=default;
drop table t1;
set SQL_LOG_BIN=0;
CREATE TABLE t1 (
a int not null
) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
"******************** Test Requirment 2 *************"
CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
INSERT INTO t1 VALUES (1);
load table t1 from master;
check table t1;
......@@ -27,3 +27,25 @@ Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
drop table t1;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
load data infile '../../std_data/words.dat' into table t1;
create table t2 (word char(20) not null)ENGINE=MyISAM;
load data infile '../../std_data/words.dat' into table t2;
create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
load table t1 from master;
load table t2 from master;
load table t3 from master;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select count(*) from t2;
count(*)
70
select count(*) from t3;
count(*)
0
set SQL_LOG_BIN=1;
drop table if exists t1,t2,t3;
create table t1(n int);
drop table t1;
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;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
select * from t1;
a b
12 1
22 2
32 3
select * from t1;
a b
12 1
22 2
32 3
drop table t1;
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam;
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
delete from t1 where b=4;
insert into t1 values (NULL,5),(NULL,6);
select * from t1;
a b
1 1
2 2
3 3
22 5
32 6
select * from t1;
a b
1 1
2 2
3 3
22 5
32 6
drop table t1;
set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10;
show variables like "%auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
select * from t1;
a
5
10
110
250
310
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
select * from t1;
a
5
10
110
250
310
400
410
1000
select * from t1;
a
5
10
110
250
310
400
410
1000
drop table t1;
create table t1 (a int not null auto_increment, primary key (a)) engine=innodb;
insert into t1 values (NULL),(5),(NULL);
insert into t1 values (250),(NULL);
select * from t1;
a
5
10
110
250
310
insert into t1 values (1000);
set @@insert_id=400;
insert into t1 values(NULL),(NULL);
select * from t1;
a
5
10
110
250
310
400
410
1000
select * from t1;
a
5
10
110
250
310
400
410
1000
drop table t1;
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert into t1 values (NULL),(5),(NULL),(NULL);
insert into t1 values (500),(NULL),(502),(NULL),(NULL);
select * from t1;
a
1
5
6
7
500
501
502
503
504
set @@insert_id=600;
insert into t1 values(600),(NULL),(NULL);
ERROR 23000: Duplicate entry '600' for key 1
set @@insert_id=600;
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
select * from t1;
a
1
5
6
7
500
501
502
503
504
600
610
611
select * from t1;
a
1
5
6
7
500
501
502
503
504
600
610
611
drop table t1;
set @@session.auto_increment_increment=10, @@session.auto_increment_offset=1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert into t1 values(2),(12),(22),(32),(42);
insert into t1 values (NULL),(NULL);
insert into t1 values (3),(NULL),(NULL);
select * from t1;
a
1
3
11
21
31
select * from t1;
a
1
2
3
11
12
21
22
31
32
42
drop table t1;
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 FUNCTION IF EXISTS test.f1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB;
create function test.f1() RETURNS CHAR(16)
BEGIN
DECLARE tmp CHAR(16);
DECLARE var_name FLOAT;
SET var_name = RAND();
IF var_name > .6
THEN SET tmp = 'Texas';
ELSE SET tmp = 'MySQL';
END IF;
RETURN tmp;
END|
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
SET AUTOCOMMIT=0;
START TRANSACTION;
INSERT INTO test.t1 VALUES (null,test.f1());
ROLLBACK;
SET AUTOCOMMIT=1;
DROP FUNCTION test.f1;
DROP TABLE test.t1;
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;
stop slave;
reset master;
reset slave;
reset master;
create table t1(n int not null auto_increment primary key)ENGINE=NDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=NDB;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
show binlog events from 102 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN
show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
flush logs;
create table t5 (a int)ENGINE=NDB;
drop table t5;
start slave;
flush logs;
stop slave;
create table t1 (n int)ENGINE=NDB;
insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB
master-bin.000002 # Query 1 # BEGIN
master-bin.000002 # Table_map 1 # cluster_replication.apply_status
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Query 1 # COMMIT
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=NDB
master-bin.000002 # Query 1 # BEGIN
master-bin.000002 # Table_map 1 # cluster_replication.apply_status
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Table_map 1 # test.t1
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Query 1 # COMMIT
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1798
master-bin.000002 991
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 2205
slave-bin.000002 583
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Table_map 2 # test.t1
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Table_map 2 # test.t1
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Query 2 # COMMIT
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=NDB
slave-bin.000002 # Query 2 # BEGIN
slave-bin.000002 # Table_map 2 # cluster_replication.apply_status
slave-bin.000002 # Write_rows 2 #
slave-bin.000002 # Table_map 2 # test.t1
slave-bin.000002 # Write_rows 2 #
slave-bin.000002 # Query 2 # COMMIT
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 991 # # master-bin.000002 Yes Yes # 0 0 991 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
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;
SHOW VARIABLES LIKE 'relay_log_space_limit';
Variable_name Value
relay_log_space_limit 0
CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=NDB;
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
INSERT into t1 SET name='Caleb', age=1;
ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
SELECT * FROM t1 ORDER BY id;
name age id
Andy 31 00000001
Caleb 1 00000002
Jacob 2 00000003
SELECT * FROM t1 ORDER BY id;
name age id
Andy 31 00000001
Caleb 1 00000002
Jacob 2 00000003
drop table t1;
......@@ -12,26 +12,26 @@ Server_id Host Port Rpl_recovery_rank Master_id
create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
insert into t1 values(5);
select * from t1;
SELECT * FROM t1 ORDER BY n;
n
1
2
3
4
5
select * from t1;
SELECT * FROM t1 ORDER BY n;
n
1
2
3
4
select * from t1;
SELECT * FROM t1 ORDER BY n;
n
1
2
3
4
select * from t1;
SELECT * FROM t1 ORDER BY n;
n
1
2
......
......@@ -7,7 +7,7 @@ start slave;
SHOW VARIABLES LIKE 'relay_log_space_limit';
Variable_name Value
relay_log_space_limit 0
CREATE TABLE t1 (name varchar(64), age smallint(3));
CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=InnoDB;
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
INSERT into t1 SET name='Caleb', age=1;
......
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;
SHOW VARIABLES LIKE 'relay_log_space_limit';
Variable_name Value
relay_log_space_limit 0
CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM;
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
INSERT into t1 SET name='Caleb', age=1;
ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
SELECT * FROM t1 ORDER BY id;
name age id
Andy 31 00000001
Jacob 2 00000002
Caleb 1 00000003
SELECT * FROM t1 ORDER BY id;
name age id
Andy 31 00000001
Jacob 2 00000002
Caleb 1 00000003
drop table t1;
......@@ -16,7 +16,7 @@ insert into t1 values(15),(16),(17);
update t1 set m=20 where m=16;
delete from t1 where m=17;
create table t11 select * from t1;
select * from t1;
select * from t1 ORDER BY m;
m
15
20
......
......@@ -7,25 +7,25 @@ start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 LIMIT 10;
SELECT * FROM t1 ORDER BY word LIMIT 10;
word
Aarhus
Aarhus
Aarhus
Aarhus
Aaron
Aaron
Aaron
Aaron
Ababa
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
STOP SLAVE;
SET PASSWORD FOR root@"localhost" = PASSWORD('foo');
START SLAVE;
SET PASSWORD FOR root@"localhost" = PASSWORD('');
CREATE TABLE t3(n INT);
INSERT INTO t3 VALUES(1),(2);
SELECT * FROM t3;
SELECT * FROM t3 ORDER BY n;
n
1
2
......
......@@ -9,7 +9,7 @@ DROP TABLE IF EXISTS test.t2;
***** Table Create Section ****
CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
**** Data Insert Section test.t1 *****
......@@ -76,7 +76,7 @@ c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
c4 LONGBLOB,
KEY(c3))ENGINE=$engine_type;
KEY(c3))ENGINE=#;
*** Setup Values For test.t2 ***
set @x0 = '01234567012345670123456701234567';
......
......@@ -9,7 +9,7 @@ DROP TABLE IF EXISTS test.t2;
***** Table Create Section ****
CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
**** Data Insert Section test.t1 *****
......@@ -76,7 +76,7 @@ c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
c4 LONGBLOB,
KEY(c3))ENGINE=$engine_type;
KEY(c3))ENGINE=#;
*** Setup Values For test.t2 ***
set @x0 = '01234567012345670123456701234567';
......
......@@ -8,10 +8,10 @@ stop slave;
reset master;
reset slave;
reset master;
create table t1(n int not null auto_increment primary key);
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null);
create table t1 (word char(20) not null)ENGINE=MyISAM;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
......@@ -20,41 +20,41 @@ drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
show binlog events from 102 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Write_rows 1 #
flush logs;
create table t5 (a int);
create table t5 (a int)ENGINE=MyISAM;
drop table t5;
start slave;
flush logs;
stop slave;
create table t1 (n int);
create table t1 (n int)ENGINE=MyISAM;
insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Query 1 # use `test`; drop table t1
......@@ -62,44 +62,44 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
master-bin.000002 # Table_map 1 # test.t1
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1306
master-bin.000002 499
master-bin.000001 1332
master-bin.000002 525
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1467
slave-bin.000002 337
slave-bin.000001 1506
slave-bin.000002 350
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
slave-bin.000001 # Table_map 1 # test.t1
slave-bin.000001 # Write_rows 1 #
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Table_map 1 # test.t1
slave-bin.000001 # Write_rows 1 #
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
slave-bin.000002 # Table_map 1 # test.t1
slave-bin.000002 # Write_rows 1 #
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 499 # # master-bin.000002 Yes Yes # 0 0 499 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 525 # # master-bin.000002 Yes Yes # 0 0 525 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
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;
stop slave;
reset master;
reset slave;
reset master;
create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=InnoDB;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* XID */
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* XID */
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
show binlog events from 102 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
master-bin.000001 # Table_map 1 # test.t1
show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Write_rows 1 #
flush logs;
create table t5 (a int)ENGINE=InnoDB;
drop table t5;
start slave;
flush logs;
stop slave;
create table t1 (n int)ENGINE=InnoDB;
insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* XID */
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Xid 1 # COMMIT /* XID */
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB
master-bin.000002 # Table_map 1 # test.t1
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Xid 1 # COMMIT /* XID */
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1386
master-bin.000002 552
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1560
slave-bin.000002 377
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB
slave-bin.000001 # Table_map 1 # test.t1
slave-bin.000001 # Write_rows 1 #
slave-bin.000001 # Xid 1 # COMMIT /* XID */
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
slave-bin.000001 # Table_map 1 # test.t1
slave-bin.000001 # Write_rows 1 #
slave-bin.000001 # Xid 1 # COMMIT /* XID */
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=InnoDB
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=InnoDB
slave-bin.000002 # Table_map 1 # test.t1
slave-bin.000002 # Write_rows 1 #
slave-bin.000002 # Xid 1 # COMMIT /* XID */
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 552 # # master-bin.000002 Yes Yes # 0 0 552 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
......@@ -28,52 +28,52 @@ UPDATE test.t2 set t ='NONE';
END CASE;
end//
INSERT INTO test.t2 VALUES(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW'),(NULL,'NEW');
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 NEW
2 NEW
3 NEW
4 NEW
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 NEW
2 NEW
3 NEW
4 NEW
call test.p2(1);
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 Tex
2 Tex
3 Tex
4 Tex
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 Tex
2 Tex
3 Tex
4 Tex
call test.p2(2);
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 SQL
2 SQL
3 SQL
4 SQL
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 SQL
2 SQL
3 SQL
4 SQL
call test.p2(3);
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 NONE
2 NONE
3 NONE
4 NONE
select * from test.t2;
SELECT * FROM t2 ORDER BY a;
a t
1 NONE
2 NONE
......
......@@ -17,8 +17,8 @@ BEGIN
DECLARE done INT DEFAULT 0;
DECLARE spa CHAR(16);
DECLARE spb,spc INT;
DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1;
DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2;
DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1 ORDER BY id;
DECLARE cur2 CURSOR FOR SELECT id2 FROM test.t2 ORDER BY id2;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
OPEN cur2;
......@@ -46,13 +46,13 @@ END|
< ---- Master selects-- >
-------------------------
CALL test.p2();
SELECT * FROM test.t1;
SELECT * FROM test.t1 ORDER BY id;
id data
8 MySQL
20 ROCKS
11 Texas
10 kyle
SELECT * FROM test.t2;
11 Texas
20 ROCKS
SELECT * FROM test.t2 ORDER BY id2;
id2
1
2
......@@ -61,13 +61,13 @@ id2
< ---- Slave selects-- >
------------------------
SELECT * FROM test.t1;
SELECT * FROM test.t1 ORDER BY id;
id data
8 MySQL
20 ROCKS
11 Texas
10 kyle
SELECT * FROM test.t2;
11 Texas
20 ROCKS
SELECT * FROM test.t2 ORDER BY id2;
id2
1
2
......@@ -77,21 +77,21 @@ id2
< ---- Master selects-- >
-------------------------
CALL test.p1();
SELECT * FROM test.t3;
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
2 ROCKS
2 kyle
3 Texas
4 kyle
4 ROCKS
< ---- Slave selects-- >
------------------------
SELECT * FROM test.t3;
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
2 ROCKS
2 kyle
3 Texas
4 kyle
4 ROCKS
ALTER PROCEDURE test.p1 MODIFIES SQL DATA;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
......
......@@ -49,28 +49,28 @@ END;
END IF;
END|
CALL test.p1('a');
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
1
3
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
1
3
truncate test.t2;
call test.p1('b');
select * from test.t2;
select * from test.t2 ORDER BY a;
a
2
4
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
2
4
truncate test.t2;
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
SELECT * FROM test.t2;
SELECT * FROM test.t2 ORDER BY a;
a
DROP PROCEDURE test.p1;
DROP TABLE test.t1;
......
......@@ -13,14 +13,14 @@ CREATE TABLE test.t3 (value CHAR(30),domain_id INT, mailaccount_id INT, program
CREATE TABLE test.t1 (id INT,domain CHAR(30),PRIMARY KEY(id));
CREATE TRIGGER test.t2_ai AFTER INSERT ON test.t2 FOR EACH ROW UPDATE test.t3 ms, test.t1 d SET ms.value='No' WHERE ms.domain_id = (SELECT max(id) FROM test.t1 WHERE domain='example.com') AND ms.mailaccount_id IS NULL AND ms.program='spamfilter' AND ms.keey='scan_incoming'|
INSERT INTO test.t1 VALUES (1, 'example.com'),(2, 'mysql.com'),(3, 'earthmotherwear.com'), (4, 'yahoo.com'),(5, 'example.com');
select * from test.t1;
SELECT * FROM test.t1 ORDER BY id;
id domain
1 example.com
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
select * from test.t1;
SELECT * FROM test.t1 ORDER BY id;
id domain
1 example.com
2 mysql.com
......@@ -45,13 +45,19 @@ value domain_id mailaccount_id program keey
No 5 NULL spamfilter scan_incoming
Yes 1 NULL spamfilter scan_incoming
DELETE FROM test.t1 WHERE id = 1;
select * from test.t1;
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
select * from test.t1;
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
4 yahoo.com
5 example.com
SELECT * FROM test.t1 ORDER BY id;
id domain
2 mysql.com
3 earthmotherwear.com
......
......@@ -21,15 +21,15 @@ CREATE TABLE mysqltest1.t5 (qty INT, price INT, total INT, PRIMARY KEY(qty));
INSERT INTO mysqltest1.t1 VALUES (1,'Thank'),(2,'it'),(3,'Friday');
INSERT INTO mysqltest1.t2 VALUES (1,'GOD'),(2,'is'),(3,'TGIF');
INSERT INTO mysqltest1.t4 VALUES(1, 3, 50),(2, 18, 3),(4, 4, 4);
CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4;
CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a;
CREATE VIEW mysqltest1.v2 AS SELECT qty, price, qty*price AS value FROM mysqltest1.t4 ORDER BY qty;
CREATE VIEW mysqltest1.v1 AS SELECT t1.a, t1.c, t2.c as c2 FROM mysqltest1.t1 as t1, mysqltest1.t2 AS t2 WHERE mysqltest1.t1.a = mysqltest1.t2.a ORDER BY a;
CREATE VIEW mysqltest1.v3 AS SELECT * FROM mysqltest1.t1;
CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL CHECK OPTION;
SELECT * FROM mysqltest1.v2;
qty price value
3 50 150
18 3 54
4 4 16
18 3 54
SELECT * FROM mysqltest1.v1;
a c c2
1 Thank GOD
......@@ -38,8 +38,8 @@ a c c2
SELECT * FROM mysqltest1.v2;
qty price value
3 50 150
18 3 54
4 4 16
18 3 54
SELECT * FROM mysqltest1.v1;
a c c2
1 Thank GOD
......@@ -47,45 +47,45 @@ a c c2
3 Friday TGIF
INSERT INTO mysqltest1.t5 SELECT * FROM mysqltest1.v2;
INSERT INTO mysqltest1.t3 SELECT * FROM mysqltest1.v1;
SELECT * FROM mysqltest1.t5;
SELECT * FROM mysqltest1.t5 ORDER BY qty;
qty price total
3 50 150
18 3 54
4 4 16
SELECT * FROM mysqltest1.t3;
18 3 54
SELECT * FROM mysqltest1.t3 ORDER BY a;
a c c2
1 Thank GOD
2 it is
3 Friday TGIF
SELECT * FROM mysqltest1.t5;
SELECT * FROM mysqltest1.t5 ORDER BY qty;
qty price total
3 50 150
18 3 54
4 4 16
SELECT * FROM mysqltest1.t3;
18 3 54
SELECT * FROM mysqltest1.t3 ORDER BY a;
a c c2
1 Thank GOD
2 it is
3 Friday TGIF
INSERT INTO mysqltest1.v4 VALUES (4,'TEST');
SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a c
1 Thank
2 it
3 Friday
4 TEST
SELECT * FROM mysqltest1.v4;
SELECT * FROM mysqltest1.v4 ORDER BY a;
a c
2 it
3 Friday
4 TEST
SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.t1 ORDER BY a;
a c
1 Thank
2 it
3 Friday
4 TEST
SELECT * FROM mysqltest1.v4;
SELECT * FROM mysqltest1.v4 ORDER BY a;
a c
2 it
3 Friday
......
......@@ -8,7 +8,7 @@ create table t1 (n int not null primary key);
insert into t1 values (1);
insert into t1 values (1);
insert into t1 values (2),(3);
select * from t1;
select * from t1 ORDER BY n;
n
1
2
......
......@@ -15,7 +15,7 @@ insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
select * from t1;
select * from t1 ORDER BY n;
n
10
11
......
......@@ -8,10 +8,10 @@ stop slave;
reset master;
reset slave;
reset master;
create table t1(n int not null auto_increment primary key);
create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null);
create table t1 (word char(20) not null)ENGINE=MyISAM;
load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
......@@ -20,41 +20,41 @@ drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 # Query 1 # use `test`; drop table t1
show binlog events from 102 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
show binlog events from 102 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Intvar 1 # INSERT_ID=1
show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
flush logs;
create table t5 (a int);
create table t5 (a int)ENGINE=MyISAM;
drop table t5;
start slave;
flush logs;
stop slave;
create table t1 (n int);
create table t1 (n int)ENGINE=MyISAM;
insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 # Query 1 # use `test`; drop table t1
......@@ -62,42 +62,42 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)
master-bin.000002 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; drop table t5
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)
master-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
master-bin.000002 # Query 1 # use `test`; insert into t1 values (1)
master-bin.000002 # Query 1 # use `test`; drop table t1
show binary logs;
Log_name File_size
master-bin.000001 1393
master-bin.000002 514
master-bin.000001 1419
master-bin.000002 540
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1556
slave-bin.000002 352
slave-bin.000001 1595
slave-bin.000002 365
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
slave-bin.000001 # Intvar 1 # INSERT_ID=1
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)
slave-bin.000001 # Query 1 # use `test`; create table t5 (a int)ENGINE=MyISAM
slave-bin.000001 # Query 1 # use `test`; drop table t5
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)
slave-bin.000002 # Query 1 # use `test`; create table t1 (n int)ENGINE=MyISAM
slave-bin.000002 # Query 1 # use `test`; insert into t1 values (1)
slave-bin.000002 # Query 1 # use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 514 # # master-bin.000002 Yes Yes # 0 0 514 # None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 540 # # master-bin.000002 Yes Yes # 0 0 540 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
......@@ -32,7 +32,7 @@ insert into t3 select * from t1 where f>=4;
drop temporary table t3;
insert into t2 select count(*) from t3;
drop temporary table t3;
select * from t2;
select * from t2 ORDER BY f;
f
5
7
......@@ -68,7 +68,7 @@ insert into t2 select count(*) from t3;
SET TIMESTAMP=1040324224;
SET @@session.pseudo_thread_id=2;
drop temporary table t3;
select * from t2;
select * from t2 ORDER BY f;
f
5
7
......
drop procedure if exists empty;
drop procedure if exists code_sample;
create procedure empty()
begin
end;
......@@ -60,3 +62,140 @@ Pos Instruction
20 cpop 1
21 stmt 0 "select t.name, t.idx from t2 t order ..."
drop procedure code_sample;
drop procedure if exists sudoku_solve;
create procedure sudoku_solve(p_naive boolean, p_all boolean)
deterministic
modifies sql data
begin
drop temporary table if exists sudoku_work, sudoku_schedule;
create temporary table sudoku_work
(
row smallint not null,
col smallint not null,
dig smallint not null,
cnt smallint,
key using btree (cnt),
key using btree (row),
key using btree (col),
unique key using hash (row,col)
);
create temporary table sudoku_schedule
(
idx int not null auto_increment primary key,
row smallint not null,
col smallint not null
);
call sudoku_init();
if p_naive then
update sudoku_work set cnt = 0 where dig = 0;
else
call sudoku_count();
end if;
insert into sudoku_schedule (row,col)
select row,col from sudoku_work where cnt is not null order by cnt desc;
begin
declare v_scounter bigint default 0;
declare v_i smallint default 1;
declare v_dig smallint;
declare v_schedmax smallint;
select count(*) into v_schedmax from sudoku_schedule;
more:
loop
begin
declare v_tcounter bigint default 0;
sched:
while v_i <= v_schedmax do
begin
declare v_row, v_col smallint;
select row,col into v_row,v_col from sudoku_schedule where v_i = idx;
select dig into v_dig from sudoku_work
where v_row = row and v_col = col;
case v_dig
when 0 then
set v_dig = 1;
update sudoku_work set dig = 1
where v_row = row and v_col = col;
when 9 then
if v_i > 0 then
update sudoku_work set dig = 0
where v_row = row and v_col = col;
set v_i = v_i - 1;
iterate sched;
else
select v_scounter as 'Solutions';
leave more;
end if;
else
set v_dig = v_dig + 1;
update sudoku_work set dig = v_dig
where v_row = row and v_col = col;
end case;
set v_tcounter = v_tcounter + 1;
if not sudoku_digit_ok(v_row, v_col, v_dig) then
iterate sched;
end if;
set v_i = v_i + 1;
end;
end while sched;
select dig from sudoku_work;
select v_tcounter as 'Tests';
set v_scounter = v_scounter + 1;
if p_all and v_i > 0 then
set v_i = v_i - 1;
else
leave more;
end if;
end;
end loop more;
end;
drop temporary table sudoku_work, sudoku_schedule;
end//
show procedure code sudoku_solve;
Pos Instruction
0 stmt 9 "drop temporary table if exists sudoku..."
1 stmt 1 "create temporary table sudoku_work ( ..."
2 stmt 1 "create temporary table sudoku_schedul..."
3 stmt 94 "call sudoku_init("
4 jump_if_not 7(8) p_naive@0
5 stmt 4 "update sudoku_work set cnt = 0 where ..."
6 jump 8
7 stmt 94 "call sudoku_count("
8 stmt 6 "insert into sudoku_schedule (row,col)..."
9 set v_scounter@2 0
10 set v_i@3 1
11 set v_dig@4 NULL
12 set v_schedmax@5 NULL
13 stmt 0 "select count(*) into v_schedmax from ..."
14 set v_tcounter@6 0
15 jump_if_not 39(39) (v_i@3 <= v_schedmax@5)
16 set v_row@7 NULL
17 set v_col@8 NULL
18 stmt 0 "select row,col into v_row,v_col from ..."
19 stmt 0 "select dig into v_dig from sudoku_wor..."
20 set_case_expr 0 v_dig@4
21 jump_if_not 25(34) (case_expr@0 = 0)
22 set v_dig@4 1
23 stmt 4 "update sudoku_work set dig = 1 where ..."
24 jump 34
25 jump_if_not 32(34) (case_expr@0 = 9)
26 jump_if_not 30(34) (v_i@3 > 0)
27 stmt 4 "update sudoku_work set dig = 0 where ..."
28 set v_i@3 (v_i@3 - 1)
29 jump 15
30 stmt 0 "select v_scounter as 'Solutions'"
31 jump 45
32 set v_dig@4 (v_dig@4 + 1)
33 stmt 4 "update sudoku_work set dig = v_dig wh..."
34 set v_tcounter@6 (v_tcounter@6 + 1)
35 jump_if_not 37(37) not(`test`.`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4))
36 jump 15
37 set v_i@3 (v_i@3 + 1)
38 jump 15
39 stmt 0 "select dig from sudoku_work"
40 stmt 0 "select v_tcounter as 'Tests'"
41 set v_scounter@2 (v_scounter@2 + 1)
42 jump_if_not 45(14) (p_all@1 and (v_i@3 > 0))
43 set v_i@3 (v_i@3 - 1)
44 jump 14
45 stmt 9 "drop temporary table sudoku_work, sud..."
drop procedure sudoku_solve;
......@@ -1134,3 +1134,32 @@ show procedure status;
Db Name Type Definer Modified Created Security_type Comment
test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
drop procedure ` bug15658`;
drop function if exists bug14270;
drop table if exists t1;
create table t1 (s1 int primary key);
create function bug14270() returns int
begin
load index into cache t1;
return 1;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug14270() returns int
begin
cache index t1 key (`primary`) in keycache1;
return 1;
end|
ERROR 0A000: Not allowed to return a result set from a function
drop table t1;
drop procedure if exists bug15091;
create procedure bug15091()
begin
declare selectstr varchar(6000) default ' ';
declare conditionstr varchar(5000) default '';
set selectstr = concat(selectstr,
' and ',
c.operatorid,
'in (',conditionstr, ')');
end|
call bug15091();
ERROR 42S02: Unknown table 'c' in field list
drop procedure bug15091;
......@@ -291,3 +291,26 @@ drop user user1_bug14834@localhost;
drop user user2_bug14834@localhost;
drop user user3_bug14834@localhost;
drop database db_bug14834;
create database db_bug14533;
use db_bug14533;
create table t1 (id int);
create user user_bug14533@localhost identified by '';
create procedure bug14533_1()
sql security definer
desc db_bug14533.t1;
create procedure bug14533_2()
sql security definer
select * from db_bug14533.t1;
grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost;
grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost;
call db_bug14533.bug14533_1();
Field Type Null Key Default Extra
id int(11) YES NULL
call db_bug14533.bug14533_2();
id
desc db_bug14533.t1;
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
select * from db_bug14533.t1;
ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1'
drop user user_bug14533@localhost;
drop database db_bug14533;
......@@ -4425,4 +4425,23 @@ drop procedure if exists bug15231_1|
drop procedure if exists bug15231_2|
drop procedure if exists bug15231_3|
drop procedure if exists bug15231_4|
drop procedure if exists bug15011|
create table t3 (c1 int primary key)|
insert into t3 values (1)|
create procedure bug15011()
deterministic
begin
declare continue handler for 1062
select 'Outer' as 'Handler';
begin
declare continue handler for 1062
select 'Inner' as 'Handler';
insert into t3 values (1);
end;
end|
call bug15011()|
Handler
Inner
drop procedure bug15011|
drop table t3|
drop table t1,t2;
......@@ -785,3 +785,8 @@ create trigger test.t1_bi before insert on t1 for each row set @a:=0;
ERROR 3D000: No database selected
drop trigger t1_bi;
ERROR 3D000: No database selected
create table t1 (i int);
create trigger t1_bi before insert on t1 for each row return 0;
ERROR 42000: RETURN is only allowed in a FUNCTION
insert into t1 values (1);
drop table t1;
......@@ -358,3 +358,22 @@ update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
affected rows: 3
info: Rows matched: 3 Changed: 3 Warnings: 0
drop table t1,t2;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
flush status;
update t2 set a=3 where a=2;
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_next 1
Handler_read_prev 0
Handler_read_rnd 1
Handler_read_rnd_next 0
drop table t1, t2;
create table t1(f1 int, `*f2` int);
insert into t1 values (1,1);
update t1 set `*f2`=1;
drop table t1;
......@@ -1456,6 +1456,34 @@ SELECT c FROM t5;
SELECT c FROM t5 WHERE a =3;
SELECT c FROM t5 WHERE a IN (32, 23, 5);
# Adding this in case someone tries to add fast alter table and doesn't tes
# it.
# Some additional tests for new, faster alter table. Note that most of the
# whole alter table code is being tested all around the test suite already.
#
drop table t1;
create table t1 (v varchar(32));
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1;
# Fast alter, no copy performed
alter table t1 change v v2 varchar(32);
select * from t1;
# Fast alter, no copy performed
alter table t1 change v2 v varchar(64);
select * from t1;
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
# Regular alter table
alter table t1 add i int auto_increment not null primary key first;
select * from t1;
update t1 set i=5 where i=3;
select * from t1;
alter table t1 change i i bigint;
select * from t1;
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
#
# Cleanup, test is over
#
......
......@@ -1418,3 +1418,29 @@ truncate table t1; -- truncate
--disable_info
drop table t1;
#
# Some additional tests for new, faster alter table. Note that most of the
# whole alter table code is being tested all around the test suite already.
#
create table t1 (v varchar(32));
insert into t1 values ('def'),('abc'),('hij'),('3r4f');
select * from t1;
# Fast alter, no copy performed
alter table t1 change v v2 varchar(32);
select * from t1;
# Fast alter, no copy performed
alter table t1 change v2 v varchar(64);
select * from t1;
update t1 set v = 'lmn' where v = 'hij';
select * from t1;
# Regular alter table
alter table t1 add i int auto_increment not null primary key first;
select * from t1;
update t1 set i=5 where i=3;
select * from t1;
alter table t1 change i i bigint;
select * from t1;
alter table t1 add unique key (i, v);
select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
drop table t1;
......@@ -272,4 +272,11 @@ insert into t1 (f1) values ("2005-01-01");
insert into t1 (f1) values ("2005-02-01");
select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
drop table t1;
#
# Bug #15828
#
select str_to_date( 1, NULL );
select str_to_date( NULL, 1 );
select str_to_date( 1, IF(1=1,NULL,NULL) );
# End of 4.1 tests
......@@ -25,11 +25,11 @@ partition_03ndb : Bug#16385
ndb_binlog_basic : Results are not deterministic, Tomas will fix
rpl_ndb_basic : Bug#16228
rpl_sp : Bug #16456
#ndb_dd_disk2memory : Bug #16466
ndb_autodiscover : Needs to be fixed w.r.t binlog
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
#ndb_alter_table_row : sometimes wrong error 1015!=1046
ndb_gis : garbled msgs from corrupt THD*
rpl_ndb_auto_inc : MySQL Bugs:17086
rpl_ndb_relay_space : Bug 16993
ndb_binlog_ddl_multi : Bug #17038
# vim: set filetype=conf:
rpl_ndb_log : MySQL Bugs: #17158
......@@ -1237,6 +1237,7 @@ CREATE TABLE federated.t1 (
connection master;
DROP TABLE IF EXISTS federated.t1;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL auto_increment,
PRIMARY KEY (`id`)
......
......@@ -436,6 +436,17 @@ insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
drop table t1;
#
# Bug 12796: Record doesn't show when selecting through index
#
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert delayed into t1 values (0);
delete from t1;
select * from t1;
insert delayed into t1 values (0), (1);
select * from t1 where a = 0;
drop table t1;
# End of 4.1 tests
#
......
......@@ -12,7 +12,7 @@ connect (con2, localhost, root,,);
#remember id of con1
connection con1;
--disable_warnings
drop table if exists t1;
drop table if exists t1, t2, t3;
--enable_warnings
--disable_reconnect
......@@ -47,6 +47,50 @@ connection con2;
select 4;
drop table t1;
connection default;
#
# BUG#14851: killing long running subquery processed via a temporary table.
#
create table t1 (id int primary key);
create table t2 (id int unsigned not null);
connect (conn1, localhost, root,,);
connection conn1;
-- disable_result_log
-- disable_query_log
let $1 = 4096;
while ($1)
{
eval insert into t1 values ($1);
dec $1;
}
-- enable_query_log
-- enable_result_log
insert into t2 select id from t1;
create table t3 (kill_id int);
insert into t3 values(connection_id());
-- disable_result_log
send select id from t1 where id in (select distinct id from t2);
-- enable_result_log
connect (conn2, localhost, root,,);
connection conn2;
select ((@id := kill_id) - kill_id) from t3;
-- sleep 1
kill @id;
connection conn1;
-- error 1053
reap;
connection default;
drop table t1, t2, t3;
# End of 4.1 tests
#
......
source include/master-slave.inc;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word));
load data infile '../std_data_ln/words.dat' into table t1;
create table t2 (word char(20) not null);
load data infile '../std_data_ln/words.dat' into table t2;
create table t3 (word char(20) not null primary key);
connection slave;
load table t1 from master;
load table t2 from master;
load table t3 from master;
check table t1;
select count(*) from t2;
select count(*) from t3;
connection master;
set SQL_LOG_BIN=1;
drop table if exists t1,t2,t3;
save_master_pos;
connection slave;
sync_with_master;
create table t1(n int);
drop table t1;
# End of 4.1 tests
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl000006.test
......@@ -11,7 +11,6 @@
# Begin clean up test section
--disable_warnings
connection master;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
--enable_warnings
......@@ -23,18 +22,15 @@ DELETE FROM test.t1;
LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
connection master;
SELECT * FROM test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
save_master_pos;
sync_slave_with_master;
connection slave;
SELECT * FROM test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
connection master;
# Lets cleanup
#show binlog events;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE test.t1;
# End of 5.0 test case
......
......@@ -58,8 +58,10 @@ let $VERSION=`select version()`;
SHOW DATABASES;
sync_slave_with_master;
SHOW DATABASES;
SHOW CREATE TABLE mysqltest_prometheus.t1;
SHOW CREATE TABLE mysqltest_sisyfos.t2;
USE mysqltest_prometheus;
SHOW TABLES;
USE mysqltest_sisyfos;
SHOW TABLES;
connection master;
DROP DATABASE IF EXISTS mysqltest_prometheus;
......
##############################################
# Change Author: JBM
# Change Date: 2006-02-07
# Change: Added ENGINE=MyISAM
# Purpose: According to TU in 16552 This is how
# to work around NDB's issue with temp tables
##############################################
source include/master-slave.inc;
--disable_warnings
create database if not exists mysqltest;
--enable_warnings
create temporary table mysqltest.t1 (n int);
create temporary table mysqltest.t2 (n int);
create temporary table mysqltest.t1 (n int)ENGINE=MyISAM;
create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
sync_slave_with_master;
connection master;
disconnect master;
......
# Test for
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
# still checks that it has the same error as on the master.
##########################################################################
# 2006-02-07 JBM Added error code 1022 for NDB Engine + ORDER BY
##########################################################################
# Requires statement logging
-- source include/master-slave.inc
connection master;
create table t1 (a int primary key);
create table t4 (a int primary key);
# generate an error that goes to the binlog
--error 1062
--error 1022, 1062
insert into t1 values (1),(1);
insert into t4 values (1),(2);
save_master_pos;
......@@ -19,7 +21,7 @@ sync_with_master;
# check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1';
show tables like 't4';
SELECT * FROM test.t4;
SELECT * FROM test.t4 ORDER BY a;
connection master;
drop table t1;
save_master_pos;
......@@ -53,7 +55,7 @@ connection master1;
save_master_pos;
connection slave;
sync_with_master;
SELECT * FROM test.t4;
SELECT * FROM test.t4 ORDER BY a;
connection master1;
DROP TABLE test.t4;
......
#################################
# Wrapper for rpl_insert_id.test#
#################################
-- source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_insert_id_pk.test
# This one assumes we are ignoring updates on tables in database mysqltest2,
# but doing the ones in database mysqltest
#################################################################
# Change Author: JBM
# Change Date: 2006-02-02
# Change: Added ENGINE=MyISAM
# Reason: LOAD from master is only supported by MyISAM
#################################################################
source include/master-slave.inc;
--disable_warnings
......@@ -19,12 +25,12 @@ save_master_pos;
connection slave;
sync_with_master;
create database mysqltest2;
create table mysqltest2.foo (n int);
create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(4);
connection master;
create table mysqltest2.foo (n int);
create table mysqltest2.foo (n int)ENGINE=MyISAM;
insert into mysqltest2.foo values(5);
create table mysqltest.bar (m int);
create table mysqltest.bar (m int)ENGINE=MyISAM;
insert into mysqltest.bar values(15);
save_master_pos;
connection slave;
......@@ -49,13 +55,13 @@ set sql_log_bin = 0;
create database mysqltest2;
create database mysqltest;
show databases;
create table mysqltest2.t1(n int, s char(20));
create table mysqltest2.t2(n int, s text);
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
create table mysqltest.t1(n int, s char(20));
create table mysqltest.t2(n int, s text);
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
(13, 'thirteen test');
......@@ -69,21 +75,21 @@ show databases;
# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
# MASTER will neither touch database mysqltest nor mysqltest3
create database mysqltest2;
create table mysqltest2.t1(n int, s char(20));
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t1 values (1, 'original foo.t1');
create table mysqltest2.t3(n int, s char(20));
create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest2.t3 values (1, 'original foo.t3');
create database mysqltest3;
create table mysqltest3.t1(n int, s char(20));
create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest3.t1 values (1, 'original foo2.t1');
# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
# and mysqltest.t3 to check that it is not touched (there is no
# mysqltest.t3 on master)
create database mysqltest;
create table mysqltest.t1(n int, s char(20));
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t1 values (1, 'original bar.t1');
create table mysqltest.t3(n int, s char(20));
create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
......
###########################################################
# Change Author: JBM
# Change Date: 2006-2-2
# Change: Added ENGINE=$engine_type for first create table
# Reason: Only MyISAM supports load from master no need to
# run test case for other engines, in addition test will
# fail if other engines are set as default engine
###########################################################
# Change Author: JBM
# Change Date: 2006-2-3
# Change: removed ENGINE=$engine_type for first create table
# and renamed test file to rpl_load_table_from_master.test.
# In addition added test requirements.
# Reason: Request from review.
############################################################
# REQUIREMENT TEST 1:
# LOAD TABLE FROM MASTER must work with a forced timestamp.
############################################################
#
# Test forced timestamp
#
-- source include/master-slave.inc
-- echo "******************** Test Requirment 1 *************"
# Don't log table creating to the slave as we want to test LOAD TABLE
SET SQL_LOG_BIN=0,timestamp=200006;
eval CREATE TABLE t1(t TIMESTAMP NOT NULL,a CHAR(1))ENGINE=MyISAM;
INSERT INTO t1 ( a) VALUE ('F');
select unix_timestamp(t) from t1;
connection slave;
load table t1 from master;
select unix_timestamp(t) from t1;
# Delete the created table on master and slave
connection master;
set SQL_LOG_BIN=1,timestamp=default;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
connection master;
#
# Test copying table with checksum
#
# Don't log table creating to the slave as we want to test LOAD TABLE
set SQL_LOG_BIN=0;
#######################################################
# REQUIREMENTi TEST 2:
#LOAD TABLE FROM MASTER must work with table checksum
#######################################################
-- echo "******************** Test Requirment 2 *************"
eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM MAX_ROWS=4000 CHECKSUM=1;
INSERT INTO t1 VALUES (1);
save_master_pos;
connection slave;
sync_with_master;
load table t1 from master;
check table t1;
drop table t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
connection master;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
load data infile '../../std_data/words.dat' into table t1;
create table t2 (word char(20) not null)ENGINE=MyISAM;
load data infile '../../std_data/words.dat' into table t2;
create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
connection slave;
load table t1 from master;
load table t2 from master;
load table t3 from master;
check table t1;
select count(*) from t2;
select count(*) from t3;
connection master;
set SQL_LOG_BIN=1;
drop table if exists t1,t2,t3;
save_master_pos;
connection slave;
sync_with_master;
create table t1(n int);
drop table t1;
# End of 4.1 tests
--auto-increment-increment=10 --auto-increment-offset=2
#####################################
# Wrapper for rpl_auto_increment.test#
#####################################
-- source include/have_innodb.inc
let $engine_type=NDB;
let $engine_type2=myisam;
-- source extra/rpl_tests/rpl_auto_increment.test
###################################
# Wrapper for rpl_row_func003.test#
# This test was orginally designed#
# To test InnoDB using RBR, but #
# It can also be used to test NDB #
# So this wrapper is being used to#
# reduce test case code #
###################################
-- source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_row_func003.test
###################################
# Wrapper for rpl_row_log.test #
# Added wrapper so that MyISAM & #
# Innodb and NDB could all use the#
# Same test. NDB produced a diff #
# bin-log #
###################################
-- source include/have_binlog_format_row.inc
-- source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_log.test
###################################
# Wrapper rpl_sv_relay_space.test #
# This test has to be wrapped as #
# It tests ndb, innodb and MyISAM.#
# By Wrapping we are saving some #
# space and making the test more #
# Maintainable by only having one #
# test file and reusing the code #
# In Addition, INNODB has to have #
# Option files during this test #
# to force innodb on the slave #
# else the test will fail #
###################################
#Change Author: JBM #
#Change Date: 2006-02-03 #
#Change: Added Comments #
###################################
--source include/have_ndb.inc
let $engine_type=NDB;
-- source extra/rpl_tests/rpl_sv_relay_space.test
......@@ -32,12 +32,12 @@ insert into t1 values(5);
connection master;
enable_rpl_parse;
# The first of the queries will be sent to the slave, the second to the master.
select * from t1;
select * from t1;
SELECT * FROM t1 ORDER BY n;
SELECT * FROM t1 ORDER BY n;
disable_rpl_parse;
select * from t1;
SELECT * FROM t1 ORDER BY n;
connection slave;
select * from t1;
SELECT * FROM t1 ORDER BY n;
drop table t1;
connection master;
drop table t1;
......
###################################
# Wrapper rpl_sv_relay_space.test #
# This test has to be wrapped as #
# It tests ndb, innodb and MyISAM.#
# By Wrapping we are saving some #
# space and making the test more #
# Maintainable by only having one #
# test file and reusing the code #
# In Addition, INNODB has to have #
# Option files during this test #
# to force innodb on the slave #
# else the test will fail #
###################################
#Change Author: JBM #
#Change Date: 2006-02-03 #
#Change: Added Comments #
###################################
-- source include/have_innodb.inc
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_sv_relay_space.test
###################################
# Wrapper rpl_sv_relay_space.test #
# This test has to be wrapped as #
# It tests ndb, innodb and MyISAM.#
# By Wrapping we are saving some #
# space and making the test more #
# Maintainable by only having one #
# test file and reusing the code #
# In Addition, INNODB has to have #
# Option files during this test #
# to force innodb on the slave #
# else the test will fail #
###################################
#Change Author: JBM #
#Change Date: 2006-02-03 #
#Change: Added Comments #
###################################
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_sv_relay_space.test
......@@ -21,7 +21,7 @@ create table t11 select * from t1;
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
select * from t1 ORDER BY m;
select * from t2;
--error 1146
select * from t11;
......
......@@ -2,6 +2,6 @@
# Wrapper for rpl_row_blob.test#
#################################
-- source include/have_innodb.inc
let $engine_type=INNODB;
let $engine_type=InnoDB;
-- source extra/rpl_tests/rpl_row_blob.test
# Requires row base logging
###################################
# Wrapper for rpl_row_log.test #
# Added wrapper so that MyISAM & #
# Innodb and NDB could all use the#
# Same test. NDB produced a diff #
# bin-log #
###################################
-- source include/have_binlog_format_row.inc
let $engine_type=MyISAM;
-- source extra/rpl_tests/rpl_log.test
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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