mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
auto-merge of mysql-5.1->mysql-5.1-security
This commit is contained in:
@ -419,7 +419,7 @@ SET TIME_ZONE= '+04:00';
|
||||
ALTER EVENT e1 DO SELECT 2;
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP EVENT e1;
|
||||
SET TIME_ZONE='+05:00';
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
|
||||
@ -796,6 +796,20 @@ COUNT(*)
|
||||
DROP EVENT IF EXISTS event_Bug12546938;
|
||||
DROP TABLE table_bug12546938;
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
DROP DATABASE IF EXISTS event_test11764334;
|
||||
CREATE DATABASE event_test11764334;
|
||||
USE event_test11764334;
|
||||
CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 4 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP EVENT ev1;
|
||||
DROP DATABASE event_test11764334;
|
||||
USE test;
|
||||
DROP DATABASE events_test;
|
||||
SET GLOBAL event_scheduler= 'ON';
|
||||
SET @@global.concurrent_insert= @concurrent_insert;
|
||||
|
@ -1549,3 +1549,30 @@ HANDLER t1 READ a NEXT;
|
||||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
#
|
||||
# Bug #57323/11764487: myisam corruption with insert ignore
|
||||
# and invalid spatial data
|
||||
#
|
||||
CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
|
||||
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
SELECT ASTEXT(a), ASTEXT(b) FROM t1;
|
||||
ASTEXT(a) ASTEXT(b)
|
||||
POINT(0 0) POINT(1 1)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
|
||||
KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
|
||||
INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
INSERT IGNORE INTO t1 SET a=1, b=NULL;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
SELECT a, ASTEXT(b) FROM t1;
|
||||
a ASTEXT(b)
|
||||
0 POINT(1 1)
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -1,5 +1,34 @@
|
||||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#11765667: bug#58655: ASSERTION FAILED,
|
||||
# SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt DATE, st VARCHAR(255), uid INT,
|
||||
id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
|
||||
('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
|
||||
('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
|
||||
('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
|
||||
('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
|
||||
('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
|
||||
('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
|
||||
('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
|
||||
('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
|
||||
('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
|
||||
ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
|
||||
PARTITION d1 VALUES IN (1991, 1994),
|
||||
PARTITION d2 VALUES IN (1993),
|
||||
PARTITION d3 VALUES IN (1992, 1995, 1996)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
|
||||
UPDATE t1 SET filler='Updating the row' WHERE uid=298;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#59297: Can't find record in 'tablename' on update inner join
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
|
@ -43,3 +43,101 @@ DROP TABLE t2;
|
||||
DROP USER mysqltest_dfn@localhost;
|
||||
DROP USER mysqltest_inv@localhost;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
USE test;
|
||||
#
|
||||
# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
|
||||
#
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
INSERT INTO t3 VALUES (1), (2), (3);
|
||||
# We simulate importing a trigger from 5.0 by writing a .TRN file for
|
||||
# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
|
||||
# with syntax allowed in 5.0 only.
|
||||
#
|
||||
# Note that in 5.0 the following lines are missing from t1.TRG:
|
||||
#
|
||||
# client_cs_names='latin1'
|
||||
# connection_cl_names='latin1_swedish_ci'
|
||||
# db_cl_names='latin1_swedish_ci'
|
||||
# We will get parse errors for most DDL and DML statements when the table
|
||||
# has broken triggers. The parse error refers to the first broken
|
||||
# trigger.
|
||||
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
|
||||
ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
Warning 1603 Triggers for table `test`.`t2` have no creation context
|
||||
INSERT INTO t1 VALUES (1);
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
INSERT INTO t2 VALUES (1);
|
||||
ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
|
||||
DELETE FROM t1;
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
UPDATE t1 SET a = 1 WHERE a = 1;
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
RENAME TABLE t1 TO t1_2;
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TRIGGER tr11;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TRIGGER tr12;
|
||||
DROP TRIGGER tr13;
|
||||
DROP TRIGGER tr14;
|
||||
DROP TRIGGER tr15;
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
# Make sure there is no trigger file left.
|
||||
# We write the same trigger files one more time to test DROP TABLE.
|
||||
DROP TABLE t1;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TABLE t2;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t2` have no creation context
|
||||
DROP TABLE t3;
|
||||
# Make sure there is no trigger file left.
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
|
||||
# and last trigger is broken.
|
||||
# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
|
||||
FLUSH TABLE t1;
|
||||
SHOW CREATE TRIGGER tr12;
|
||||
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
|
||||
tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
SHOW CREATE TRIGGER tr11;
|
||||
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
|
||||
tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP TRIGGER tr12;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TRIGGER tr11;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@ -2134,10 +2134,8 @@ CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1
|
||||
# Used to crash
|
||||
SHOW TRIGGERS IN db1;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
Warnings:
|
||||
Warning 1064 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 'VALUES (1)' at line 1
|
||||
INSERT INTO t2 VALUES (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 'VALUES (1)' at line 1
|
||||
ERROR 42000: Trigger 'trg1' has an error in its body: '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 'VALUES (1)' at line 1'
|
||||
SELECT * FROM t1;
|
||||
b
|
||||
# Work around Bug#45235
|
||||
|
@ -1286,6 +1286,23 @@ DROP EVENT IF EXISTS event_Bug12546938;
|
||||
DROP TABLE table_bug12546938;
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
|
||||
#
|
||||
# Bug#11764334 - 57156: ALTER EVENT CHANGES THE EVENT STATUS
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS event_test11764334;
|
||||
--enable_warnings
|
||||
CREATE DATABASE event_test11764334;
|
||||
USE event_test11764334;
|
||||
CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
|
||||
--replace_column 9 # 10 #
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
|
||||
--replace_column 9 # 10 #
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
DROP EVENT ev1;
|
||||
DROP DATABASE event_test11764334;
|
||||
USE test;
|
||||
###########################################################################
|
||||
#
|
||||
# End of tests
|
||||
|
@ -928,3 +928,31 @@ DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #57323/11764487: myisam corruption with insert ignore
|
||||
--echo # and invalid spatial data
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
|
||||
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
|
||||
SELECT ASTEXT(a), ASTEXT(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
|
||||
KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=1, b=NULL;
|
||||
SELECT a, ASTEXT(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -14,6 +14,37 @@
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Bug#11765667: bug#58655: ASSERTION FAILED,
|
||||
--echo # SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt DATE, st VARCHAR(255), uid INT,
|
||||
id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
|
||||
('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
|
||||
('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
|
||||
('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
|
||||
('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
|
||||
('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
|
||||
('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
|
||||
('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
|
||||
('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
|
||||
('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
|
||||
ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
|
||||
PARTITION d1 VALUES IN (1991, 1994),
|
||||
PARTITION d2 VALUES IN (1993),
|
||||
PARTITION d3 VALUES IN (1992, 1995, 1996)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
|
||||
UPDATE t1 SET filler='Updating the row' WHERE uid=298;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#59297: Can't find record in 'tablename' on update inner join
|
||||
--echo #
|
||||
|
@ -106,4 +106,178 @@ DROP TABLE t2;
|
||||
DROP USER mysqltest_dfn@localhost;
|
||||
DROP USER mysqltest_inv@localhost;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
USE test;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
|
||||
--echo #
|
||||
let $MYSQLD_DATADIR=`SELECT @@datadir`;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
INSERT INTO t3 VALUES (1), (2), (3);
|
||||
|
||||
--echo # We simulate importing a trigger from 5.0 by writing a .TRN file for
|
||||
--echo # each trigger plus a .TRG file the way MySQL 5.0 would have done it,
|
||||
--echo # with syntax allowed in 5.0 only.
|
||||
--echo #
|
||||
--echo # Note that in 5.0 the following lines are missing from t1.TRG:
|
||||
--echo #
|
||||
--echo # client_cs_names='latin1'
|
||||
--echo # connection_cl_names='latin1_swedish_ci'
|
||||
--echo # db_cl_names='latin1_swedish_ci'
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr11.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr12.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr13.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr14.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr15.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t1.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
|
||||
sql_modes=0 0 0 0 0
|
||||
definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t2.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='Not allowed syntax here, and trigger name cant be extracted either.'
|
||||
sql_modes=0
|
||||
definers='root@localhost'
|
||||
EOF
|
||||
|
||||
--echo # We will get parse errors for most DDL and DML statements when the table
|
||||
--echo # has broken triggers. The parse error refers to the first broken
|
||||
--echo # trigger.
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
|
||||
SHOW TRIGGERS;
|
||||
--error ER_PARSE_ERROR
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--error ER_PARSE_ERROR
|
||||
INSERT INTO t2 VALUES (1);
|
||||
--error ER_PARSE_ERROR
|
||||
DELETE FROM t1;
|
||||
--error ER_PARSE_ERROR
|
||||
UPDATE t1 SET a = 1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
--error ER_PARSE_ERROR
|
||||
RENAME TABLE t1 TO t1_2;
|
||||
SHOW TRIGGERS;
|
||||
|
||||
DROP TRIGGER tr11;
|
||||
DROP TRIGGER tr12;
|
||||
DROP TRIGGER tr13;
|
||||
DROP TRIGGER tr14;
|
||||
DROP TRIGGER tr15;
|
||||
|
||||
SHOW TRIGGERS;
|
||||
|
||||
--echo # Make sure there is no trigger file left.
|
||||
--list_files $MYSQLD_DATADIR/test/ tr*
|
||||
|
||||
--echo # We write the same trigger files one more time to test DROP TABLE.
|
||||
--write_file $MYSQLD_DATADIR/test/tr11.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr12.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr13.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr14.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr15.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t1.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
|
||||
sql_modes=0 0 0 0 0
|
||||
definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
|
||||
EOF
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
||||
--echo # Make sure there is no trigger file left.
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test/ tr*
|
||||
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
|
||||
--echo # We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
|
||||
--echo # and last trigger is broken.
|
||||
--echo # Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
|
||||
--write_file $MYSQLD_DATADIR/test/tr11.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr12.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t1.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='CREATE the wrongest trigger_in_the_world' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2'
|
||||
sql_modes=0 0 0
|
||||
definers='root@localhost' 'root@localhost' 'root@localhost'
|
||||
EOF
|
||||
|
||||
FLUSH TABLE t1;
|
||||
|
||||
SHOW CREATE TRIGGER tr12;
|
||||
SHOW CREATE TRIGGER tr11;
|
||||
DROP TRIGGER tr12;
|
||||
DROP TRIGGER tr11;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@ -226,9 +226,16 @@ mysql_event_fill_row(THD *thd,
|
||||
if (fields[f_num= ET_FIELD_NAME]->store(et->name.str, et->name.length, scs))
|
||||
goto err_truncate;
|
||||
|
||||
/* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/
|
||||
/* ON_COMPLETION field is NOT NULL thus not calling set_notnull()*/
|
||||
rs|= fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
|
||||
rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
|
||||
|
||||
/*
|
||||
Set STATUS value unconditionally in case of CREATE EVENT.
|
||||
For ALTER EVENT set it only if value of this field was changed.
|
||||
Since STATUS field is NOT NULL call to set_notnull() is not needed.
|
||||
*/
|
||||
if (!is_update || et->status_changed)
|
||||
rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
|
||||
rs|= fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
|
||||
|
||||
/*
|
||||
@ -694,8 +701,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
||||
if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, FALSE))
|
||||
goto end;
|
||||
|
||||
table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE);
|
||||
|
||||
if ((ret= table->file->ha_write_row(table->record[0])))
|
||||
{
|
||||
table->file->print_error(ret, MYF(0));
|
||||
|
@ -46,9 +46,8 @@ Event_parse_data::new_instance(THD *thd)
|
||||
|
||||
Event_parse_data::Event_parse_data()
|
||||
:on_completion(Event_parse_data::ON_COMPLETION_DEFAULT),
|
||||
status(Event_parse_data::ENABLED),
|
||||
do_not_create(FALSE),
|
||||
body_changed(FALSE),
|
||||
status(Event_parse_data::ENABLED), status_changed(false),
|
||||
do_not_create(FALSE), body_changed(FALSE),
|
||||
item_starts(NULL), item_ends(NULL), item_execute_at(NULL),
|
||||
starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE),
|
||||
item_expression(NULL), expression(0)
|
||||
@ -140,6 +139,7 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc)
|
||||
else if (status == Event_parse_data::ENABLED)
|
||||
{
|
||||
status= Event_parse_data::DISABLED;
|
||||
status_changed= true;
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_EVENT_EXEC_TIME_IN_THE_PAST,
|
||||
ER(ER_EVENT_EXEC_TIME_IN_THE_PAST));
|
||||
@ -569,7 +569,10 @@ void Event_parse_data::check_originator_id(THD *thd)
|
||||
DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED."));
|
||||
if ((status == Event_parse_data::ENABLED) ||
|
||||
(status == Event_parse_data::DISABLED))
|
||||
status = Event_parse_data::SLAVESIDE_DISABLED;
|
||||
{
|
||||
status= Event_parse_data::SLAVESIDE_DISABLED;
|
||||
status_changed= true;
|
||||
}
|
||||
originator = thd->server_id;
|
||||
}
|
||||
else
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
|
||||
int on_completion;
|
||||
int status;
|
||||
bool status_changed;
|
||||
longlong originator;
|
||||
/*
|
||||
do_not_create will be set if STARTS time is in the past and
|
||||
|
@ -3407,15 +3407,19 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data)
|
||||
|
||||
exit:
|
||||
/*
|
||||
if updating an auto_increment column, update
|
||||
If updating an auto_increment column, update
|
||||
table_share->ha_data->next_auto_inc_val if needed.
|
||||
(not to be used if auto_increment on secondary field in a multi-column
|
||||
index)
|
||||
mysql_update does not set table->next_number_field, so we use
|
||||
table->found_next_number_field instead.
|
||||
Also checking that the field is marked in the write set.
|
||||
*/
|
||||
if (table->found_next_number_field && new_data == table->record[0] &&
|
||||
!table->s->next_number_keypart)
|
||||
if (table->found_next_number_field &&
|
||||
new_data == table->record[0] &&
|
||||
!table->s->next_number_keypart &&
|
||||
bitmap_is_set(table->write_set,
|
||||
table->found_next_number_field->field_index))
|
||||
{
|
||||
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
|
||||
if (!ha_data->auto_inc_initialized)
|
||||
@ -3978,6 +3982,7 @@ void ha_partition::position(const uchar *record)
|
||||
void ha_partition::column_bitmaps_signal()
|
||||
{
|
||||
handler::column_bitmaps_signal();
|
||||
/* Must read all partition fields to make position() call possible */
|
||||
bitmap_union(table->read_set, &m_part_info->full_part_field_set);
|
||||
}
|
||||
|
||||
|
@ -2354,6 +2354,21 @@ void
|
||||
sp_head::restore_thd_mem_root(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("sp_head::restore_thd_mem_root");
|
||||
|
||||
/*
|
||||
In some cases our parser detects a syntax error and calls
|
||||
LEX::cleanup_lex_after_parse_error() method only after
|
||||
finishing parsing the whole routine. In such a situation
|
||||
sp_head::restore_thd_mem_root() will be called twice - the
|
||||
first time as part of normal parsing process and the second
|
||||
time by cleanup_lex_after_parse_error().
|
||||
To avoid ruining active arena/mem_root state in this case we
|
||||
skip restoration of old arena/mem_root if this method has been
|
||||
already called for this routine.
|
||||
*/
|
||||
if (!m_thd)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
Item *flist= free_list; // The old list
|
||||
set_query_arena(thd); // Get new free_list and mem_root
|
||||
state= INITIALIZED_FOR_SP;
|
||||
|
@ -7972,10 +7972,14 @@ bool parse_sql(THD *thd,
|
||||
|
||||
bool mysql_parse_status= MYSQLparse(thd) != 0;
|
||||
|
||||
/* Check that if MYSQLparse() failed, thd->is_error() is set. */
|
||||
/*
|
||||
Check that if MYSQLparse() failed, thd->is_error() is set (unless
|
||||
we have an error handler installed, which might have silenced error).
|
||||
*/
|
||||
|
||||
DBUG_ASSERT(!mysql_parse_status ||
|
||||
(mysql_parse_status && thd->is_error()));
|
||||
(mysql_parse_status && thd->is_error()) ||
|
||||
(mysql_parse_status && thd->get_internal_handler()));
|
||||
|
||||
/* Reset parser state. */
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "sp_head.h"
|
||||
#include "sql_trigger.h"
|
||||
#include "parse_file.h"
|
||||
#include <mysys_err.h>
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
@ -292,6 +293,52 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
An error handler that catches all non-OOM errors which can occur during
|
||||
parsing of trigger body. Such errors are ignored and corresponding error
|
||||
message is used to construct a more verbose error message which contains
|
||||
name of problematic trigger. This error message is later emitted when
|
||||
one tries to perform DML or some of DDL on this table.
|
||||
Also, if possible, grabs name of the trigger being parsed so it can be
|
||||
used to correctly drop problematic trigger.
|
||||
*/
|
||||
class Deprecated_trigger_syntax_handler : public Internal_error_handler
|
||||
{
|
||||
private:
|
||||
|
||||
char m_message[MYSQL_ERRMSG_SIZE];
|
||||
LEX_STRING *m_trigger_name;
|
||||
|
||||
public:
|
||||
|
||||
Deprecated_trigger_syntax_handler() : m_trigger_name(NULL) {}
|
||||
|
||||
virtual bool handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level, THD *thd)
|
||||
{
|
||||
if (sql_errno != EE_OUTOFMEMORY &&
|
||||
sql_errno != ER_OUT_OF_RESOURCES)
|
||||
{
|
||||
if(thd->lex->spname)
|
||||
m_trigger_name= &thd->lex->spname->m_name;
|
||||
if (m_trigger_name)
|
||||
my_snprintf(m_message, sizeof(m_message),
|
||||
"Trigger '%s' has an error in its body: '%s'",
|
||||
m_trigger_name->str, message);
|
||||
else
|
||||
my_snprintf(m_message, sizeof(m_message),
|
||||
"Unknown trigger has an error in its body: '%s'",
|
||||
message);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
LEX_STRING *get_trigger_name() { return m_trigger_name; }
|
||||
char *get_error_message() { return m_message; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Create or drop trigger for table.
|
||||
|
||||
@ -575,6 +622,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
|
||||
LEX_STRING *trg_connection_cl_name;
|
||||
LEX_STRING *trg_db_cl_name;
|
||||
|
||||
if (check_for_broken_triggers())
|
||||
return true;
|
||||
|
||||
/* Trigger must be in the same schema as target table. */
|
||||
if (my_strcasecmp(table_alias_charset, table->s->db.str,
|
||||
@ -848,7 +897,7 @@ static bool rm_trigger_file(char *path, const char *db,
|
||||
@param path char buffer of size FN_REFLEN to be used
|
||||
for constructing path to .TRN file.
|
||||
@param db trigger's database name
|
||||
@param table_name trigger's name
|
||||
@param trigger_name trigger's name
|
||||
|
||||
@retval
|
||||
False success
|
||||
@ -1312,12 +1361,11 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
lex_start(thd);
|
||||
thd->spcont= NULL;
|
||||
|
||||
if (parse_sql(thd, & parser_state, creation_ctx))
|
||||
{
|
||||
/* Currently sphead is always deleted in case of a parse error */
|
||||
DBUG_ASSERT(lex.sphead == 0);
|
||||
goto err_with_lex_cleanup;
|
||||
}
|
||||
Deprecated_trigger_syntax_handler error_handler;
|
||||
thd->push_internal_handler(&error_handler);
|
||||
bool parse_error= parse_sql(thd, & parser_state, creation_ctx);
|
||||
thd->pop_internal_handler();
|
||||
|
||||
/*
|
||||
Not strictly necessary to invoke this method here, since we know
|
||||
that we've parsed CREATE TRIGGER and not an
|
||||
@ -1328,6 +1376,52 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
*/
|
||||
lex.set_trg_event_type_for_tables();
|
||||
|
||||
if (parse_error)
|
||||
{
|
||||
if (!triggers->m_has_unparseable_trigger)
|
||||
triggers->set_parse_error_message(error_handler.get_error_message());
|
||||
/* Currently sphead is always set to NULL in case of a parse error */
|
||||
DBUG_ASSERT(lex.sphead == 0);
|
||||
if (error_handler.get_trigger_name())
|
||||
{
|
||||
LEX_STRING *trigger_name;
|
||||
const LEX_STRING *orig_trigger_name= error_handler.get_trigger_name();
|
||||
|
||||
if (!(trigger_name= alloc_lex_string(&table->mem_root)) ||
|
||||
!(trigger_name->str= strmake_root(&table->mem_root,
|
||||
orig_trigger_name->str,
|
||||
orig_trigger_name->length)))
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
trigger_name->length= orig_trigger_name->length;
|
||||
|
||||
if (triggers->names_list.push_back(trigger_name,
|
||||
&table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
The Table_triggers_list is not constructed as a list of
|
||||
trigger objects as one would expect, but rather of lists of
|
||||
properties of equal length. Thus, even if we don't get the
|
||||
trigger name, we still fill all in all the lists with
|
||||
placeholders as we might otherwise create a skew in the
|
||||
lists. Obviously, this has to be refactored.
|
||||
*/
|
||||
LEX_STRING *empty= alloc_lex_string(&table->mem_root);
|
||||
if (!empty)
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
empty->str= const_cast<char*>("");
|
||||
empty->length= 0;
|
||||
if (triggers->names_list.push_back(empty, &table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
}
|
||||
lex_end(&lex);
|
||||
continue;
|
||||
}
|
||||
|
||||
lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
|
||||
|
||||
int event= lex.trg_chistics.event;
|
||||
@ -1368,7 +1462,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
|
||||
if (triggers->names_list.push_back(&lex.sphead->m_name,
|
||||
&table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
if (!(on_table_name= alloc_lex_string(&table->mem_root)))
|
||||
goto err_with_lex_cleanup;
|
||||
@ -1394,9 +1488,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
char fname[NAME_LEN + 1];
|
||||
DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) ||
|
||||
(check_n_cut_mysql50_prefix(db, fname, sizeof(fname)) &&
|
||||
!my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))) &&
|
||||
(!my_strcasecmp(table_alias_charset, lex.query_tables->table_name,
|
||||
table_name) ||
|
||||
!my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))));
|
||||
DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, table_name) ||
|
||||
(check_n_cut_mysql50_prefix(table_name, fname, sizeof(fname)) &&
|
||||
!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, fname))));
|
||||
#endif
|
||||
@ -1680,6 +1773,13 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, char *db, char *name)
|
||||
|
||||
while ((trigger= it_name++))
|
||||
{
|
||||
/*
|
||||
Trigger, which body we failed to parse during call
|
||||
Table_triggers_list::check_n_load(), might be missing name.
|
||||
Such triggers have zero-length name and are skipped here.
|
||||
*/
|
||||
if (trigger->length == 0)
|
||||
continue;
|
||||
if (rm_trigname_file(path, db, trigger->str))
|
||||
{
|
||||
/*
|
||||
@ -1903,6 +2003,11 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
|
||||
}
|
||||
if (table.triggers)
|
||||
{
|
||||
if (table.triggers->check_for_broken_triggers())
|
||||
{
|
||||
result= 1;
|
||||
goto end;
|
||||
}
|
||||
LEX_STRING old_table_name= { (char *) old_table, strlen(old_table) };
|
||||
LEX_STRING new_table_name= { (char *) new_table, strlen(new_table) };
|
||||
/*
|
||||
@ -1991,6 +2096,9 @@ bool Table_triggers_list::process_triggers(THD *thd,
|
||||
sp_head *sp_trigger= bodies[event][time_type];
|
||||
SELECT_LEX *save_current_select;
|
||||
|
||||
if (check_for_broken_triggers())
|
||||
return true;
|
||||
|
||||
if (sp_trigger == NULL)
|
||||
return FALSE;
|
||||
|
||||
@ -2069,6 +2177,22 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Signals to the Table_triggers_list that a parse error has occured when
|
||||
reading a trigger from file. This makes the Table_triggers_list enter an
|
||||
error state flagged by m_has_unparseable_trigger == true. The error message
|
||||
will be used whenever a statement invoking or manipulating triggers is
|
||||
issued against the Table_triggers_list's table.
|
||||
|
||||
@param error_message The error message thrown by the parser.
|
||||
*/
|
||||
void Table_triggers_list::set_parse_error_message(char *error_message)
|
||||
{
|
||||
m_has_unparseable_trigger= true;
|
||||
strcpy(m_parse_error_message, error_message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Trigger BUG#14090 compatibility hook.
|
||||
|
||||
|
@ -62,6 +62,27 @@ class Table_triggers_list: public Sql_alloc
|
||||
*/
|
||||
GRANT_INFO subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX];
|
||||
|
||||
/**
|
||||
This flag indicates that one of the triggers was not parsed successfully,
|
||||
and as a precaution the object has entered a state where all trigger
|
||||
access results in errors until all such triggers are dropped. It is not
|
||||
safe to add triggers since we don't know if the broken trigger has the
|
||||
same name or event type. Nor is it safe to invoke any trigger for the
|
||||
aforementioned reasons. The only safe operations are drop_trigger and
|
||||
drop_all_triggers.
|
||||
|
||||
@see Table_triggers_list::set_parse_error
|
||||
*/
|
||||
bool m_has_unparseable_trigger;
|
||||
|
||||
/**
|
||||
This error will be displayed when the user tries to manipulate or invoke
|
||||
triggers on a table that has broken triggers. It will get set only once
|
||||
per statement and thus will contain the first parse error encountered in
|
||||
the trigger file.
|
||||
*/
|
||||
char m_parse_error_message[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
public:
|
||||
/**
|
||||
Field responsible for storing triggers definitions in file.
|
||||
@ -84,7 +105,7 @@ public:
|
||||
/* End of character ser context. */
|
||||
|
||||
Table_triggers_list(TABLE *table_arg):
|
||||
record1_field(0), trigger_table(table_arg)
|
||||
record1_field(0), trigger_table(table_arg), m_has_unparseable_trigger(false)
|
||||
{
|
||||
bzero((char *)bodies, sizeof(bodies));
|
||||
bzero((char *)trigger_fields, sizeof(trigger_fields));
|
||||
@ -140,6 +161,8 @@ public:
|
||||
|
||||
void mark_fields_used(trg_event_type event);
|
||||
|
||||
void set_parse_error_message(char *error_message);
|
||||
|
||||
friend class Item_trigger_field;
|
||||
friend int sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
|
||||
TABLE_LIST *table);
|
||||
@ -155,6 +178,16 @@ private:
|
||||
const char *new_db_name,
|
||||
LEX_STRING *old_table_name,
|
||||
LEX_STRING *new_table_name);
|
||||
|
||||
bool check_for_broken_triggers()
|
||||
{
|
||||
if (m_has_unparseable_trigger)
|
||||
{
|
||||
my_message(ER_PARSE_ERROR, m_parse_error_message, MYF(0));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
extern const LEX_STRING trg_action_time_type_names[];
|
||||
|
@ -2024,16 +2024,19 @@ opt_ev_status:
|
||||
| ENABLE_SYM
|
||||
{
|
||||
Lex->event_parse_data->status= Event_parse_data::ENABLED;
|
||||
Lex->event_parse_data->status_changed= true;
|
||||
$$= 1;
|
||||
}
|
||||
| DISABLE_SYM ON SLAVE
|
||||
{
|
||||
Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED;
|
||||
Lex->event_parse_data->status_changed= true;
|
||||
$$= 1;
|
||||
}
|
||||
| DISABLE_SYM
|
||||
{
|
||||
Lex->event_parse_data->status= Event_parse_data::DISABLED;
|
||||
Lex->event_parse_data->status_changed= true;
|
||||
$$= 1;
|
||||
}
|
||||
;
|
||||
|
@ -73,6 +73,13 @@ this many index pages */
|
||||
+ not_empty) \
|
||||
/ (BTR_KEY_VAL_ESTIMATE_N_PAGES + ext_size))
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
|
||||
/* A BLOB field reference full of zero, for use in assertions and tests.
|
||||
Initially, BLOB field references are set to zero, in
|
||||
dtuple_convert_big_rec(). */
|
||||
const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE];
|
||||
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
|
||||
|
||||
/***********************************************************************
|
||||
Marks all extern fields in a record as owned by the record. This function
|
||||
should be called if the delete mark of a record is removed: a not delete
|
||||
@ -1585,6 +1592,9 @@ btr_cur_optimistic_update(
|
||||
|
||||
heap = mem_heap_create(1024);
|
||||
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
if (btr_cur_print_record_ops && thr) {
|
||||
|
@ -18,4 +18,9 @@ typedef struct btr_pcur_struct btr_pcur_t;
|
||||
typedef struct btr_cur_struct btr_cur_t;
|
||||
typedef struct btr_search_struct btr_search_t;
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
|
||||
#define BTR_EXTERN_FIELD_REF_SIZE 20
|
||||
extern const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE];
|
||||
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
|
||||
|
||||
#endif
|
||||
|
@ -339,6 +339,19 @@ rec_offs_any_extern(
|
||||
/*================*/
|
||||
/* out: TRUE if a field is stored externally */
|
||||
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
/********************************************************
|
||||
Determine if the offsets are for a record containing null BLOB pointers. */
|
||||
UNIV_INLINE
|
||||
const byte*
|
||||
rec_offs_any_null_extern(
|
||||
/*=====================*/
|
||||
/* out: first field containing
|
||||
a null BLOB pointer,
|
||||
or NULL if none found */
|
||||
rec_t* rec, /*!< in: record */
|
||||
const ulint* offsets); /*!< in: rec_get_offsets(rec) */
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
/***************************************************************
|
||||
Sets the value of the ith field extern storage bit. */
|
||||
UNIV_INLINE
|
||||
|
@ -9,6 +9,7 @@ Created 5/30/1994 Heikki Tuuri
|
||||
#include "mach0data.h"
|
||||
#include "ut0byte.h"
|
||||
#include "dict0dict.h"
|
||||
#include "btr0types.h"
|
||||
|
||||
/* Compact flag ORed to the extra size returned by rec_get_offsets() */
|
||||
#define REC_OFFS_COMPACT ((ulint) 1 << 31)
|
||||
@ -1020,6 +1021,42 @@ rec_offs_any_extern(
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
/********************************************************
|
||||
Determine if the offsets are for a record containing null BLOB pointers. */
|
||||
UNIV_INLINE
|
||||
const byte*
|
||||
rec_offs_any_null_extern(
|
||||
/*=====================*/
|
||||
/* out: first field containing
|
||||
a null BLOB pointer,
|
||||
or NULL if none found */
|
||||
rec_t* rec, /*!< in: record */
|
||||
const ulint* offsets) /*!< in: rec_get_offsets(rec) */
|
||||
{
|
||||
ulint i;
|
||||
ut_ad(rec_offs_validate(rec, NULL, offsets));
|
||||
|
||||
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
|
||||
if (rec_offs_nth_extern(offsets, i)) {
|
||||
ulint len;
|
||||
const byte* field
|
||||
= rec_get_nth_field(rec, offsets, i, &len);
|
||||
|
||||
ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
|
||||
if (!memcmp(field + len
|
||||
- BTR_EXTERN_FIELD_REF_SIZE,
|
||||
field_ref_zero,
|
||||
BTR_EXTERN_FIELD_REF_SIZE)) {
|
||||
return(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
/***************************************************************
|
||||
Sets the value of the ith field extern storage bit. */
|
||||
UNIV_INLINE
|
||||
|
@ -88,6 +88,8 @@ memory is read outside the allocated blocks. */
|
||||
#if 0
|
||||
#define UNIV_DEBUG_VALGRIND /* Enable extra
|
||||
Valgrind instrumentation */
|
||||
#define UNIV_BLOB_NULL_DEBUG /* Enable deep off-page
|
||||
column debugging */
|
||||
#define UNIV_DEBUG /* Enable ut_ad() assertions */
|
||||
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
|
||||
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
|
||||
|
@ -210,6 +210,14 @@ row_build(
|
||||
ut_ad(rec_offs_validate(rec, index, offsets));
|
||||
}
|
||||
|
||||
#if 0 && defined UNIV_BLOB_NULL_DEBUG
|
||||
/* This one can fail in trx_rollback_or_clean_all_without_sess()
|
||||
if the server crashed during an insert before the
|
||||
btr_store_big_rec_extern_fields() did mtr_commit()
|
||||
all BLOB pointers to the clustered index record. */
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
#endif /* 0 && UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
if (type != ROW_COPY_POINTERS) {
|
||||
/* Take a copy of rec to heap */
|
||||
buf = mem_heap_alloc(heap, rec_offs_size(offsets));
|
||||
@ -302,6 +310,10 @@ row_rec_to_index_entry(
|
||||
rec = rec_copy(buf, rec, offsets);
|
||||
/* Avoid a debug assertion in rec_offs_validate(). */
|
||||
rec_offs_make_valid(rec, index, offsets);
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
} else {
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
}
|
||||
|
||||
rec_len = rec_offs_n_fields(offsets);
|
||||
|
@ -473,6 +473,11 @@ row_vers_build_for_consistent_read(
|
||||
/* The view already sees this version: we can
|
||||
copy it to in_heap and return */
|
||||
|
||||
#if defined UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(
|
||||
version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
buf = mem_heap_alloc(in_heap,
|
||||
rec_offs_size(*offsets));
|
||||
*old_vers = rec_copy(buf, version, *offsets);
|
||||
@ -506,6 +511,10 @@ row_vers_build_for_consistent_read(
|
||||
*offsets = rec_get_offsets(prev_version, index, *offsets,
|
||||
ULINT_UNDEFINED, offset_heap);
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(prev_version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
trx_id = row_get_rec_trx_id(prev_version, index, *offsets);
|
||||
|
||||
if (read_view_sees_trx_id(view, trx_id)) {
|
||||
@ -606,6 +615,10 @@ row_vers_build_for_semi_consistent_read(
|
||||
/* We found a version that belongs to a
|
||||
committed transaction: return it. */
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
if (rec == version) {
|
||||
*old_vers = rec;
|
||||
err = DB_SUCCESS;
|
||||
@ -663,6 +676,9 @@ row_vers_build_for_semi_consistent_read(
|
||||
version = prev_version;
|
||||
*offsets = rec_get_offsets(version, index, *offsets,
|
||||
ULINT_UNDEFINED, offset_heap);
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
}/* for (;;) */
|
||||
|
||||
if (heap) {
|
||||
|
@ -1397,6 +1397,10 @@ trx_undo_prev_version_build(
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
# ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
# endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
|
||||
ulint* ext_vect;
|
||||
ulint n_ext_vect;
|
||||
|
@ -3,6 +3,11 @@
|
||||
* row/row0row.c:
|
||||
Fix Bug#12429576 Assertion failure on purge of column prefix index
|
||||
|
||||
2011-06-09 The InnoDB Team
|
||||
* btr/btr0cur.c, include/rem0rec.h, include/rem0rec.ic,
|
||||
* row/row0row.c, row/row0vers.c, trx/trx0rec.c:
|
||||
Instrumentation for Bug#12612184 Race condition in row_upd_clust_rec()
|
||||
|
||||
2011-04-07 The InnoDB Team
|
||||
|
||||
* handler/ha_innodb.cc, handler/ha_innodb.h, handler/handler0alter.cc:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
@ -1871,6 +1871,9 @@ btr_cur_optimistic_update(
|
||||
|
||||
heap = mem_heap_create(1024);
|
||||
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
if (btr_cur_print_record_ops && thr) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -480,6 +480,18 @@ ulint
|
||||
rec_offs_any_extern(
|
||||
/*================*/
|
||||
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
/******************************************************//**
|
||||
Determine if the offsets are for a record containing null BLOB pointers.
|
||||
@return first field containing a null BLOB pointer, or NULL if none found */
|
||||
UNIV_INLINE
|
||||
const byte*
|
||||
rec_offs_any_null_extern(
|
||||
/*=====================*/
|
||||
const rec_t* rec, /*!< in: record */
|
||||
const ulint* offsets) /*!< in: rec_get_offsets(rec) */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
/******************************************************//**
|
||||
Returns nonzero if the extern bit is set in nth field of rec.
|
||||
@return nonzero if externally stored */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -26,6 +26,7 @@ Created 5/30/1994 Heikki Tuuri
|
||||
#include "mach0data.h"
|
||||
#include "ut0byte.h"
|
||||
#include "dict0dict.h"
|
||||
#include "btr0types.h"
|
||||
|
||||
/* Compact flag ORed to the extra size returned by rec_get_offsets() */
|
||||
#define REC_OFFS_COMPACT ((ulint) 1 << 31)
|
||||
@ -1087,6 +1088,44 @@ rec_offs_any_extern(
|
||||
return(UNIV_UNLIKELY(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL));
|
||||
}
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
/******************************************************//**
|
||||
Determine if the offsets are for a record containing null BLOB pointers.
|
||||
@return first field containing a null BLOB pointer, or NULL if none found */
|
||||
UNIV_INLINE
|
||||
const byte*
|
||||
rec_offs_any_null_extern(
|
||||
/*=====================*/
|
||||
const rec_t* rec, /*!< in: record */
|
||||
const ulint* offsets) /*!< in: rec_get_offsets(rec) */
|
||||
{
|
||||
ulint i;
|
||||
ut_ad(rec_offs_validate(rec, NULL, offsets));
|
||||
|
||||
if (!rec_offs_any_extern(offsets)) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
|
||||
if (rec_offs_nth_extern(offsets, i)) {
|
||||
ulint len;
|
||||
const byte* field
|
||||
= rec_get_nth_field(rec, offsets, i, &len);
|
||||
|
||||
ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
|
||||
if (!memcmp(field + len
|
||||
- BTR_EXTERN_FIELD_REF_SIZE,
|
||||
field_ref_zero,
|
||||
BTR_EXTERN_FIELD_REF_SIZE)) {
|
||||
return(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
/******************************************************//**
|
||||
Returns nonzero if the extern bit is set in nth field of rec.
|
||||
@return nonzero if externally stored */
|
||||
|
@ -179,6 +179,8 @@ command. Not tested on Windows. */
|
||||
debugging without UNIV_DEBUG */
|
||||
#define UNIV_BLOB_LIGHT_DEBUG /* Enable off-page column
|
||||
debugging without UNIV_DEBUG */
|
||||
#define UNIV_BLOB_NULL_DEBUG /* Enable deep off-page
|
||||
column debugging */
|
||||
#define UNIV_DEBUG /* Enable ut_ad() assertions
|
||||
and disable UNIV_INLINE */
|
||||
#define UNIV_DEBUG_LOCK_VALIDATE /* Enable
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -229,6 +229,14 @@ row_build(
|
||||
ut_ad(rec_offs_validate(rec, index, offsets));
|
||||
}
|
||||
|
||||
#if 0 && defined UNIV_BLOB_NULL_DEBUG
|
||||
/* This one can fail in trx_rollback_active() if
|
||||
the server crashed during an insert before the
|
||||
btr_store_big_rec_extern_fields() did mtr_commit()
|
||||
all BLOB pointers to the clustered index record. */
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
#endif /* 0 && UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
if (type != ROW_COPY_POINTERS) {
|
||||
/* Take a copy of rec to heap */
|
||||
buf = mem_heap_alloc(heap, rec_offs_size(offsets));
|
||||
@ -413,6 +421,10 @@ row_rec_to_index_entry(
|
||||
rec = rec_copy(buf, rec, offsets);
|
||||
/* Avoid a debug assertion in rec_offs_validate(). */
|
||||
rec_offs_make_valid(rec, index, offsets);
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
} else {
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
}
|
||||
|
||||
entry = row_rec_to_index_entry_low(rec, index, offsets, n_ext, heap);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -550,6 +550,11 @@ row_vers_build_for_consistent_read(
|
||||
/* The view already sees this version: we can
|
||||
copy it to in_heap and return */
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(
|
||||
version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
buf = mem_heap_alloc(in_heap,
|
||||
rec_offs_size(*offsets));
|
||||
*old_vers = rec_copy(buf, version, *offsets);
|
||||
@ -583,6 +588,10 @@ row_vers_build_for_consistent_read(
|
||||
*offsets = rec_get_offsets(prev_version, index, *offsets,
|
||||
ULINT_UNDEFINED, offset_heap);
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(prev_version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
trx_id = row_get_rec_trx_id(prev_version, index, *offsets);
|
||||
|
||||
if (read_view_sees_trx_id(view, trx_id)) {
|
||||
@ -682,6 +691,10 @@ row_vers_build_for_semi_consistent_read(
|
||||
/* We found a version that belongs to a
|
||||
committed transaction: return it. */
|
||||
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
if (rec == version) {
|
||||
*old_vers = rec;
|
||||
err = DB_SUCCESS;
|
||||
@ -739,6 +752,9 @@ row_vers_build_for_semi_consistent_read(
|
||||
version = prev_version;
|
||||
*offsets = rec_get_offsets(version, index, *offsets,
|
||||
ULINT_UNDEFINED, offset_heap);
|
||||
#ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(version, *offsets));
|
||||
#endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
}/* for (;;) */
|
||||
|
||||
if (heap) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -1577,6 +1577,10 @@ trx_undo_prev_version_build(
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
# ifdef UNIV_BLOB_NULL_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets));
|
||||
# endif /* UNIV_BLOB_NULL_DEBUG */
|
||||
|
||||
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
|
||||
ulint n_ext;
|
||||
|
||||
|
@ -1986,8 +1986,6 @@ trx_undo_free_prepared(
|
||||
/*===================*/
|
||||
trx_t* trx) /*!< in/out: PREPARED transaction */
|
||||
{
|
||||
mutex_enter(&trx->rseg->mutex);
|
||||
|
||||
ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
|
||||
|
||||
if (trx->update_undo) {
|
||||
@ -2002,6 +2000,5 @@ trx_undo_free_prepared(
|
||||
trx->insert_undo);
|
||||
trx_undo_mem_free(trx->insert_undo);
|
||||
}
|
||||
mutex_exit(&trx->rseg->mutex);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
@ -193,8 +193,8 @@ err:
|
||||
save_errno=my_errno;
|
||||
if (changed)
|
||||
key_changed|= HA_STATE_CHANGED;
|
||||
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM ||
|
||||
my_errno == HA_ERR_RECORD_FILE_FULL)
|
||||
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL ||
|
||||
my_errno == HA_ERR_NULL_IN_SPATIAL || my_errno == HA_ERR_OUT_OF_MEM)
|
||||
{
|
||||
info->errkey= (int) i;
|
||||
flag=0;
|
||||
@ -212,8 +212,9 @@ err:
|
||||
{
|
||||
uint new_length=_mi_make_key(info,i,new_key,newrec,pos);
|
||||
uint old_length= _mi_make_key(info,i,old_key,oldrec,pos);
|
||||
if ((flag++ && _mi_ck_delete(info,i,new_key,new_length)) ||
|
||||
_mi_ck_write(info,i,old_key,old_length))
|
||||
if ((flag++ &&
|
||||
share->keyinfo[i].ck_delete(info, i, new_key, new_length)) ||
|
||||
share->keyinfo[i].ck_insert(info, i, old_key, old_length))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ err:
|
||||
else
|
||||
{
|
||||
uint key_length=_mi_make_key(info,i,buff,record,filepos);
|
||||
if (_mi_ck_delete(info,i,buff,key_length))
|
||||
if (share->keyinfo[i].ck_delete(info, i, buff, key_length))
|
||||
{
|
||||
if (local_lock_tree)
|
||||
rw_unlock(&share->key_root_lock[i]);
|
||||
|
Reference in New Issue
Block a user