Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B26564-5.1-opt
This commit is contained in:
commit
26bed2a607
@ -41,3 +41,17 @@ SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
|
||||
a
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1( a INT );
|
||||
SELECT b FROM t1;
|
||||
ERROR 42S22: Unknown column 'b' in 'field list'
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1054 Unknown column 'b' in 'field list'
|
||||
CREATE TABLE t2 SELECT b FROM t1;
|
||||
ERROR 42S22: Unknown column 'b' in 'field list'
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1054 Unknown column 'b' in 'field list'
|
||||
INSERT INTO t1 SELECT b FROM t1;
|
||||
ERROR 42S22: Unknown column 'b' in 'field list'
|
||||
DROP TABLE t1;
|
||||
|
@ -557,4 +557,53 @@ CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ENDS NOW() DO SELECT 1' at line 1
|
||||
CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'STARTS NOW() ENDS NOW() DO SELECT 1' at line 1
|
||||
USE test;
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
CREATE TABLE event_log (id int KEY AUTO_INCREMENT,
|
||||
ev_nm char(40), ev_cnt int,
|
||||
ev_tm timestamp) ENGINE=MyISAM;
|
||||
SET @ev_base_date = 20281224180000;
|
||||
SET autocommit=0;
|
||||
CREATE USER evtest1@localhost;
|
||||
SET PASSWORD FOR evtest1@localhost = password('ev1');
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost;
|
||||
GRANT create, insert, select, event ON events_test.* TO evtest1@localhost;
|
||||
GRANT select,insert ON TEST.* TO evtest1@localhost;
|
||||
SHOW GRANTS FOR evtest1@localhost;
|
||||
Grants for evtest1@localhost
|
||||
GRANT USAGE ON *.* TO 'evtest1'@'localhost' IDENTIFIED BY PASSWORD '*3170F3644E31580C25DE4A08F4C07CC9A2D40C32'
|
||||
GRANT SELECT, INSERT ON `TEST`.* TO 'evtest1'@'localhost'
|
||||
GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost'
|
||||
connection e1;
|
||||
USE events_test;
|
||||
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
|
||||
DO BEGIN
|
||||
SET AUTOCOMMIT = 0;
|
||||
SET @evname = 'ev_sched_1823';
|
||||
SET @cnt = 0;
|
||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||
COMMIT;
|
||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||
ROLLBACK;
|
||||
END;|
|
||||
connection default;
|
||||
DROP EVENT ev_sched_1823;
|
||||
DROP USER evtest1@localhost;
|
||||
USE test;
|
||||
=====================================================================================
|
||||
select id,ev_nm,ev_cnt from event_log order by id;
|
||||
id ev_nm ev_cnt
|
||||
1 ev_sched_1823 1
|
||||
2 ev_sched_1823 2
|
||||
3 ev_sched_1823 3
|
||||
4 ev_sched_1823 4
|
||||
5 ev_sched_1823 5
|
||||
6 ev_sched_1823 6
|
||||
DROP TABLE event_log;
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
DROP DATABASE events_test;
|
||||
|
195
mysql-test/r/rpl_partition.result
Normal file
195
mysql-test/r/rpl_partition.result
Normal file
@ -0,0 +1,195 @@
|
||||
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 GLOBAL binlog_format = 'ROW';
|
||||
SET SESSION binlog_format = 'ROW';
|
||||
select @@global.binlog_format, @@session.binlog_format;
|
||||
@@global.binlog_format ROW
|
||||
@@session.binlog_format ROW
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
Warnings:
|
||||
Level Note
|
||||
Code 1051
|
||||
Message Unknown table 't1'
|
||||
Level Note
|
||||
Code 1051
|
||||
Message Unknown table 't2'
|
||||
Level Note
|
||||
Code 1051
|
||||
Message Unknown table 't3'
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
Warnings:
|
||||
Level Note
|
||||
Code 1305
|
||||
Message PROCEDURE p1 does not exist
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
Warnings:
|
||||
Level Note
|
||||
Code 1305
|
||||
Message PROCEDURE p2 does not exist
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
Warnings:
|
||||
Level Note
|
||||
Code 1305
|
||||
Message PROCEDURE p3 does not exist
|
||||
CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE='innodb';
|
||||
CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE='innodb'
|
||||
PARTITION BY KEY(id) partitions 5;
|
||||
CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE='innodb'
|
||||
PARTITION BY RANGE(id)
|
||||
SUBPARTITION BY hash(id) subpartitions 2
|
||||
(PARTITION pa1 values less than (10),
|
||||
PARTITION pa2 values less than (20),
|
||||
PARTITION pa3 values less than (30),
|
||||
PARTITION pa4 values less than (40),
|
||||
PARTITION pa5 values less than (50),
|
||||
PARTITION pa6 values less than (60),
|
||||
PARTITION pa7 values less than (70),
|
||||
PARTITION pa8 values less than (80),
|
||||
PARTITION pa9 values less than (90),
|
||||
PARTITION pa10 values less than (100),
|
||||
PARTITION pa11 values less than MAXVALUE);
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
SELECT MAX(id) FROM t1 INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM t1 WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
SELECT MAX(id) FROM t2 INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM t2 WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
CREATE PROCEDURE p3()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
SET local_time= NOW();
|
||||
SET cur_user = CURRENT_USER();
|
||||
SET local_uuid=UUID();
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
SELECT MAX(id) FROM t3 INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM t3 WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
CALL p1();
|
||||
SELECT count(*) as "Master regular" FROM t1;
|
||||
Master regular 500
|
||||
CALL p2();
|
||||
SELECT count(*) as "Master bykey" FROM t2;
|
||||
Master bykey 500
|
||||
CALL p3();
|
||||
SELECT count(*) as "Master byrange" FROM t3;
|
||||
Master byrange 500
|
||||
show create table t3;
|
||||
Table t3
|
||||
Create Table CREATE TABLE `t3` (
|
||||
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
|
||||
`dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`user` char(255) DEFAULT NULL,
|
||||
`uuidf` longblob,
|
||||
`fkid` mediumint(9) DEFAULT NULL,
|
||||
`filler` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION pa3 VALUES LESS THAN (30) ENGINE = MyISAM, PARTITION pa4 VALUES LESS THAN (40) ENGINE = MyISAM, PARTITION pa5 VALUES LESS THAN (50) ENGINE = MyISAM, PARTITION pa6 VALUES LESS THAN (60) ENGINE = MyISAM, PARTITION pa7 VALUES LESS THAN (70) ENGINE = MyISAM, PARTITION pa8 VALUES LESS THAN (80) ENGINE = MyISAM, PARTITION pa9 VALUES LESS THAN (90) ENGINE = MyISAM, PARTITION pa10 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
|
||||
show slave status;
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_MYPORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos #
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
Slave_IO_Running Yes
|
||||
Slave_SQL_Running Yes
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 0
|
||||
Last_Error
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos #
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
||||
Master_SSL_Verify_Server_Cert No
|
||||
Last_IO_Errno #
|
||||
Last_IO_Error #
|
||||
Last_SQL_Errno 0
|
||||
Last_SQL_Error
|
||||
SELECT count(*) "Slave norm" FROM t1;
|
||||
Slave norm 500
|
||||
SELECT count(*) "Slave bykey" FROM t2;
|
||||
Slave bykey 500
|
||||
SELECT count(*) "Slave byrange" FROM t3;
|
||||
Slave byrange 500
|
||||
DROP TABLE t1, t2, t3;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
@ -53,4 +53,17 @@ INSERT INTO t1 VALUES(2),(3);
|
||||
SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #28677: SELECT on missing column gives extra error
|
||||
#
|
||||
CREATE TABLE t1( a INT );
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
SELECT b FROM t1;
|
||||
SHOW ERRORS;
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
CREATE TABLE t2 SELECT b FROM t1;
|
||||
SHOW ERRORS;
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
INSERT INTO t1 SELECT b FROM t1;
|
||||
DROP TABLE t1;
|
||||
# End of 5.0 tests
|
||||
|
@ -648,7 +648,65 @@ CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1;
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1;
|
||||
|
||||
#
|
||||
# START - BUG#28924 If I drop the user who is the definer of an active event then server cores
|
||||
#
|
||||
let $engine=MyISAM;
|
||||
USE test;
|
||||
SHOW GRANTS FOR CURRENT_USER;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
eval CREATE TABLE event_log (id int KEY AUTO_INCREMENT,
|
||||
ev_nm char(40), ev_cnt int,
|
||||
ev_tm timestamp) ENGINE=$engine;
|
||||
SET @ev_base_date = 20281224180000;
|
||||
--disable_warnings
|
||||
SET autocommit=0;
|
||||
#DROP DATABASE IF EXISTS ev_db_1;
|
||||
#CREATE DATABASE ev_db_1;
|
||||
--enable_warnings
|
||||
CREATE USER evtest1@localhost;
|
||||
SET PASSWORD FOR evtest1@localhost = password('ev1');
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost;
|
||||
GRANT create, insert, select, event ON events_test.* TO evtest1@localhost;
|
||||
GRANT select,insert ON TEST.* TO evtest1@localhost;
|
||||
SHOW GRANTS FOR evtest1@localhost;
|
||||
|
||||
--echo connection e1;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
|
||||
connect (e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
USE events_test;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
|
||||
DO BEGIN
|
||||
SET AUTOCOMMIT = 0;
|
||||
SET @evname = 'ev_sched_1823';
|
||||
SET @cnt = 0;
|
||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||
COMMIT;
|
||||
SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname;
|
||||
INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
|
||||
ROLLBACK;
|
||||
END;|
|
||||
DELIMITER ;|
|
||||
|
||||
--sleep 6
|
||||
--echo connection default;
|
||||
DROP EVENT ev_sched_1823;
|
||||
connection default;
|
||||
DROP USER evtest1@localhost;
|
||||
|
||||
--sleep 6
|
||||
USE test;
|
||||
--echo =====================================================================================
|
||||
--sleep 5
|
||||
#--disable_result_log
|
||||
select id,ev_nm,ev_cnt from event_log order by id;
|
||||
#--enable_result_log
|
||||
DROP TABLE event_log;
|
||||
#DROP DATABASE ev_db_1;
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
|
||||
#
|
||||
# End of tests
|
||||
|
160
mysql-test/t/rpl_partition.test
Normal file
160
mysql-test/t/rpl_partition.test
Normal file
@ -0,0 +1,160 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
--vertical_results
|
||||
|
||||
let $engine_type= 'innodb';
|
||||
|
||||
SET GLOBAL binlog_format = 'ROW';
|
||||
SET SESSION binlog_format = 'ROW';
|
||||
select @@global.binlog_format, @@session.binlog_format;
|
||||
|
||||
--disable-warnings
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
--enable-warnings
|
||||
|
||||
eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type;
|
||||
|
||||
eval CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type
|
||||
PARTITION BY KEY(id) partitions 5;
|
||||
|
||||
eval CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
|
||||
fkid MEDIUMINT, filler VARCHAR(255),
|
||||
PRIMARY KEY(id)) ENGINE=$engine_type
|
||||
PARTITION BY RANGE(id)
|
||||
SUBPARTITION BY hash(id) subpartitions 2
|
||||
(PARTITION pa1 values less than (10),
|
||||
PARTITION pa2 values less than (20),
|
||||
PARTITION pa3 values less than (30),
|
||||
PARTITION pa4 values less than (40),
|
||||
PARTITION pa5 values less than (50),
|
||||
PARTITION pa6 values less than (60),
|
||||
PARTITION pa7 values less than (70),
|
||||
PARTITION pa8 values less than (80),
|
||||
PARTITION pa9 values less than (90),
|
||||
PARTITION pa10 values less than (100),
|
||||
PARTITION pa11 values less than MAXVALUE);
|
||||
|
||||
######## Create SPs, Functions, Views and Triggers Section ##############
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM t1 INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM t1 WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user= CURRENT_USER();
|
||||
SET local_uuid= UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM t2 INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM t2 WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE p3()
|
||||
BEGIN
|
||||
DECLARE ins_count INT DEFAULT 1000;
|
||||
DECLARE del_count INT;
|
||||
DECLARE cur_user VARCHAR(255);
|
||||
DECLARE local_uuid VARCHAR(255);
|
||||
DECLARE local_time TIMESTAMP;
|
||||
|
||||
SET local_time= NOW();
|
||||
SET cur_user = CURRENT_USER();
|
||||
SET local_uuid=UUID();
|
||||
|
||||
WHILE ins_count > 0 DO
|
||||
INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(),
|
||||
ins_count,'Going to test MBR for MySQL');
|
||||
SET ins_count = ins_count - 1;
|
||||
END WHILE;
|
||||
|
||||
SELECT MAX(id) FROM t3 INTO del_count;
|
||||
WHILE del_count > 0 DO
|
||||
DELETE FROM t3 WHERE id = del_count;
|
||||
SET del_count = del_count - 2;
|
||||
END WHILE;
|
||||
END|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
############ Finish Setup Section ###################
|
||||
|
||||
|
||||
############ Test Section ###################
|
||||
|
||||
CALL p1();
|
||||
SELECT count(*) as "Master regular" FROM t1;
|
||||
CALL p2();
|
||||
SELECT count(*) as "Master bykey" FROM t2;
|
||||
CALL p3();
|
||||
SELECT count(*) as "Master byrange" FROM t3;
|
||||
|
||||
#--source include/master-slave-end.inc
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
show create table t3;
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
|
||||
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
|
||||
show slave status;
|
||||
SELECT count(*) "Slave norm" FROM t1;
|
||||
SELECT count(*) "Slave bykey" FROM t2;
|
||||
SELECT count(*) "Slave byrange" FROM t3;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, t3;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
# End of 5.1 tests
|
@ -1778,7 +1778,7 @@ Event_job_data::execute(THD *thd, bool drop)
|
||||
"[%s].[%s.%s] execution failed, "
|
||||
"failed to authenticate the user.",
|
||||
definer.str, dbname.str, name.str);
|
||||
goto end;
|
||||
goto end_no_lex_start;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1795,11 +1795,11 @@ Event_job_data::execute(THD *thd, bool drop)
|
||||
"[%s].[%s.%s] execution failed, "
|
||||
"user no longer has EVENT privilege.",
|
||||
definer.str, dbname.str, name.str);
|
||||
goto end;
|
||||
goto end_no_lex_start;
|
||||
}
|
||||
|
||||
if (construct_sp_sql(thd, &sp_sql))
|
||||
goto end;
|
||||
goto end_no_lex_start;
|
||||
|
||||
/*
|
||||
Set up global thread attributes to reflect the properties of
|
||||
@ -1860,6 +1860,13 @@ Event_job_data::execute(THD *thd, bool drop)
|
||||
}
|
||||
|
||||
end:
|
||||
if (thd->lex->sphead) /* NULL only if a parse error */
|
||||
{
|
||||
delete thd->lex->sphead;
|
||||
thd->lex->sphead= NULL;
|
||||
}
|
||||
|
||||
end_no_lex_start:
|
||||
if (drop && !thd->is_fatal_error)
|
||||
{
|
||||
/*
|
||||
@ -1887,11 +1894,6 @@ end:
|
||||
ret= 1;
|
||||
}
|
||||
}
|
||||
if (thd->lex->sphead) /* NULL only if a parse error */
|
||||
{
|
||||
delete thd->lex->sphead;
|
||||
thd->lex->sphead= NULL;
|
||||
}
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (save_sctx)
|
||||
event_sctx.restore_security_context(thd, save_sctx);
|
||||
|
@ -383,7 +383,8 @@ bool ha_partition::initialise_partition(MEM_ROOT *mem_root)
|
||||
m_table_flags&= file->table_flags();
|
||||
} while (*(++file_array));
|
||||
m_table_flags&= ~(HA_CAN_GEOMETRY | HA_CAN_FULLTEXT | HA_DUPLICATE_POS |
|
||||
HA_CAN_SQL_HANDLER | HA_CAN_INSERT_DELAYED);
|
||||
HA_CAN_SQL_HANDLER | HA_CAN_INSERT_DELAYED |
|
||||
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION);
|
||||
m_table_flags|= HA_FILE_BASED | HA_REC_NOT_IN_SEQ;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -1983,6 +1983,7 @@ class select_insert :public select_result_interceptor {
|
||||
virtual bool can_rollback_data() { return 0; }
|
||||
void send_error(uint errcode,const char *err);
|
||||
bool send_eof();
|
||||
void abort();
|
||||
/* not implemented: select_insert is never re-used in prepared statements */
|
||||
void cleanup();
|
||||
};
|
||||
|
@ -3020,57 +3020,8 @@ void select_insert::send_error(uint errcode,const char *err)
|
||||
{
|
||||
DBUG_ENTER("select_insert::send_error");
|
||||
|
||||
/* Avoid an extra 'unknown error' message if we already reported an error */
|
||||
if (errcode != ER_UNKNOWN_ERROR && !thd->net.report_error)
|
||||
my_message(errcode, err, MYF(0));
|
||||
my_message(errcode, err, MYF(0));
|
||||
|
||||
/*
|
||||
If the creation of the table failed (due to a syntax error, for
|
||||
example), no table will have been opened and therefore 'table'
|
||||
will be NULL. In that case, we still need to execute the rollback
|
||||
and the end of the function.
|
||||
*/
|
||||
if (table)
|
||||
{
|
||||
/*
|
||||
If we are not in prelocked mode, we end the bulk insert started
|
||||
before.
|
||||
*/
|
||||
if (!thd->prelocked_mode)
|
||||
table->file->ha_end_bulk_insert();
|
||||
|
||||
/*
|
||||
If at least one row has been inserted/modified and will stay in
|
||||
the table (the table doesn't have transactions) we must write to
|
||||
the binlog (and the error code will make the slave stop).
|
||||
|
||||
For many errors (example: we got a duplicate key error while
|
||||
inserting into a MyISAM table), no row will be added to the table,
|
||||
so passing the error to the slave will not help since there will
|
||||
be an error code mismatch (the inserts will succeed on the slave
|
||||
with no error).
|
||||
|
||||
If table creation failed, the number of rows modified will also be
|
||||
zero, so no check for that is made.
|
||||
*/
|
||||
if (info.copied || info.deleted || info.updated)
|
||||
{
|
||||
DBUG_ASSERT(table != NULL);
|
||||
if (!table->file->has_transactions())
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
|
||||
table->file->has_transactions(), FALSE);
|
||||
if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table &&
|
||||
!can_rollback_data())
|
||||
thd->no_trans_update.all= TRUE;
|
||||
query_cache_invalidate3(thd, table, 1);
|
||||
}
|
||||
}
|
||||
table->file->ha_release_auto_increment();
|
||||
}
|
||||
|
||||
ha_rollback_stmt(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -3160,6 +3111,59 @@ bool select_insert::send_eof()
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
void select_insert::abort() {
|
||||
|
||||
DBUG_ENTER("select_insert::abort");
|
||||
/*
|
||||
If the creation of the table failed (due to a syntax error, for
|
||||
example), no table will have been opened and therefore 'table'
|
||||
will be NULL. In that case, we still need to execute the rollback
|
||||
and the end of the function.
|
||||
*/
|
||||
if (table)
|
||||
{
|
||||
/*
|
||||
If we are not in prelocked mode, we end the bulk insert started
|
||||
before.
|
||||
*/
|
||||
if (!thd->prelocked_mode)
|
||||
table->file->ha_end_bulk_insert();
|
||||
|
||||
/*
|
||||
If at least one row has been inserted/modified and will stay in
|
||||
the table (the table doesn't have transactions) we must write to
|
||||
the binlog (and the error code will make the slave stop).
|
||||
|
||||
For many errors (example: we got a duplicate key error while
|
||||
inserting into a MyISAM table), no row will be added to the table,
|
||||
so passing the error to the slave will not help since there will
|
||||
be an error code mismatch (the inserts will succeed on the slave
|
||||
with no error).
|
||||
|
||||
If table creation failed, the number of rows modified will also be
|
||||
zero, so no check for that is made.
|
||||
*/
|
||||
if (info.copied || info.deleted || info.updated)
|
||||
{
|
||||
DBUG_ASSERT(table != NULL);
|
||||
if (!table->file->has_transactions())
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
|
||||
table->file->has_transactions(), FALSE);
|
||||
if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table &&
|
||||
!can_rollback_data())
|
||||
thd->no_trans_update.all= TRUE;
|
||||
query_cache_invalidate3(thd, table, 1);
|
||||
}
|
||||
}
|
||||
table->file->ha_release_auto_increment();
|
||||
}
|
||||
|
||||
ha_rollback_stmt(thd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CREATE TABLE (SELECT) ...
|
||||
@ -3596,6 +3600,14 @@ void select_create::abort()
|
||||
{
|
||||
DBUG_ENTER("select_create::abort");
|
||||
|
||||
/*
|
||||
Disable binlog, because we "roll back" partial inserts in ::abort
|
||||
by removing the table, even for non-transactional tables.
|
||||
*/
|
||||
tmp_disable_binlog(thd);
|
||||
select_insert::abort();
|
||||
reenable_binlog(thd);
|
||||
|
||||
/*
|
||||
We roll back the statement, including truncating the transaction
|
||||
cache of the binary log, if the statement failed.
|
||||
|
@ -261,11 +261,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
|
||||
thd->net.report_error));
|
||||
res|= thd->net.report_error;
|
||||
if (unlikely(res))
|
||||
{
|
||||
/* If we had a another error reported earlier then this will be ignored */
|
||||
result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));
|
||||
result->abort();
|
||||
}
|
||||
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user