Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.

This commit is contained in:
Alexey Kopytov 2010-02-22 00:33:11 +03:00
commit 8c31c4d16c
73 changed files with 1355 additions and 448 deletions

View File

@ -219,6 +219,19 @@ connect (conn2,localhost,root,,*NO-ONE*);
-- echo ### assertion: works without stating the default database
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-- eval $UPPER_STMT_HEAD LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE $db1.t1
# We cannot disconnect right away because when inserting
# concurrently in a MyISAM table, the server is sending an OK
# to the client before updating the table state (where the
# number of records is kept). See: BUG#37521 and BUG#29334.
# So we need to wait, otherwise we would be having sporadic
# failures as reported here: BUG#50451.
# 12 = 3 rows per each LOAD DATA executed x 4
-- let $count= 12
-- let $table= $db1.t1
--source include/wait_until_rows_count.inc
-- echo ### disconnect and switch back to master connection
-- disconnect conn2
-- connection master

View File

@ -0,0 +1,4 @@
if (`SELECT @@binlog_format = 'ROW'`)
{
skip Test cannot run with binlog_format row;
}

View File

@ -12728,3 +12728,12 @@ Table Op Msg_type Msg_text
test.t1 repair Error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
test.t1 repair error Corrupt
DROP TABLE t1;
#
# BUG#48757 - missing .ARZ file causes server crash
#
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
FLUSH TABLE t1;
SELECT * FROM t1;
ERROR HY000: Can't find file: 't1' (errno: 2)
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'

View File

@ -4,23 +4,23 @@ create table t4(n int);
backup table t4 to '../../bogus';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
test.t4 backup status Operation failed
backup table t4 to '../../tmp';
Table Op Msg_type Msg_text
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup status OK
backup table t4 to '../../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
test.t4 backup status Operation failed
drop table t4;
restore table t4 from '../../tmp';
Table Op Msg_type Msg_text
test.t4 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 restore status OK
select count(*) from t4;
count(*)
@ -29,18 +29,18 @@ create table t1(n int);
insert into t1 values (23),(45),(67);
backup table t1 to '../../tmp';
Table Op Msg_type Msg_text
test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 backup status OK
drop table t1;
restore table t1 from '../../bogus';
Table Op Msg_type Msg_text
t1 restore error Failed copying .frm file
Warnings:
Warning 1287 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
Warning 1287 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
restore table t1 from '../../tmp';
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
select n from t1;
n
@ -53,13 +53,13 @@ insert into t2 values (123),(145),(167);
insert into t3 values (223),(245),(267);
backup table t2,t3 to '../../tmp';
Table Op Msg_type Msg_text
test.t2 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t2 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t2 backup status OK
test.t3 backup status OK
drop table t1,t2,t3;
restore table t1,t2,t3 from '../../tmp';
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
test.t2 restore status OK
test.t3 restore status OK
@ -81,14 +81,14 @@ k
drop table t1,t2,t3,t4;
restore table t1 from '../../tmp';
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
rename table t1 to t5;
lock tables t5 write;
backup table t5 to '../../tmp';
unlock tables;
Table Op Msg_type Msg_text
test.t5 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t5 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t5 backup status OK
drop table t5;
DROP TABLE IF EXISTS `t+1`;
@ -96,12 +96,12 @@ CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
BACKUP TABLE `t+1` TO '../../tmp';
Table Op Msg_type Msg_text
test.t+1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 backup status OK
DROP TABLE `t+1`;
RESTORE TABLE `t+1` FROM '../../tmp';
Table Op Msg_type Msg_text
test.t+1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 restore status OK
SELECT * FROM `t+1`;
c1

View File

@ -28,5 +28,5 @@ SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# in thread2
d
# in default
# in thread1;
DROP TABLE t1,t2;

View File

@ -5394,17 +5394,24 @@ select * from t1;
ERROR HY000: File 'MYSQLD_DATADIR/test/t1.CSV' not found (Errcode: 2)
unlock tables;
drop table t1;
create table t1(a enum ('a') not null) engine=csv;
insert into t1 values (2);
CREATE TABLE t1 (e enum('foo','bar') NOT NULL) ENGINE = CSV;
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES(default);
INSERT INTO t1 VALUES(0);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
select * from t1 limit 1;
ERROR HY000: Table 't1' is marked as crashed and should be repaired
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair Warning Data truncated for column 'a' at row 1
test.t1 repair status OK
select * from t1 limit 1;
a
drop table t1;
Warning 1265 Data truncated for column 'e' at row 1
INSERT INTO t1 VALUES(3);
Warnings:
Warning 1265 Data truncated for column 'e' at row 1
INSERT INTO t1 VALUES(-1);
Warnings:
Warning 1265 Data truncated for column 'e' at row 1
SELECT * FROM t1;
e
foo
foo
DROP TABLE t1;
End of 5.1 tests

View File

@ -180,7 +180,6 @@ insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:0
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'e' doesn't have a default value
@ -193,7 +192,7 @@ a b c d e f g h i x
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
drop table bug20691;
create table t1 (id int not null);
insert into t1 values(default);

View File

@ -611,6 +611,26 @@ WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
count(*)
0
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a));
INSERT INTO t1 VALUES
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
('awrd');
SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
COUNT(*)
0
DROP TABLE t1;
#
# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with
# fulltext search and row op

View File

@ -682,7 +682,7 @@ select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_FRAC_SECOND, 1, date)
2003-01-02 00:00:00.000001
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
a
3
@ -717,7 +717,7 @@ select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05
a
7689538999999
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
@ -1088,7 +1088,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2`
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
@ -1287,12 +1287,12 @@ SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18');
TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18')
2008-02-18 00:00:00.000001
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18');
TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18')
86400000000
Warnings:
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 5.6. Please use MICROSECOND instead
Warning 1287 'FRAC_SECOND' is deprecated and will be removed in a future release. Please use MICROSECOND instead
SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND);
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 'FRAC_SECOND)' at line 1
SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND);

View File

@ -2524,6 +2524,19 @@ SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
a MAX(b)
2 1
DROP TABLE t;
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b));
INSERT INTO t1 VALUES(1,1),(2,1);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
c b
1 1
SELECT a FROM t1 WHERE b=1;
a
1
2
DROP TABLE t1;
End of 5.1 tests
#
# WL#3220 (Loose index scan for COUNT DISTINCT)

View File

@ -1128,3 +1128,20 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1, t2;
CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('1',null),(null,null);
INSERT INTO t2 VALUES ('1',null),(null,null);
CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a))
ENGINE=MERGE UNION=(t1,t2);
SELECT t1.a FROM mm1,t1;
a
NULL
1
NULL
1
NULL
1
NULL
1
DROP TABLE t1, t2, mm1;

View File

@ -51,7 +51,7 @@ DROP TABLE t1;
#
SET lc_messages=sr_YU;
Warnings:
Warning 1287 'sr_YU' is deprecated; use 'sr_RS' instead
Warning 1287 'sr_YU' is deprecated and will be removed in a future release. Please use sr_RS instead
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages sr_RS

View File

@ -199,7 +199,7 @@ SELECT @@general_log, @@log;
1 1
SET GLOBAL log = 0;
Warnings:
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
SHOW VARIABLES LIKE 'general_log';
Variable_name Value
general_log OFF
@ -230,7 +230,7 @@ SELECT @@slow_query_log, @@log_slow_queries;
0 0
SET GLOBAL log_slow_queries = 0;
Warnings:
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
SHOW VARIABLES LIKE 'slow_query_log';
Variable_name Value
slow_query_log OFF
@ -283,16 +283,16 @@ SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
deprecated:
SET GLOBAL log = 0;
Warnings:
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
SET GLOBAL log_slow_queries = 0;
Warnings:
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
SET GLOBAL log = DEFAULT;
Warnings:
Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
Warning 1287 '@@log' is deprecated and will be removed in a future release. Please use '@@general_log' instead
SET GLOBAL log_slow_queries = DEFAULT;
Warnings:
Warning 1287 The syntax '@@log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '@@slow_query_log' instead
Warning 1287 '@@log_slow_queries' is deprecated and will be removed in a future release. Please use '@@slow_query_log' instead
not deprecated:
SELECT @@global.general_log_file INTO @my_glf;
SELECT @@global.slow_query_log_file INTO @my_sqlf;

View File

@ -634,4 +634,15 @@ select count(*) from t3 /* must be 1 */;
count(*)
1
drop table t1, t2, t3;
#
# Bug#49534: multitable IGNORE update with sql_safe_updates error
# causes debug assertion
#
CREATE TABLE t1( a INT, KEY( a ) );
INSERT INTO t1 VALUES (1), (2), (3);
SET SESSION sql_safe_updates = 1;
# Must not cause failed assertion
UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1;
ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
DROP TABLE t1;
end of tests

View File

@ -1868,6 +1868,19 @@ CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 467455460
DROP TABLE t1;
#
# BUG#48438 - crash with error in unioned query against merge table and view...
#
SET GLOBAL table_open_cache=3;
CREATE TABLE t1(a INT);
SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
1
SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
TABLE_ROWS DATA_LENGTH
0 0
DROP TABLE t1;
SET GLOBAL table_open_cache=DEFAULT;
End of 5.0 tests
create table t1 (a int not null, key `a` (a) key_block_size=1024);
show create table t1;
@ -2313,4 +2326,17 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
#
# BUG#49628 - corrupt table after legal SQL, LONGTEXT column
#
CREATE TABLE t1(a INT, b LONGTEXT, UNIQUE(a));
REPLACE INTO t1 VALUES
(1, REPEAT('a', 129015)),(1, NULL),
(2, NULL),(3, NULL),(4, NULL),(5, NULL),(6, NULL),(7, NULL),
(1, REPEAT('b', 129016)),(1, NULL),
(1, REPEAT('c', 129015)),(1, REPEAT('d', 129015));
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
End of 5.1 tests

View File

@ -0,0 +1,57 @@
DROP TABLE IF EXISTS t1, t2;
SET DEBUG_SYNC= 'RESET';
#
# Bug#42438: Crash ha_partition::change_table_ptr
# Test when remove partitioning is done while drop table is waiting
# for the table.
# Con 1
SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1
(a INTEGER,
b INTEGER NOT NULL,
KEY (b))
ENGINE = MYISAM
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (2),
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed';
ALTER TABLE t1 REMOVE PARTITIONING;
# Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
DROP TABLE IF EXISTS t1;
# Con 1
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
#
# Bug#42438: Crash ha_partition::change_table_ptr
# Test when remove partitioning is failing due to drop table is already
# in progress.
CREATE TABLE t2
(a INTEGER,
b INTEGER NOT NULL,
KEY (b))
ENGINE = MYISAM
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (2),
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
# Con 1
ERROR 42S02: Table 'test.t2' doesn't exist
SET DEBUG_SYNC= 'RESET';
# Con default
SET DEBUG_SYNC= 'RESET';
End of 5.1 tests

View File

@ -1294,7 +1294,7 @@ drop database mysqltest;
show full plugin;
show warnings;
Level Code Message
Warning 1287 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL 6.0. Please use 'SHOW PLUGINS' instead
Warning 1287 'SHOW PLUGIN' is deprecated and will be removed in a future release. Please use 'SHOW PLUGINS' instead
show plugin;
show plugins;
create database `mysqlttest\1`;

View File

@ -44,4 +44,33 @@ SELECT f2 ();
f2 ()
NULL
DROP SCHEMA testdb;
USE test;
#
# Bug#50423: Crash on second call of a procedure dropping a trigger
#
DROP TABLE IF EXISTS t1;
DROP TRIGGER IF EXISTS tr1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1 (f1 INTEGER);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
CALL p1 ();
CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
#
# Bug#50423: Crash on second call of a procedure dropping a trigger
#
DROP TABLE IF EXISTS t1;
DROP TRIGGER IF EXISTS tr1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1 (f1 INTEGER);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
CALL p1 ();
CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
End of 5.1 tests

View File

@ -1643,7 +1643,7 @@ create table t1 (a int) type=MyISAM;
drop table t1;
end|
Warnings:
Warning 1287 The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 6.0. Please use 'ENGINE=storage_engine' instead
Warning 1287 'TYPE=storage_engine' is deprecated and will be removed in a future release. Please use 'ENGINE=storage_engine' instead
call p1();
call p1();
drop procedure p1;

View File

@ -4279,10 +4279,10 @@ call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
Table Op Msg_type Msg_text
test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 backup status OK
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 6.0. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
drop procedure bug13012|
create view v1 as select * from t1|

View File

@ -535,7 +535,7 @@ use db_bug7787|
CREATE PROCEDURE p1()
SHOW INNODB STATUS; |
Warnings:
Warning 1287 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 6.0. Please use 'SHOW ENGINE INNODB STATUS' instead
Warning 1287 'SHOW INNODB STATUS' is deprecated and will be removed in a future release. Please use 'SHOW ENGINE INNODB STATUS' instead
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
DROP DATABASE db_bug7787|
drop user user_bug7787@localhost|

View File

@ -785,4 +785,19 @@ t1 CREATE TABLE `t1` (
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key'
#
CREATE TABLE t1(a INT, b BIT(7) NOT NULL);
INSERT INTO t1 VALUES (NULL, 0),(NULL, 0);
SELECT SUM(a) FROM t1 GROUP BY b, a;
SUM(a)
NULL
DROP TABLE t1;
CREATE TABLE t1(a INT, b BIT(7) NOT NULL, c BIT(8) NOT NULL);
INSERT INTO t1 VALUES (NULL, 0, 0),(NULL, 0, 0);
SELECT SUM(a) FROM t1 GROUP BY c, b, a;
SUM(a)
NULL
DROP TABLE t1;
End of 5.1 tests

View File

@ -891,11 +891,11 @@ CREATE TABLE b15776 (a year(-2));
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 '-2))' at line 1
CREATE TABLE b15776 (a timestamp(4294967294));
Warnings:
Warning 1287 The syntax 'TIMESTAMP(4294967294)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(4294967294)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
DROP TABLE b15776;
CREATE TABLE b15776 (a timestamp(4294967295));
Warnings:
Warning 1287 The syntax 'TIMESTAMP(4294967295)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(4294967295)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
DROP TABLE b15776;
CREATE TABLE b15776 (a timestamp(4294967296));
ERROR 42000: Display width out of range for column 'a' (max = 4294967295)

View File

@ -101,13 +101,13 @@ create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
Warnings:
Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(2)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(4)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(6)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(8)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(10)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(12)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(14)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
insert t1 values (0,0,0,0,0,0,0),
("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",

View File

@ -3955,6 +3955,36 @@ CREATE VIEW v1 AS SELECT a FROM t1;
ALTER TABLE v1;
DROP VIEW v1;
DROP TABLE t1;
#
# Bug#48449: hang on show create view after upgrading when
# view contains function of view
#
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2;
DROP FUNCTION IF EXISTS f1;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE FUNCTION f1() RETURNS INT
BEGIN
SELECT a FROM v2 INTO @a;
RETURN @a;
END//
# Trigger pre-locking when opening v2.
CREATE VIEW v1 AS SELECT f1() FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `f1`() AS `f1()` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1599 View `test`.`v2` has no creation context
DROP VIEW v1,v2;
DROP TABLE t1,t2;
DROP FUNCTION f1;
CREATE TABLE t1(f1 INT);
INSERT INTO t1 VALUES ();
CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE
ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------

View File

@ -1237,3 +1237,14 @@ SELECT a FROM v2;
a
DROP USER mysqluser1;
DROP DATABASE mysqltest1;
USE test;
#
# Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer
#
DROP VIEW IF EXISTS v1;
CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1;
Warnings:
Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist
LOCK TABLES v1 READ;
ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist
DROP VIEW v1;

View File

@ -168,7 +168,7 @@ max_error_count 10
drop table t1;
set table_type=MYISAM;
Warnings:
Warning 1287 The syntax '@@table_type' is deprecated and will be removed in MySQL 6.0. Please use '@@storage_engine' instead
Warning 1287 '@@table_type' is deprecated and will be removed in a future release. Please use '@@storage_engine' instead
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
update t1 set a='abc';

View File

@ -0,0 +1,12 @@
TYPE=VIEW
query=select `test`.`t2`.`a` AS `a` from `test`.`t2`
md5=5e6eaf216e7b016fcedfd4e1113517af
updatable=1
algorithm=0
definer_user=root
definer_host=localhost
suid=2
with_check_option=0
timestamp=2010-01-01 15:00:00
create-version=1
source=select * from t2

View File

@ -195,7 +195,7 @@ set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators
set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_routine_creators=1;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
Warning 1287 '@@log_bin_trust_routine_creators' is deprecated and will be removed in a future release. Please use '@@log_bin_trust_function_creators' instead
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
@ -559,11 +559,11 @@ end
master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`()
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
Warning 1287 '@@log_bin_trust_routine_creators' is deprecated and will be removed in a future release. Please use '@@log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
Warning 1287 '@@log_bin_trust_routine_creators' is deprecated and will be removed in a future release. Please use '@@log_bin_trust_function_creators' instead
set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;

View File

@ -20,5 +20,21 @@ sleep(2)
SELECT count(*) > 0 FROM mysql.slow_log;
count(*) > 0
1
'Bug#47905 stored procedures not logged correctly to slow query log'
TRUNCATE mysql.slow_log;
CREATE PROCEDURE p_test()
BEGIN
select sleep(2);
select 1;
END//
CALL p_test();
sleep(2)
0
1
1
SELECT count(*) > 0 FROM mysql.slow_log;
count(*) > 0
1
DROP PROCEDURE p_test;
SET @@global.log_output = @global_log_output;
SET @global.slow_query_log = @global_slow_query_log;

View File

@ -31,6 +31,27 @@ SELECT sleep(2);
SELECT count(*) > 0 FROM mysql.slow_log;
#==========================================================================
--echo 'Bug#47905 stored procedures not logged correctly to slow query log'
#==========================================================================
# assumes logging to table turned on with long_query_time=1 as above
TRUNCATE mysql.slow_log;
DELIMITER //;
CREATE PROCEDURE p_test()
BEGIN
select sleep(2);
select 1;
END//
DELIMITER ;//
CALL p_test();
SELECT count(*) > 0 FROM mysql.slow_log;
DROP PROCEDURE p_test;
#restore
SET @@global.log_output = @global_log_output;
SET @global.slow_query_log = @global_slow_query_log;

View File

@ -1644,3 +1644,14 @@ INSERT INTO t1 (col1, col2) VALUES (1, "value");
REPAIR TABLE t1;
DROP TABLE t1;
remove_file $MYSQLD_DATADIR/test/t1.ARM;
--echo #
--echo # BUG#48757 - missing .ARZ file causes server crash
--echo #
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
FLUSH TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.ARZ
--error ER_FILE_NOT_FOUND
SELECT * FROM t1;
--error ER_BAD_TABLE_ERROR
DROP TABLE t1;

View File

@ -1,5 +1,6 @@
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
-- source include/not_binlog_format_row.inc
--echo #
--echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees
@ -49,10 +50,14 @@ connection thread2;
--echo # in thread2
REAP;
connection default;
--echo # in default
disconnect thread1;
disconnect thread2;
--source include/wait_until_disconnected.inc
connection thread1;
--echo # in thread1;
disconnect thread1;
--source include/wait_until_disconnected.inc
connection default;
DROP TABLE t1,t2;

View File

@ -1807,16 +1807,16 @@ unlock tables;
drop table t1;
#
# Bug#41441 repair csv table crashes debug server
# Bug#33717 INSERT...(default) fails for enum. Crashes CSV tables, loads spaces for MyISAM
#
# Note: The test should be removed after Bug#33717 is fixed
CREATE TABLE t1 (e enum('foo','bar') NOT NULL) ENGINE = CSV;
INSERT INTO t1 VALUES();
INSERT INTO t1 VALUES(default);
INSERT INTO t1 VALUES(0);
INSERT INTO t1 VALUES(3);
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
DROP TABLE t1;
create table t1(a enum ('a') not null) engine=csv;
insert into t1 values (2);
--error ER_CRASHED_ON_USAGE
select * from t1 limit 1;
repair table t1;
select * from t1 limit 1;
drop table t1;
--echo End of 5.1 tests

View File

@ -553,6 +553,27 @@ SELECT count(*) FROM t1 WHERE
DROP TABLE t1,t2,t3;
#
# BUG#50351 - ft_min_word_len=2 Causes query to hang
#
CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a));
INSERT INTO t1 VALUES
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
('awrd');
SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
DROP TABLE t1;
--echo #
--echo # Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with

View File

@ -1044,6 +1044,16 @@ SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
DROP TABLE t;
#
# BUG#49902 - SELECT returns incorrect results
#
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b));
INSERT INTO t1 VALUES(1,1),(2,1);
ANALYZE TABLE t1;
SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
SELECT a FROM t1 WHERE b=1;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@ -804,3 +804,15 @@ DEALLOCATE PREPARE stmt;
DROP VIEW v1;
DROP TABLE t1, t2;
#
# Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache()
#
CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('1',null),(null,null);
INSERT INTO t2 VALUES ('1',null),(null,null);
CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a))
ENGINE=MERGE UNION=(t1,t2);
SELECT t1.a FROM mm1,t1;
DROP TABLE t1, t2, mm1;

View File

@ -637,5 +637,17 @@ drop table t1, t2, t3;
# Add further tests from here
#
--echo #
--echo # Bug#49534: multitable IGNORE update with sql_safe_updates error
--echo # causes debug assertion
--echo #
CREATE TABLE t1( a INT, KEY( a ) );
INSERT INTO t1 VALUES (1), (2), (3);
SET SESSION sql_safe_updates = 1;
--echo # Must not cause failed assertion
--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1;
DROP TABLE t1;
--echo end of tests

View File

@ -1198,6 +1198,17 @@ CHECKSUM TABLE t1 EXTENDED;
DROP TABLE t1;
--echo #
--echo # BUG#48438 - crash with error in unioned query against merge table and view...
--echo #
SET GLOBAL table_open_cache=3;
CREATE TABLE t1(a INT);
SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DROP TABLE t1;
SET GLOBAL table_open_cache=DEFAULT;
--echo End of 5.0 tests
@ -1563,5 +1574,18 @@ SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
CHECK TABLE t1;
DROP TABLE t1;
--echo #
--echo # BUG#49628 - corrupt table after legal SQL, LONGTEXT column
--echo #
CREATE TABLE t1(a INT, b LONGTEXT, UNIQUE(a));
REPLACE INTO t1 VALUES
(1, REPEAT('a', 129015)),(1, NULL),
(2, NULL),(3, NULL),(4, NULL),(5, NULL),(6, NULL),(7, NULL),
(1, REPEAT('b', 129016)),(1, NULL),
(1, REPEAT('c', 129015)),(1, REPEAT('d', 129015));
CHECK TABLE t1;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@ -0,0 +1,81 @@
#--disable_abort_on_error
#
# Test for the partition storage engine which require DEBUG_SYNC feature to
# Created by Mattias Jonsson
#
--source include/have_partition.inc
--source include/have_debug_sync.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
SET DEBUG_SYNC= 'RESET';
--enable_warnings
--echo #
--echo # Bug#42438: Crash ha_partition::change_table_ptr
--echo # Test when remove partitioning is done while drop table is waiting
--echo # for the table.
connect(con1, localhost, root,,);
--echo # Con 1
SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1
(a INTEGER,
b INTEGER NOT NULL,
KEY (b))
ENGINE = MYISAM
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (2),
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL partitioning_removed';
--send ALTER TABLE t1 REMOVE PARTITIONING
connection default;
--echo # Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_part2_before_delete_table WAIT_FOR partitioning_removed';
DROP TABLE IF EXISTS t1;
--echo # Con 1
connection con1;
--reap
connection default;
SET DEBUG_SYNC= 'RESET';
connection con1;
SET DEBUG_SYNC= 'RESET';
--echo #
--echo # Bug#42438: Crash ha_partition::change_table_ptr
--echo # Test when remove partitioning is failing due to drop table is already
--echo # in progress.
CREATE TABLE t2
(a INTEGER,
b INTEGER NOT NULL,
KEY (b))
ENGINE = MYISAM
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (2),
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
SET DEBUG_SYNC= 'before_lock_tables_takes_lock SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
--send ALTER TABLE t2 REMOVE PARTITIONING
connection default;
--echo # Con default
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
SET DEBUG_SYNC= 'waiting_for_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_part2_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
--echo # Con 1
connection con1;
--error ER_NO_SUCH_TABLE
--reap
SET DEBUG_SYNC= 'RESET';
disconnect con1;
connection default;
--echo # Con default
SET DEBUG_SYNC= 'RESET';
--echo End of 5.1 tests

View File

@ -57,5 +57,48 @@ SELECT f2 ();
DROP SCHEMA testdb;
USE test;
--echo #
--echo # Bug#50423: Crash on second call of a procedure dropping a trigger
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TRIGGER IF EXISTS tr1;
DROP PROCEDURE IF EXISTS p1;
--enable_warnings
CREATE TABLE t1 (f1 INTEGER);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
CALL p1 ();
--error ER_TRG_DOES_NOT_EXIST
CALL p1 ();
DROP TABLE t1;
DROP PROCEDURE p1;
--echo #
--echo # Bug#50423: Crash on second call of a procedure dropping a trigger
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TRIGGER IF EXISTS tr1;
DROP PROCEDURE IF EXISTS p1;
--enable_warnings
CREATE TABLE t1 (f1 INTEGER);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
CREATE PROCEDURE p1 () DROP TRIGGER tr1;
CALL p1 ();
--error ER_TRG_DOES_NOT_EXIST
CALL p1 ();
DROP TABLE t1;
DROP PROCEDURE p1;
--echo End of 5.1 tests

View File

@ -425,4 +425,17 @@ select hex(a) from t1;
show create table t1;
drop table t1;
--echo #
--echo # Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key'
--echo #
CREATE TABLE t1(a INT, b BIT(7) NOT NULL);
INSERT INTO t1 VALUES (NULL, 0),(NULL, 0);
SELECT SUM(a) FROM t1 GROUP BY b, a;
DROP TABLE t1;
CREATE TABLE t1(a INT, b BIT(7) NOT NULL, c BIT(8) NOT NULL);
INSERT INTO t1 VALUES (NULL, 0, 0),(NULL, 0, 0);
SELECT SUM(a) FROM t1 GROUP BY c, b, a;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@ -3901,6 +3901,52 @@ ALTER TABLE v1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # Bug#48449: hang on show create view after upgrading when
--echo # view contains function of view
--echo #
--disable_warnings
DROP VIEW IF EXISTS v1,v2;
DROP TABLE IF EXISTS t1,t2;
DROP FUNCTION IF EXISTS f1;
--enable_warnings
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
delimiter //;
CREATE FUNCTION f1() RETURNS INT
BEGIN
SELECT a FROM v2 INTO @a;
RETURN @a;
END//
delimiter ;//
--echo # Trigger pre-locking when opening v2.
CREATE VIEW v1 AS SELECT f1() FROM t1;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
copy_file std_data/bug48449.frm $MYSQLD_DATADIR/test/v2.frm;
SHOW CREATE VIEW v1;
DROP VIEW v1,v2;
DROP TABLE t1,t2;
DROP FUNCTION f1;
#
# Bug#48294 assertion when creating a view based on some row() construct in select query
#
CREATE TABLE t1(f1 INT);
INSERT INTO t1 VALUES ();
CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE
ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.

View File

@ -1532,3 +1532,17 @@ SELECT a FROM v2;
--disconnect mysqluser1
DROP USER mysqluser1;
DROP DATABASE mysqltest1;
USE test;
--echo #
--echo # Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer
--echo #
--disable_warnings
DROP VIEW IF EXISTS v1;
--enable_warnings
CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1;
--error ER_NO_SUCH_USER
LOCK TABLES v1 READ;
DROP VIEW v1;

View File

@ -1738,11 +1738,10 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
uint store_length;
copy->str=ptr;
copy->length=pack_length();
copy->blob_field=0;
copy->field= this;
if (flags & BLOB_FLAG)
{
copy->blob_field=(Field_blob*) this;
copy->strip=0;
copy->type= CACHE_BLOB;
copy->length-= table->s->blob_ptr_size;
return copy->length;
}
@ -1750,15 +1749,15 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
(type() == MYSQL_TYPE_STRING && copy->length >= 4 &&
copy->length < 256))
{
copy->strip=1; /* Remove end space */
copy->type= CACHE_STRIPPED;
store_length= 2;
}
else
{
copy->strip=0;
copy->type= 0;
store_length= 0;
}
return copy->length+ store_length;
return copy->length + store_length;
}

View File

@ -1803,13 +1803,23 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share)
{
handler **file_array= m_file;
handler **file_array;
table= table_arg;
table_share= share;
do
/*
m_file can be NULL when using an old cached table in DROP TABLE, when the
table just has REMOVED PARTITIONING, see Bug#42438
*/
if (m_file)
{
(*file_array)->change_table_ptr(table_arg, share);
} while (*(++file_array));
file_array= m_file;
DBUG_ASSERT(*file_array);
do
{
(*file_array)->change_table_ptr(table_arg, share);
} while (*(++file_array));
}
if (m_added_file && m_added_file[0])
{
/* if in middle of a drop/rename etc */
@ -6207,7 +6217,13 @@ void ha_partition::print_error(int error, myf errflag)
thd->lex->sql_command != SQLCOM_TRUNCATE)
m_part_info->print_no_partition_found(table);
else
m_file[m_last_part]->print_error(error, errflag);
{
/* In case m_file has not been initialized, like in bug#42438 */
if (m_file)
m_file[m_last_part]->print_error(error, errflag);
else
handler::print_error(error, errflag);
}
DBUG_VOID_RETURN;
}
@ -6217,7 +6233,12 @@ bool ha_partition::get_error_message(int error, String *buf)
DBUG_ENTER("ha_partition::get_error_message");
/* Should probably look for my own errors first */
DBUG_RETURN(m_file[m_last_part]->get_error_message(error, buf));
/* In case m_file has not been initialized, like in bug#42438 */
if (m_file)
DBUG_RETURN(m_file[m_last_part]->get_error_message(error, buf));
DBUG_RETURN(handler::get_error_message(error, buf));
}

View File

@ -5321,7 +5321,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
field->set_notnull();
error=field->store(nr, unsigned_flag);
}
return error ? error : (field->table->in_use->is_error() ? 2 : 0);
return error ? error : (field->table->in_use->is_error() ? 1 : 0);
}
@ -6652,7 +6652,8 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
{
if (!arg)
{
if (field_arg->flags & NO_DEFAULT_VALUE_FLAG)
if (field_arg->flags & NO_DEFAULT_VALUE_FLAG &&
field_arg->real_type() != MYSQL_TYPE_ENUM)
{
if (field_arg->reset())
{

View File

@ -71,7 +71,12 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
Item *item= *arg;
used_tables_cache |= item->used_tables();
const_item_cache&= item->const_item() && !with_null;
if (const_item_cache)
/*
Some subqueries transformations aren't done in the view_prepare_mode thus
is_null() will fail. So we skip is_null() calculation for CREATE VIEW as
not necessary.
*/
if (const_item_cache && !thd->lex->view_prepare_mode)
{
if (item->cols() > 1)
with_null|= item->null_inside();

View File

@ -128,13 +128,15 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define WARN_DEPRECATED(Thd,Ver,Old,New) \
do { \
DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) > 0); \
if (((uchar*)Thd) != NULL) \
if (((uchar*)Thd) != NULL) \
push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
ER_WARN_DEPRECATED_SYNTAX, ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER), \
(Old), (Ver), (New)); \
ER_WARN_DEPRECATED_SYNTAX, \
ER(ER_WARN_DEPRECATED_SYNTAX), \
(Old), (New)); \
else \
sql_print_warning("The syntax '%s' is deprecated and will be removed " \
"in a future release. Please use %s instead.", (Old), (New)); \
sql_print_warning("'%s' is deprecated and will be removed " \
"in a future release. Please use '%s' instead.", \
(Old), (New)); \
} while(0)
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info;

View File

@ -1198,11 +1198,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
if (file)
{
range_end();
if (head->key_read)
{
head->key_read= 0;
file->extra(HA_EXTRA_NO_KEYREAD);
}
head->set_keyread(FALSE);
if (free_file)
{
DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file,
@ -1404,10 +1400,7 @@ end:
head->file= file;
/* We don't have to set 'head->keyread' here as the 'file' is unique */
if (!head->no_keyread)
{
head->key_read= 1;
head->mark_columns_used_by_index(index);
}
head->prepare_for_position();
head->file= org_file;
bitmap_copy(&column_bitmap, head->read_set);
@ -8350,7 +8343,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
DBUG_ENTER("QUICK_INDEX_MERGE_SELECT::read_keys_and_merge");
/* We're going to just read rowids. */
file->extra(HA_EXTRA_KEYREAD);
head->set_keyread(TRUE);
head->prepare_for_position();
cur_quick_it.rewind();
@ -8426,7 +8419,7 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
delete unique;
doing_pk_scan= FALSE;
/* index_merge currently doesn't support "using index" at all */
file->extra(HA_EXTRA_NO_KEYREAD);
head->set_keyread(FALSE);
init_read_record(&read_record, thd, head, (SQL_SELECT*) 0, 1 , 1, TRUE);
DBUG_RETURN(result);
}
@ -10844,7 +10837,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void)
int result;
DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::reset");
file->extra(HA_EXTRA_KEYREAD); /* We need only the key attributes */
head->set_keyread(TRUE); /* We need only the key attributes */
if ((result= file->ha_index_init(index,1)))
DBUG_RETURN(result);
if (quick_prefix_select && quick_prefix_select->reset())

View File

@ -326,11 +326,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!error && reckey_in_range(0, &ref, item_field->field,
conds, range_fl, prefix_len))
error= HA_ERR_KEY_NOT_FOUND;
if (table->key_read)
{
table->key_read= 0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
table->set_keyread(FALSE);
table->file->ha_index_end();
if (error)
{
@ -416,11 +412,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
if (!error && reckey_in_range(1, &ref, item_field->field,
conds, range_fl, prefix_len))
error= HA_ERR_KEY_NOT_FOUND;
if (table->key_read)
{
table->key_read=0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
table->set_keyread(FALSE);
table->file->ha_index_end();
if (error)
{
@ -882,10 +874,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
converted (for example to upper case)
*/
if (field->part_of_key.is_set(idx))
{
table->key_read= 1;
table->file->extra(HA_EXTRA_KEYREAD);
}
table->set_keyread(TRUE);
return 1;
}
}

View File

@ -5021,7 +5021,7 @@ ER_UNKNOWN_STORAGE_ENGINE 42000
# When using this error code, use ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER)
# for the message string. See, for example, code in mysql_priv.h.
ER_WARN_DEPRECATED_SYNTAX
eng "'%s' is deprecated; use '%s' instead"
eng "'%s' is deprecated and will be removed in a future release. Please use %s instead"
ger "'%s' ist veraltet. Bitte benutzen Sie '%s'"
por "'%s' é desatualizado. Use '%s' em seu lugar"
spa "'%s' está desaprobado, use '%s' en su lugar"

View File

@ -5021,7 +5021,7 @@ ER_UNKNOWN_STORAGE_ENGINE 42000
# When using this error code, use ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER)
# for the message string. See, for example, code in mysql_priv.h.
ER_WARN_DEPRECATED_SYNTAX
eng "'%s' is deprecated; use '%s' instead"
eng "'%s' is deprecated and will be removed in a future release. Please use %s instead"
ger "'%s' ist veraltet. Bitte benutzen Sie '%s'"
por "'%s' é desatualizado. Use '%s' em seu lugar"
spa "'%s' está desaprobado, use '%s' en su lugar"

View File

@ -176,8 +176,9 @@ sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name)
sp_cache_invalidate()
NOTE
This is called when a VIEW definition is modifed. We can't destroy sp_head
objects here as one may modify VIEW definitions from prelocking-free SPs.
This is called when a VIEW definition is created or modified (and in some
other contexts). We can't destroy sp_head objects here as one may modify
VIEW definitions from prelocking-free SPs.
*/
void sp_cache_invalidate()

View File

@ -1865,6 +1865,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
{
bool err_status= FALSE;
uint params = m_pcont->context_var_count();
/* Query start time may be reset in a multi-stmt SP; keep this for later. */
ulonglong utime_before_sp_exec= thd->utime_after_lock;
sp_rcontext *save_spcont, *octx;
sp_rcontext *nctx = NULL;
bool save_enable_slow_log= false;
@ -2071,6 +2073,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
delete nctx;
thd->spcont= save_spcont;
thd->utime_after_lock= utime_before_sp_exec;
DBUG_RETURN(err_status);
}

View File

@ -2177,6 +2177,7 @@ void wait_for_condition(THD *thd, pthread_mutex_t *mutex, pthread_cond_t *cond)
proc_info=thd->proc_info;
thd_proc_info(thd, "Waiting for table");
DBUG_ENTER("wait_for_condition");
DEBUG_SYNC(thd, "waiting_for_table");
if (!thd->killed)
(void) pthread_cond_wait(cond, mutex);
@ -4598,7 +4599,20 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
safe_to_ignore_table= prelock_handler.safely_trapped_errors();
}
else
{
tables->table= open_table(thd, tables, &new_frm_mem, &refresh, flags);
/*
Skip further processing if there has been a fatal error while
trying to open a table. For example, this might happen due to
stack shortage, unknown definer in views, etc.
*/
if (!tables->table && thd->is_error())
{
result= -1;
goto err;
}
}
}
else
DBUG_PRINT("tcache", ("referenced table: '%s'.'%s' 0x%lx",

View File

@ -608,10 +608,10 @@ bool THD::handle_condition(uint sql_errno,
for (Internal_error_handler *error_handler= m_internal_handler;
error_handler;
error_handler= m_internal_handler->m_prev_internal_handler)
error_handler= error_handler->m_prev_internal_handler)
{
if (error_handler-> handle_condition(this, sql_errno, sqlstate, level, msg,
cond_hdl))
if (error_handler->handle_condition(this, sql_errno, sqlstate, level, msg,
cond_hdl))
{
return TRUE;
}
@ -621,10 +621,12 @@ bool THD::handle_condition(uint sql_errno,
}
void THD::pop_internal_handler()
Internal_error_handler *THD::pop_internal_handler()
{
DBUG_ASSERT(m_internal_handler != NULL);
Internal_error_handler *popped_handler= m_internal_handler;
m_internal_handler= m_internal_handler->m_prev_internal_handler;
return popped_handler;
}

View File

@ -2229,7 +2229,7 @@ public:
/**
Remove the error handler last pushed.
*/
void pop_internal_handler();
Internal_error_handler *pop_internal_handler();
/**
Raise an exception condition.

View File

@ -6747,10 +6747,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
case JT_CONST: // Only happens with left join
if (table->covering_keys.is_set(tab->ref.key) &&
!table->no_keyread)
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
}
table->set_keyread(TRUE);
break;
case JT_ALL:
/*
@ -6811,10 +6808,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
if (tab->select && tab->select->quick &&
tab->select->quick->index != MAX_KEY && //not index_merge
table->covering_keys.is_set(tab->select->quick->index))
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
}
table->set_keyread(TRUE);
else if (!table->covering_keys.is_clear_all() &&
!(tab->select && tab->select->quick))
{ // Only read index tree
@ -6898,11 +6892,7 @@ void JOIN_TAB::cleanup()
limit= 0;
if (table)
{
if (table->key_read)
{
table->key_read= 0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
table->set_keyread(FALSE);
table->file->ha_index_or_rnd_end();
/*
We need to reset this for next select
@ -9939,7 +9929,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
KEY_PART_INFO *key_part_info;
Item **copy_func;
MI_COLUMNDEF *recinfo;
uint total_uneven_bit_length= 0;
/*
total_uneven_bit_length is uneven bit length for visible fields
hidden_uneven_bit_length is uneven bit length for hidden fields
*/
uint total_uneven_bit_length= 0, hidden_uneven_bit_length= 0;
bool force_copy_fields= param->force_copy_fields;
/* Treat sum functions as normal ones when loose index scan is used. */
save_sum_fields|= param->precomputed_group_by;
@ -10218,6 +10212,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
*/
param->hidden_field_count= fieldnr;
null_count= 0;
/*
On last hidden field we store uneven bit length in
hidden_uneven_bit_length and proceed calculation of
uneven bits for visible fields into
total_uneven_bit_length variable.
*/
hidden_uneven_bit_length= total_uneven_bit_length;
total_uneven_bit_length= 0;
}
}
DBUG_ASSERT(fieldnr == (uint) (reg_field - table->field));
@ -10263,7 +10265,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
else
null_count++;
}
hidden_null_pack_length=(hidden_null_count+7)/8;
hidden_null_pack_length= (hidden_null_count + 7 +
hidden_uneven_bit_length) / 8;
null_pack_length= (hidden_null_pack_length +
(null_count + total_uneven_bit_length + 7) / 8);
reclength+=null_pack_length;
@ -11780,16 +11783,11 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
!table->no_keyread &&
(int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY)
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
table->set_keyread(TRUE);
tab->index= tab->ref.key;
}
error=join_read_const(tab);
if (table->key_read)
{
table->key_read=0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
table->set_keyread(FALSE);
if (error)
{
tab->info="unique row not found";
@ -12142,12 +12140,8 @@ join_read_first(JOIN_TAB *tab)
{
int error;
TABLE *table=tab->table;
if (!table->key_read && table->covering_keys.is_set(tab->index) &&
!table->no_keyread)
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
}
if (table->covering_keys.is_set(tab->index) && !table->no_keyread)
table->set_keyread(TRUE);
tab->table->status=0;
tab->read_record.read_record=join_read_next;
tab->read_record.table=table;
@ -12181,12 +12175,8 @@ join_read_last(JOIN_TAB *tab)
{
TABLE *table=tab->table;
int error;
if (!table->key_read && table->covering_keys.is_set(tab->index) &&
!table->no_keyread)
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
}
if (table->covering_keys.is_set(tab->index) && !table->no_keyread)
table->set_keyread(TRUE);
tab->table->status=0;
tab->read_record.read_record=join_read_prev;
tab->read_record.table=table;
@ -13604,11 +13594,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
If ref_key used index tree reading only ('Using index' in EXPLAIN),
and best_key doesn't, then revert the decision.
*/
if (!table->covering_keys.is_set(best_key) && table->key_read)
{
table->key_read= 0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
if (!table->covering_keys.is_set(best_key))
table->set_keyread(FALSE);
if (!quick_created)
{
tab->index= best_key;
@ -13621,10 +13608,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
select->quick= 0;
}
if (table->covering_keys.is_set(best_key))
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
}
table->set_keyread(TRUE);
table->file->ha_index_or_rnd_end();
if (join->select_options & SELECT_DESCRIBE)
{
@ -13798,11 +13782,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
We can only use 'Only index' if quick key is same as ref_key
and in index_merge 'Only index' cannot be used
*/
if (table->key_read && ((uint) tab->ref.key != select->quick->index))
{
table->key_read=0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
if (((uint) tab->ref.key != select->quick->index))
table->set_keyread(FALSE);
}
else
{
@ -13858,11 +13839,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
tab->type=JT_ALL; // Read with normal read_record
tab->read_first_record= join_init_read_record;
tab->join->examined_rows+=examined_rows;
if (table->key_read) // Restore if we used indexes
{
table->key_read=0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
table->set_keyread(FALSE); // Restore if we used indexes
DBUG_RETURN(table->sort.found_records == HA_POS_ERROR);
err:
DBUG_RETURN(-1);
@ -14299,7 +14276,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{
used_fields--;
length+=field->fill_cache_field(copy);
if (copy->blob_field)
if (copy->type == CACHE_BLOB)
(*blob_ptr++)=copy;
if (field->real_maybe_null())
null_fields++;
@ -14314,8 +14291,8 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{ /* must copy null bits */
copy->str= tables[i].table->null_flags;
copy->length= tables[i].table->s->null_bytes;
copy->strip=0;
copy->blob_field=0;
copy->type=0;
copy->field=0;
length+=copy->length;
copy++;
cache->fields++;
@ -14325,8 +14302,8 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
{
copy->str= (uchar*) &tables[i].table->null_row;
copy->length=sizeof(tables[i].table->null_row);
copy->strip=0;
copy->blob_field=0;
copy->type=0;
copy->field=0;
length+=copy->length;
copy++;
cache->fields++;
@ -14351,9 +14328,10 @@ used_blob_length(CACHE_FIELD **ptr)
uint length,blob_length;
for (length=0 ; *ptr ; ptr++)
{
(*ptr)->blob_length=blob_length=(*ptr)->blob_field->get_length();
Field_blob *field_blob= (Field_blob *) (*ptr)->field;
(*ptr)->blob_length=blob_length= field_blob->get_length();
length+=blob_length;
(*ptr)->blob_field->get_ptr(&(*ptr)->str);
field_blob->get_ptr(&(*ptr)->str);
}
return length;
}
@ -14382,30 +14360,35 @@ store_record_in_cache(JOIN_CACHE *cache)
cache->records++;
for (copy=cache->field ; copy < end_field; copy++)
{
if (copy->blob_field)
if (copy->type == CACHE_BLOB)
{
Field_blob *blob_field= (Field_blob *) copy->field;
if (last_record)
{
copy->blob_field->get_image(pos, copy->length+sizeof(char*),
copy->blob_field->charset());
blob_field->get_image(pos, copy->length+sizeof(char*),
blob_field->charset());
pos+=copy->length+sizeof(char*);
}
else
{
copy->blob_field->get_image(pos, copy->length, // blob length
copy->blob_field->charset());
blob_field->get_image(pos, copy->length, // blob length
blob_field->charset());
memcpy(pos+copy->length,copy->str,copy->blob_length); // Blob data
pos+=copy->length+copy->blob_length;
}
}
else
{
if (copy->strip)
if (copy->type == CACHE_STRIPPED)
{
uchar *str,*end;
for (str=copy->str,end= str+copy->length;
end > str && end[-1] == ' ' ;
end--) ;
Field *field= copy->field;
if (field && field->maybe_null() && field->is_null())
end= str= copy->str;
else
for (str=copy->str,end= str+copy->length;
end > str && end[-1] == ' ' ;
end--) ;
length=(uint) (end-str);
memcpy(pos+2, str, length);
int2store(pos, length);
@ -14454,23 +14437,24 @@ read_cached_record(JOIN_TAB *tab)
copy < end_field;
copy++)
{
if (copy->blob_field)
if (copy->type == CACHE_BLOB)
{
Field_blob *blob_field= (Field_blob *) copy->field;
if (last_record)
{
copy->blob_field->set_image(pos, copy->length+sizeof(char*),
copy->blob_field->charset());
blob_field->set_image(pos, copy->length+sizeof(char*),
blob_field->charset());
pos+=copy->length+sizeof(char*);
}
else
{
copy->blob_field->set_ptr(pos, pos+copy->length);
pos+=copy->length+copy->blob_field->get_length();
blob_field->set_ptr(pos, pos+copy->length);
pos+=copy->length + blob_field->get_length();
}
}
else
{
if (copy->strip)
if (copy->type == CACHE_STRIPPED)
{
length= uint2korr(pos);
memcpy(copy->str, pos+2, length);

View File

@ -98,6 +98,10 @@ typedef struct st_table_ref
} TABLE_REF;
#define CACHE_BLOB 1 /* blob field */
#define CACHE_STRIPPED 2 /* field stripped of trailing spaces */
/**
CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer
table
@ -106,8 +110,8 @@ typedef struct st_table_ref
typedef struct st_cache_field {
uchar *str;
uint length, blob_length;
Field_blob *blob_field;
bool strip;
Field *field;
uint type; /**< category of the of the copied field (CACHE_BLOB et al.) */
} CACHE_FIELD;
@ -741,10 +745,11 @@ public:
we need to check for errors executing it and react accordingly
*/
if (!res && table->in_use->is_error())
res= 2;
res= 1; /* STORE_KEY_FATAL */
dbug_tmp_restore_column_map(table->write_set, old_map);
null_key= to_field->is_null() || item->null_value;
return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res);
return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL :
(store_key_result) res);
}
};
@ -773,17 +778,17 @@ protected:
if ((res= item->save_in_field(to_field, 1)))
{
if (!err)
err= res;
err= res < 0 ? 1 : res; /* 1=STORE_KEY_FATAL */
}
/*
Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
we need to check for errors executing it and react accordingly
*/
if (!err && to_field->table->in_use->is_error())
err= 2;
err= 1; /* STORE_KEY_FATAL */
}
null_key= to_field->is_null() || item->null_value;
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);
}
};

View File

@ -22,6 +22,7 @@
#include "sp_head.h"
#include "sql_trigger.h"
#include "sql_show.h"
#include "debug_sync.h"
#ifdef __WIN__
#include <io.h>
@ -1893,22 +1894,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
pthread_mutex_lock(&LOCK_open);
/*
If we have the table in the definition cache, we don't have to check the
.frm file to find if the table is a normal table (not view) and what
engine to use.
*/
/* Disable drop of enabled log tables, must be done before name locking */
for (table= tables; table; table= table->next_local)
{
TABLE_SHARE *share;
table->db_type= NULL;
if ((share= get_cached_table_share(table->db, table->table_name)))
table->db_type= share->db_type();
/* Disable drop of enabled log tables */
if (share && (share->table_category == TABLE_CATEGORY_PERFORMANCE) &&
check_if_log_table(table->db_length, table->db,
if (check_if_log_table(table->db_length, table->db,
table->table_name_length, table->table_name, 1))
{
my_error(ER_BAD_LOG_STATEMENT, MYF(0), "DROP");
@ -1927,7 +1916,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
{
char *db=table->db;
handlerton *table_type;
enum legacy_db_type frm_db_type;
enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
DBUG_PRINT("table", ("table_l: '%s'.'%s' table: 0x%lx s: 0x%lx",
table->db, table->table_name, (long) table->table,
@ -1992,7 +1981,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
built_query.append("`,");
}
table_type= table->db_type;
if (!drop_temporary)
{
TABLE *locked_table;
@ -2019,9 +2007,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
table->internal_tmp_table ?
FN_IS_TMP : 0);
}
DEBUG_SYNC(thd, "rm_table_part2_before_delete_table");
if (drop_temporary ||
((table_type == NULL &&
access(path, F_OK) &&
((access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
(!drop_view &&
mysql_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
@ -2037,15 +2025,25 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
else
{
char *end;
if (table_type == NULL)
/*
Cannot use the db_type from the table, since that might have changed
while waiting for the exclusive name lock. We are under LOCK_open,
so reading from the frm-file is safe.
*/
if (frm_db_type == DB_TYPE_UNKNOWN)
{
mysql_frm_type(thd, path, &frm_db_type);
table_type= ha_resolve_by_legacy_type(thd, frm_db_type);
mysql_frm_type(thd, path, &frm_db_type);
DBUG_PRINT("info", ("frm_db_type %d from %s", frm_db_type, path));
}
table_type= ha_resolve_by_legacy_type(thd, frm_db_type);
// Remove extension for delete
*(end= path + path_length - reg_ext_length)= '\0';
DBUG_PRINT("info", ("deleting table of type %d",
(table_type ? table_type->db_type : 0)));
error= ha_delete_table(thd, table_type, path, db, table->table_name,
!dont_log_query);
/* No error if non existent table and 'IF EXIST' clause or view */
if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) &&
(if_exists || table_type == NULL))
{
@ -2091,6 +2089,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
on the table name.
*/
pthread_mutex_unlock(&LOCK_open);
DEBUG_SYNC(thd, "rm_table_part2_before_binlog");
thd->thread_specific_used|= tmp_table_deleted;
error= 0;
if (wrong_tables.length())
@ -7167,6 +7166,7 @@ view_err:
else
create_info->data_file_name=create_info->index_file_name=0;
DEBUG_SYNC(thd, "alter_table_before_create_table_no_lock");
/*
Create a table with a temporary name.
With create_info->frm_only == 1 this creates a .frm file only.
@ -7367,6 +7367,7 @@ view_err:
intern_close_table(new_table);
my_free(new_table,MYF(0));
}
DEBUG_SYNC(thd, "alter_table_before_rename_result_table");
VOID(pthread_mutex_lock(&LOCK_open));
if (error)
{
@ -7509,6 +7510,7 @@ view_err:
thd_proc_info(thd, "end");
DBUG_EXECUTE_IF("sleep_alter_before_main_binlog", my_sleep(6000000););
DEBUG_SYNC(thd, "alter_table_before_main_binlog");
ha_binlog_log_query(thd, create_info->db_type, LOGCOM_ALTER_TABLE,
thd->query(), thd->query_length(),

View File

@ -327,6 +327,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
TABLE *table;
bool result= TRUE;
String stmt_query;
Query_tables_list backup;
bool need_start_waiting= FALSE;
DBUG_ENTER("mysql_create_or_drop_trigger");
@ -393,6 +394,12 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
{
bool if_exists= thd->lex->drop_if_exists;
/*
Protect the query table list from the temporary and potentially
destructive changes necessary to open the trigger's table.
*/
thd->lex->reset_n_backup_query_tables_list(&backup);
if (add_table_for_trigger(thd, thd->lex->spname, if_exists, & tables))
goto end;
@ -512,6 +519,10 @@ end:
VOID(pthread_mutex_unlock(&LOCK_open));
/* Restore the query table list. Used only for drop trigger. */
if (!create)
thd->lex->restore_backup_query_tables_list(&backup);
if (need_start_waiting)
start_waiting_global_read_lock(thd);
@ -1625,10 +1636,6 @@ bool add_table_for_trigger(THD *thd,
if (load_table_name_for_trigger(thd, trg_name, &trn_path, &tbl_name))
DBUG_RETURN(TRUE);
/* We need to reset statement table list to be PS/SP friendly. */
lex->query_tables= 0;
lex->query_tables_last= &lex->query_tables;
*table= sp_add_to_query_tables(thd, lex, trg_name->m_db.str,
tbl_name.str, TL_IGNORE);

View File

@ -399,10 +399,7 @@ int mysql_update(THD *thd,
matching rows before updating the table!
*/
if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
{
table->key_read=1;
table->mark_columns_used_by_index(used_index);
}
else
{
table->use_all_columns();
@ -849,11 +846,7 @@ int mysql_update(THD *thd,
err:
delete select;
free_underlaid_joins(thd, select_lex);
if (table->key_read)
{
table->key_read=0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
table->set_keyread(FALSE);
thd->abort_on_warning= 0;
DBUG_RETURN(1);
}
@ -1199,6 +1192,57 @@ reopen_tables:
}
/**
Implementation of the safe update options during UPDATE IGNORE. This syntax
causes an UPDATE statement to ignore all errors. In safe update mode,
however, we must never ignore the ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE. There
is a special hook in my_message_sql that will otherwise delete all errors
when the IGNORE option is specified.
In the future, all IGNORE handling should be used with this class and all
traces of the hack outlined below should be removed.
- The parser detects IGNORE option and sets thd->lex->ignore= 1
- In JOIN::optimize, if this is set, then
thd->lex->current_select->no_error gets set.
- In my_message_sql(), if the flag above is set then any error is
unconditionally converted to a warning.
We are moving in the direction of using Internal_error_handler subclasses
to do all such error tweaking, please continue this effort if new bugs
appear.
*/
class Safe_dml_handler : public Internal_error_handler {
private:
bool m_handled_error;
public:
explicit Safe_dml_handler() : m_handled_error(FALSE) {}
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
MYSQL_ERROR::enum_warning_level level,
const char* msg,
MYSQL_ERROR ** cond_hdl)
{
if (level == MYSQL_ERROR::WARN_LEVEL_ERROR &&
sql_errno == ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE)
{
thd->stmt_da->set_error_status(thd, sql_errno, msg, sqlstate);
m_handled_error= TRUE;
return TRUE;
}
return FALSE;
}
bool handled_error() { return m_handled_error; }
};
/*
Setup multi-update handling and call SELECT to do the join
*/
@ -1231,18 +1275,35 @@ bool mysql_multi_update(THD *thd,
MODE_STRICT_ALL_TABLES));
List<Item> total_list;
Safe_dml_handler handler;
bool using_handler= thd->options & OPTION_SAFE_UPDATES;
if (using_handler)
thd->push_internal_handler(&handler);
res= mysql_select(thd, &select_lex->ref_pointer_array,
table_list, select_lex->with_wild,
total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
*result, unit, select_lex);
DBUG_PRINT("info",("res: %d report_error: %d", res,
(int) thd->is_error()));
table_list, select_lex->with_wild,
total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
*result, unit, select_lex);
if (using_handler)
{
Internal_error_handler *top_handler= thd->pop_internal_handler();
DBUG_ASSERT(&handler == top_handler);
}
DBUG_PRINT("info",("res: %d report_error: %d", res, (int) thd->is_error()));
res|= thd->is_error();
if (unlikely(res))
/*
Todo: remove below code and make Safe_dml_handler do error processing
instead. That way we can return the actual error instead of
ER_UNKNOWN_ERROR.
*/
if (unlikely(res) && (!using_handler || !handler.handled_error()))
{
/* If we had a another error reported earlier then this will be ignored */
(*result)->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));

View File

@ -400,17 +400,14 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
DBUG_ASSERT(!lex->proc_list.first && !lex->result &&
!lex->param_list.elements);
if (mode != VIEW_CREATE_NEW)
if (mode == VIEW_ALTER && fill_defined_view_parts(thd, view))
{
if (mode == VIEW_ALTER &&
fill_defined_view_parts(thd, view))
{
res= TRUE;
goto err;
}
sp_cache_invalidate();
res= TRUE;
goto err;
}
sp_cache_invalidate();
if (!lex->definer)
{
/*

View File

@ -4916,7 +4916,7 @@ create_table_option:
| TYPE_SYM opt_equal storage_engines
{
Lex->create_info.db_type= $3;
WARN_DEPRECATED(yythd, "6.0", "TYPE=storage_engine",
WARN_DEPRECATED(yythd, "5.4.4", "TYPE=storage_engine",
"'ENGINE=storage_engine'");
Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
}

View File

@ -4379,7 +4379,7 @@ void TABLE::mark_columns_used_by_index(uint index)
MY_BITMAP *bitmap= &tmp_set;
DBUG_ENTER("TABLE::mark_columns_used_by_index");
(void) file->extra(HA_EXTRA_KEYREAD);
set_keyread(TRUE);
bitmap_clear_all(bitmap);
mark_columns_used_by_index_no_reset(index, bitmap);
column_bitmaps_set(bitmap, bitmap);
@ -4402,8 +4402,7 @@ void TABLE::restore_column_maps_after_mark_index()
{
DBUG_ENTER("TABLE::restore_column_maps_after_mark_index");
key_read= 0;
(void) file->extra(HA_EXTRA_NO_KEYREAD);
set_keyread(FALSE);
default_column_bitmaps();
file->column_bitmaps_signal();
DBUG_VOID_RETURN;

View File

@ -899,6 +899,20 @@ struct TABLE
inline bool needs_reopen_or_name_lock()
{ return s->version != refresh_version; }
bool is_children_attached(void);
inline void set_keyread(bool flag)
{
DBUG_ASSERT(file);
if (flag && !key_read)
{
key_read= 1;
file->extra(HA_EXTRA_KEYREAD);
}
else if (!flag && key_read)
{
key_read= 0;
file->extra(HA_EXTRA_NO_KEYREAD);
}
}
};
enum enum_schema_table_state

View File

@ -356,6 +356,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
*/
if (!(azopen(&archive_tmp, share->data_file_name, O_RDONLY|O_BINARY)))
{
*rc= my_errno ? my_errno : -1;
pthread_mutex_unlock(&archive_mutex);
my_free(share, MYF(0));
DBUG_RETURN(NULL);
}
stats.auto_increment_value= archive_tmp.auto_increment + 1;
@ -505,16 +508,18 @@ int ha_archive::open(const char *name, int mode, uint open_options)
For now we have to refuse to open such table to avoid
potential data loss.
*/
if ((rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
|| rc == HA_ERR_TABLE_NEEDS_UPGRADE)
switch (rc)
{
/* purecov: begin inspected */
case 0:
break;
case HA_ERR_CRASHED_ON_USAGE:
if (open_options & HA_OPEN_FOR_REPAIR)
break;
/* fall through */
case HA_ERR_TABLE_NEEDS_UPGRADE:
free_share();
DBUG_RETURN(rc);
/* purecov: end */
}
else if (rc == HA_ERR_OUT_OF_MEM)
{
/* fall through */
default:
DBUG_RETURN(rc);
}

View File

@ -681,9 +681,21 @@ int ha_tina::find_current_row(uchar *buf)
if (read_all || bitmap_is_set(table->read_set, (*field)->field_index))
{
bool is_enum= ((*field)->real_type() == MYSQL_TYPE_ENUM);
/*
Here CHECK_FIELD_WARN checks that all values in the csv file are valid
which is normally the case, if they were written by
INSERT -> ha_tina::write_row. '0' values on ENUM fields are considered
invalid by Field_enum::store() but it can store them on INSERT anyway.
Thus, for enums we silence the warning, as it doesn't really mean
an invalid value.
*/
if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
CHECK_FIELD_WARN))
goto err;
is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN))
{
if (!is_enum)
goto err;
}
if ((*field)->flags & BLOB_FLAG)
{
Field_blob *blob= *(Field_blob**) field;

View File

@ -437,8 +437,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
return 0;
}
/* going up to the first-level tree to continue search there */
/*
Going up to the first-level tree to continue search there.
Only done when performing prefix search.
Key buffer data pointer as well as docid[0] may be smaller
than values we got while searching first-level tree. Thus
they must be restored to original values to avoid dead-loop,
when subsequent search for a bigger value eventually ends up
in this same second-level tree.
*/
_mi_dpointer(info, (uchar*) (lastkey_buf+HA_FT_WLEN), ftbw->key_root);
ftbw->docid[0]= ftbw->key_root;
ftbw->key_root=info->s->state.key_root[ftb->keynr];
ftbw->keyinfo=info->s->keyinfo+ftb->keynr;
ftbw->off=0;

View File

@ -936,8 +936,16 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record,
}
if (block_info.next_filepos != HA_OFFSET_ERROR)
{
/*
delete_dynamic_record() may change data file position.
IO cache must be notified as it may still have cached
data, which has to be flushed later.
*/
info->rec_cache.seek_not_done= 1;
if (delete_dynamic_record(info,block_info.next_filepos,1))
goto err;
}
DBUG_RETURN(0);
err:
DBUG_RETURN(1);

View File

@ -321,8 +321,8 @@ void mi_update_status(void* param)
(long) info->s->state.state.data_file_length));
#endif
info->s->state.state= *info->state;
info->state= &info->s->state.state;
}
info->state= &info->s->state.state;
info->append_insert_at_end= 0;
/*

View File

@ -1,84 +1,36 @@
# Copyright (C) 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
#
#
# 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 Foundation; version 2 of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
# MA 02110-1301 USA.
%define mysql_version @VERSION@
##############################################################################
# Some common macro definitions
##############################################################################
# NOTE: "vendor" is used in upgrade/downgrade check, so you can't
# change these, has to be exactly as is.
%define mysql_old_vendor MySQL AB
%define mysql_vendor Sun Microsystems, Inc.
# use "rpmbuild --with static" or "rpm --define '_with_static 1'" (for RPM 3.x)
# to enable static linking (off by default)
%{?_with_static:%define STATIC_BUILD 1}
%{!?_with_static:%define STATIC_BUILD 0}
# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
# to build with yaSSL support (off by default)
%{?_with_yassl:%define YASSL_BUILD 1}
%{!?_with_yassl:%define YASSL_BUILD 0}
# ----------------------------------------------------------------------
# use "rpmbuild --with bundled_zlib" or "rpm --define '_with_bundled_zlib 1'"
# (for RPM 3.x) to build using the bundled zlib (off by default)
# ----------------------------------------------------------------------
%{?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 1}
%{!?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 0}
# use "rpmbuild --with cluster" or "rpm --define '_with_cluster 1'" (for RPM 3.x)
# to build with cluster support (off by default)
%{?_with_cluster:%define CLUSTER_BUILD 1}
%{!?_with_cluster:%define CLUSTER_BUILD 0}
# ----------------------------------------------------------------------
# support optional "tcmalloc" stuff (experimental)
# ----------------------------------------------------------------------
%{?malloc_lib_target:%define WITH_TCMALLOC 1}
%{!?malloc_lib_target:%define WITH_TCMALLOC 0}
%if %{STATIC_BUILD}
%define release 1
%else
%define release 1.glibc23
%endif
%define mysql_license GPL
%define mysqld_user mysql
%define mysqld_group mysql
%define server_suffix -standard
%define mysqldatadir /var/lib/mysql
# We don't package all files installed into the build root by intention -
# See BUG#998 for details.
%define _unpackaged_files_terminate_build 0
# ------------------------------------------------------------------------------
# RPM build tools now automatically detects Perl module dependencies. This
# detection gives problems as it is broken in some versions, and it also
# give unwanted dependencies from mandatory scripts in our package.
# Might not be possible to disable in all RPM tool versions, but here we
# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling
# here might fail, and that package has the most problems.
# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
# http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
# ------------------------------------------------------------------------------
%undefine __perl_provides
%undefine __perl_requires
%define mysql_version @VERSION@
%define mysqld_user mysql
%define mysqld_group mysql
%define mysqldatadir /var/lib/mysql
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
# ------------------------------------------------------------------------------
# On SuSE 9 no separate "debuginfo" package is built. To enable basic
# debugging on that platform, we don't strip binaries on SuSE 9. We
# disable the strip of binaries by redefining the RPM macro
@ -93,18 +45,97 @@
# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html
# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html
# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html
# ------------------------------------------------------------------------------
%define __os_install_post /usr/lib/rpm/brp-compress
Name: MySQL
# ------------------------------------------------------------------------------
# We don't package all files installed into the build root by intention -
# See BUG#998 for details.
# ------------------------------------------------------------------------------
%define _unpackaged_files_terminate_build 0
# ------------------------------------------------------------------------------
# RPM build tools now automatically detects Perl module dependencies. This
# detection gives problems as it is broken in some versions, and it also
# give unwanted dependencies from mandatory scripts in our package.
# Might not be possible to disable in all RPM tool versions, but here we
# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling
# here might fail, and that package has the most problems.
# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
# http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
# ------------------------------------------------------------------------------
%undefine __perl_provides
%undefine __perl_requires
##############################################################################
# Command line handling
##############################################################################
# ----------------------------------------------------------------------
# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x)
# to build with yaSSL support (off by default)
# ----------------------------------------------------------------------
%{?_with_yassl:%define YASSL_BUILD 1}
%{!?_with_yassl:%define YASSL_BUILD 0}
# ----------------------------------------------------------------------
# use "rpmbuild --without bundled_zlib" or "rpm --define '_without_bundled_zlib 1'"
# (for RPM 3.x) to not build using the bundled zlib (on by default)
# ----------------------------------------------------------------------
%{!?_with_bundled_zlib: %{!?_without_bundled_zlib: %define WITH_BUNDLED_ZLIB 1}}
%{?_with_bundled_zlib:%define WITH_BUNDLED_ZLIB 1}
%{?_without_bundled_zlib:%define WITH_BUNDLED_ZLIB 0}
# ----------------------------------------------------------------------
# use "rpmbuild --without innodb_plugin" or "rpm --define '_without_innodb_plugin 1'"
# (for RPM 3.x) to not build the innodb plugin (on by default with innodb builds)
# ----------------------------------------------------------------------
%{!?_with_innodb_plugin: %{!?_without_innodb_plugin: %define WITH_INNODB_PLUGIN 1}}
%{?_with_innodb_plugin:%define WITH_INNODB_PLUGIN 1}
%{?_without_innodb_plugin:%define WITH_INNODB_PLUGIN 0}
# ----------------------------------------------------------------------
# use "rpmbuild --with cluster" or "rpm --define '_with_cluster 1'" (for RPM 3.x)
# to build with cluster support (off by default)
# ----------------------------------------------------------------------
%{?_with_cluster:%define CLUSTER_BUILD 1}
%{!?_with_cluster:%define CLUSTER_BUILD 0}
##############################################################################
# Product definitions - set for a "community" package
##############################################################################
%define server_suffix -community
%define package_suffix -community
%define ndbug_comment MySQL Community Server (GPL)
%define debug_comment MySQL Community Server - Debug (GPL)
%define commercial 0
%define EMBEDDED_BUILD 1
%define PARTITION_BUILD 1
# Default for CLUSTER_BUILD is "0", but command line option may override it
%define COMMUNITY_BUILD 1
%define INNODB_BUILD 1
%define NORMAL_TEST_MODE test-bt
%define DEBUG_TEST_MODE test-bt-debug
%define release 1.glibc23
%define mysql_license GPL
%define src_dir mysql-%{mysql_version}
##############################################################################
# Main spec file section
##############################################################################
Name: MySQL
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
Version: @MYSQL_U_SCORE_VERSION@
Release: %{release}
License: Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Under %{mysql_license} license as shown in the Description field.
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz
License: Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor} All rights reserved. Use is subject to license terms. Under %{mysql_license} license as shown in the Description field.
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
URL: http://www.mysql.com/
Packager: Sun Microsystems, Inc. Product Engineering Team <build@mysql.com>
Packager: %{mysql_vendor} Product Engineering Team <build@mysql.com>
Vendor: %{mysql_vendor}
Provides: msqlormysql MySQL-server mysql
BuildRequires: ncurses-devel
@ -120,9 +151,9 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
Sun Microsystems, Inc.
%{mysql_vendor}
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc. All rights reserved.
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor} All rights reserved.
Use is subject to license terms.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
@ -132,6 +163,10 @@ The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
##############################################################################
# Sub package definition
##############################################################################
%package server
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
@ -144,9 +179,9 @@ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
and robust SQL (Structured Query Language) database server. MySQL Server
is intended for mission-critical, heavy-load production systems as well
as for embedding into mass-deployed software. MySQL is a trademark of
Sun Microsystems, Inc.
%{mysql_vendor}
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ Sun Microsystems, Inc. All rights reserved.
Copyright 2000-2008 MySQL AB, @MYSQL_COPYRIGHT_YEAR@ %{mysql_vendor} All rights reserved.
Use is subject to license terms.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
@ -156,12 +191,17 @@ The MySQL web site (http://www.mysql.com/) provides the latest
news and information about the MySQL software. Also please see the
documentation and the manual for more information.
This package includes the MySQL server binary (incl. InnoDB) as well
as related utilities to run and administrate a MySQL server.
This package includes the MySQL server binary
%if %{INNODB_BUILD}
(configured including InnoDB)
%endif
as well as related utilities to run and administer a MySQL server.
If you want to access and work with the database, you have to install
package "MySQL-client" as well!
# ------------------------------------------------------------------------------
%package client
Summary: MySQL - Client
Group: Applications/Databases
@ -169,33 +209,39 @@ Obsoletes: mysql-client
Provides: mysql-client
%description client
This package contains the standard MySQL clients and administration tools.
This package contains the standard MySQL clients and administration tools.
%{see_base}
# ------------------------------------------------------------------------------
%if %{CLUSTER_BUILD}
%package ndb-storage
Summary: MySQL - ndbcluster storage engine
Group: Applications/Databases
%description ndb-storage
This package contains the ndbcluster storage engine.
It is necessary to have this package installed on all
This package contains the ndbcluster storage engine.
It is necessary to have this package installed on all
computers that should store ndbcluster table data.
%{see_base}
# ------------------------------------------------------------------------------
%package ndb-management
Summary: MySQL - ndbcluster storage engine management
Group: Applications/Databases
%description ndb-management
This package contains ndbcluster storage engine management.
It is necessary to have this package installed on at least
It is necessary to have this package installed on at least
one computer in the cluster.
%{see_base}
# ------------------------------------------------------------------------------
%package ndb-tools
Summary: MySQL - ndbcluster storage engine basic tools
Group: Applications/Databases
@ -205,6 +251,8 @@ This package contains ndbcluster storage engine basic tools.
%{see_base}
# ------------------------------------------------------------------------------
%package ndb-extra
Summary: MySQL - ndbcluster storage engine extra tools
Group: Applications/Databases
@ -216,6 +264,8 @@ They should be used with caution.
%{see_base}
%endif
# ------------------------------------------------------------------------------
%package test
Requires: %{name}-client perl
Summary: MySQL - Test suite
@ -229,6 +279,8 @@ This package contains the MySQL regression test suite.
%{see_base}
# ------------------------------------------------------------------------------
%package devel
Summary: MySQL - Development header files and libraries
Group: Applications/Databases
@ -241,6 +293,8 @@ necessary to develop MySQL client applications.
%{see_base}
# ------------------------------------------------------------------------------
%package shared
Summary: MySQL - Shared libraries
Group: Applications/Databases
@ -249,6 +303,10 @@ Group: Applications/Databases
This package contains the shared libraries (*.so*) which certain
languages and applications need to dynamically load and use MySQL.
# ------------------------------------------------------------------------------
%if %{EMBEDDED_BUILD}
%package embedded
Requires: %{name}-devel
Summary: MySQL - embedded library
@ -268,6 +326,12 @@ client/server version.
%{see_base}
%endif
##############################################################################
#
##############################################################################
%prep
# We unpack the source two times, for 'debug' and 'release' build.
%setup -T -a 0 -c -n mysql-%{mysql_version}
@ -275,29 +339,53 @@ mv mysql-%{mysql_version} mysql-debug-%{mysql_version}
%setup -D -T -a 0 -n mysql-%{mysql_version}
mv mysql-%{mysql_version} mysql-release-%{mysql_version}
##############################################################################
# The actual build
##############################################################################
%build
BuildMySQL() {
# Let "MYSQL_BUILD_*FLAGS" take precedence.
CFLAGS=${MYSQL_BUILD_CFLAGS:-$CFLAGS}
CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$CXXFLAGS}
LDFLAGS=${MYSQL_BUILD_LDFLAGS:-$LDFLAGS}
# Fall back on RPM_OPT_FLAGS (part of RPM environment) if no flags are given.
CFLAGS=${CFLAGS:-$RPM_OPT_FLAGS}
CXXFLAGS=${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
# Evaluate current setting of $DEBUG
if [ $DEBUG -gt 0 ] ; then
OPT_COMMENT='--with-comment="%{debug_comment}"'
OPT_DEBUG='--with-debug'
CFLAGS=`echo " $CFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
CXXFLAGS=`echo " $CXXFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
else
OPT_COMMENT='--with-comment="%{ndbug_comment}"'
OPT_DEBUG=''
fi
# The --enable-assembler simply does nothing on systems that does not
# support assembler speedups.
sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
CC=\"${CC:-$MYSQL_BUILD_CC}\" \
CXX=\"${CXX:-$MYSQL_BUILD_CXX}\" \
CC=\"${MYSQL_BUILD_CC:-$CC}\" \
CXX=\"${MYSQL_BUILD_CXX:-$CXX}\" \
CFLAGS=\"$CFLAGS\" \
CXXFLAGS=\"$CXXFLAGS\" \
LDFLAGS=\"$MYSQL_BUILD_LDFLAGS\" \
LDFLAGS=\"$LDFLAGS\" \
./configure \
$* \
--with-mysqld-ldflags='-static' \
--with-client-ldflags='-static' \
--with-zlib-dir=bundled \
--enable-assembler \
--enable-local-infile \
--with-fast-mutexes \
--with-mysqld-user=%{mysqld_user} \
--with-unix-socket-path=/var/lib/mysql/mysql.sock \
--with-mysqld-user=%{mysqld_user} \
--with-unix-socket-path=/var/lib/mysql/mysql.sock \
--with-pic \
--prefix=/ \
--prefix=/ \
%if %{CLUSTER_BUILD}
--with-extra-charsets=all \
%else
@ -305,39 +393,62 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
%endif
%if %{YASSL_BUILD}
--with-ssl \
%endif
--exec-prefix=%{_exec_prefix} \
--libexecdir=%{_sbindir} \
--libdir=%{_libdir} \
--sysconfdir=%{_sysconfdir} \
--datadir=%{_datadir} \
--localstatedir=%{mysqldatadir} \
--infodir=%{_infodir} \
--includedir=%{_includedir} \
--mandir=%{_mandir} \
--enable-thread-safe-client \
--with-readline \
--with-innodb \
%if %{CLUSTER_BUILD}
--with-ndbcluster \
%else
--without-ndbcluster \
--without-ssl \
%endif
--with-archive-storage-engine \
--with-csv-storage-engine \
--with-blackhole-storage-engine \
--with-federated-storage-engine \
--exec-prefix=%{_exec_prefix} \
--libexecdir=%{_sbindir} \
--libdir=%{_libdir} \
--sysconfdir=%{_sysconfdir} \
--datadir=%{_datadir} \
--localstatedir=%{mysqldatadir} \
--infodir=%{_infodir} \
--includedir=%{_includedir} \
--mandir=%{_mandir} \
--enable-thread-safe-client \
$OPT_COMMENT \
$OPT_DEBUG \
--with-readline \
%if %{WITH_BUNDLED_ZLIB}
--with-zlib-dir=bundled \
%endif
%if %{CLUSTER_BUILD}
--with-plugin-ndbcluster \
%else
--without-plugin-ndbcluster \
%endif
%if %{INNODB_BUILD}
--with-plugin-innobase \
%if %{WITH_INNODB_PLUGIN}
%else
--without-plugin-innodb_plugin \
%endif
%else
--without-plugin-innobase \
--without-plugin-innodb_plugin \
%endif
%if %{PARTITION_BUILD}
--with-plugin-partition \
%else
--without-plugin-partition \
%endif
--with-plugin-csv \
--with-plugin-archive \
--with-plugin-blackhole \
--with-plugin-federated \
--without-plugin-daemon_example \
--without-plugin-ftexample \
--with-partition \
--with-big-tables \
%if %{WITH_BUNDLED_ZLIB}
--with-zlib-dir=bundled \
%if %{EMBEDDED_BUILD}
--with-embedded-server \
%else
--without-embedded-server \
%endif
--with-big-tables \
--enable-shared \
"
make
}
# end of function definition "BuildMySQL"
# Use our own copy of glibc
@ -366,15 +477,10 @@ export PATH
# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
# including exceptions into the code
if [ -z "$CXX" -a -z "$CC" ]
then
export CC="gcc"
export CXX="gcc"
if [ -z "$CXX" -a -z "$CC" ] ; then
export CC="gcc" CXX="gcc"
fi
# Prepare compiler flags
CFLAGS=${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS}
CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti }
##############################################################################
#
@ -384,20 +490,14 @@ CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-except
(
# We are in a subshell, so we can modify variables just for one run.
CFLAGS=`echo " $CFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
CXXFLAGS=`echo " $CXXFLAGS " | \
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
-e 's/^ //' -e 's/ $//'`
# Add -g and --with-debug.
DEBUG=1
cd mysql-debug-%{mysql_version} &&
CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \
BuildMySQL "\
--with-debug \
--with-comment=\"MySQL Community Server - Debug (%{mysql_license})\"")
BuildMySQL
)
# We might want to save the config log file
if test -n "$MYSQL_DEBUGCONFLOG_DEST"
@ -413,12 +513,12 @@ fi
#
##############################################################################
DEBUG=0
(cd mysql-release-%{mysql_version} &&
CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \
BuildMySQL "\
--with-embedded-server \
--with-comment=\"MySQL Community Server (%{mysql_license})\"")
BuildMySQL
)
# We might want to save the config log file
if test -n "$MYSQL_CONFLOG_DEST"
then
@ -429,15 +529,27 @@ fi
##############################################################################
# Include libgcc.a in the devel subpackage (BUG 4921)
if expr "$CC" : ".*gcc.*" > /dev/null ;
# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921)
# Some "icc" calls may have "gcc" in the argument string, so we should first
# check for "icc". (If we don't check, the "--print-libgcc-file" call will fail.)
if expr "$CC" : ".*icc.*" > /dev/null ;
then
%define WITH_LIBGCC 0
:
elif expr "$CC" : ".*gcc.*" > /dev/null ;
then
libgcc=`$CC $CFLAGS --print-libgcc-file`
if [ -f $libgcc ]
then
%define have_libgcc 1
%define WITH_LIBGCC 1
install -m 644 $libgcc $RBR%{_libdir}/mysql/libmygcc.a
else
%define WITH_LIBGCC 0
:
fi
else
%define WITH_LIBGCC 0
:
fi
##############################################################################
@ -456,7 +568,7 @@ install -d $RBR%{_mandir}
install -d $RBR%{_sbindir}
# Install all binaries
# Install all binaries
(cd $MBD && make install DESTDIR=$RBR testroot=%{_datadir})
# Old packages put shared libs in %{_libdir}/ (not %{_libdir}/mysql), so do
# the same here.
@ -481,20 +593,26 @@ install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror
install -m 644 $MBD/support-files/mysql-log-rotate $RBR%{_sysconfdir}/logrotate.d/mysql
install -m 755 $MBD/support-files/mysql.server $RBR%{_sysconfdir}/init.d/mysql
%if %{EMBEDDED_BUILD}
# Install embedded server library in the build root
install -m 644 $MBD/libmysqld/libmysqld.a $RBR%{_libdir}/mysql/
%endif
# in RPMs, it is unlikely that anybody should use "sql-bench"
rm -fr $RBR%{_datadir}/sql-bench
# Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this.
ln -s %{_sysconfdir}/init.d/mysql $RPM_BUILD_ROOT%{_sbindir}/rcmysql
ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql
# Touch the place where the my.cnf config file might be located.
# Just to make sure it's in the file list and marked as a config file.
touch $RBR%{_sysconfdir}/my.cnf
##############################################################################
# Post processing actions, i.e. when installed
##############################################################################
%pre server
# Check if we can safely upgrade. An upgrade is only safe if it's from one
# of our RPMs in the same version family.
@ -564,58 +682,66 @@ HERE
fi
# Shut down a previously installed server first
if test -x %{_sysconfdir}/init.d/mysql
then
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld a couple of seconds to exit nicely"
sleep 5
elif test -x %{_sysconfdir}/rc.d/init.d/mysql
then
%{_sysconfdir}/rc.d/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld a couple of seconds to exit nicely"
sleep 5
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld 5 seconds to exit nicely"
sleep 5
fi
%post server
mysql_datadir=%{mysqldatadir}
# ----------------------------------------------------------------------
# Create data directory if needed
if test ! -d $mysql_datadir; then mkdir -m 755 $mysql_datadir; fi
if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi
if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
if [ ! -d $mysql_datadir/mysql ] ; then mkdir $mysql_datadir/mysql; fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
# use insserv for older SuSE Linux versions
if test -x /sbin/insserv
then
if [ -x /sbin/insserv ] ; then
/sbin/insserv %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig
then
elif [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --add mysql
fi
# ----------------------------------------------------------------------
# Create a MySQL user and group. Do not report any problems if it already
# exists.
# ----------------------------------------------------------------------
groupadd -r %{mysqld_group} 2> /dev/null || true
useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# ----------------------------------------------------------------------
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Initiate databases if needed
# ----------------------------------------------------------------------
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
# ----------------------------------------------------------------------
# Upgrade databases if needed would go here - but it cannot be automated yet
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# Change permissions again to fix any new files.
# ----------------------------------------------------------------------
chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Fix permissions for the permission database so that only the user
# can read them.
# ----------------------------------------------------------------------
chmod -R og-rw $mysql_datadir/mysql
# Restart in the same way that mysqld will be started normally.
@ -628,7 +754,7 @@ sleep 2
#systems, we recommend MySQL Enterprise, which contains enterprise-ready
#software, intelligent advisory services, and full production support with
#scheduled service packs and more. Visit www.mysql.com/enterprise for more
#information."
#information."
%if %{CLUSTER_BUILD}
%post ndb-storage
@ -639,37 +765,38 @@ if test ! -d $mysql_clusterdir; then mkdir -m 755 $mysql_clusterdir; fi
%endif
%preun server
if test $1 = 0
then
# Stop MySQL before uninstalling it
if test -x %{_sysconfdir}/init.d/mysql
then
%{_sysconfdir}/init.d/mysql stop > /dev/null
# Remove autostart of mysql
# for older SuSE Linux versions
if test -x /sbin/insserv
then
/sbin/insserv -r %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases
elif test -x /sbin/chkconfig
then
/sbin/chkconfig --del mysql
fi
fi
if [ $1 = 0 ] ; then
# Stop MySQL before uninstalling it
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null
# Remove autostart of MySQL
# For older SuSE Linux versions
if [ -x /sbin/insserv ] ; then
/sbin/insserv -r %{_sysconfdir}/init.d/mysql
# use chkconfig on Red Hat and newer SuSE releases
elif [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --del mysql
fi
fi
fi
# We do not remove the mysql user since it may still own a lot of
# database files.
# Clean up the BuildRoot
# ----------------------------------------------------------------------
# Clean up the BuildRoot after build is done
# ----------------------------------------------------------------------
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
##############################################################################
# Files section
##############################################################################
%files server
%defattr(-,root,root,0755)
%doc mysql-release-%{mysql_version}/COPYING mysql-release-%{mysql_version}/README
%doc mysql-release-%{mysql_version}/COPYING mysql-release-%{mysql_version}/README
%doc mysql-release-%{mysql_version}/support-files/my-*.cnf
%if %{CLUSTER_BUILD}
%doc mysql-release-%{mysql_version}/support-files/ndb-*.ini
@ -677,17 +804,23 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info*
%if %{INNODB_BUILD}
%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1*
%endif
%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_convert_table_format.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_extensions.1*
%doc %attr(644, root, man) %{_mandir}/man8/mysqld.8*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
#%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqldumpslow.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_secure_installation.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_setpermission.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1*
@ -698,10 +831,14 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1*
%doc %attr(644, root, man) %{_mandir}/man1/perror.1*
%doc %attr(644, root, man) %{_mandir}/man1/replace.1*
%doc %attr(644, root, man) %{_mandir}/man1/resolve_stack_dump.1*
%doc %attr(644, root, man) %{_mandir}/man1/resolveip.1*
%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
%if %{INNODB_BUILD}
%attr(755, root, root) %{_bindir}/innochecksum
%endif
%attr(755, root, root) %{_bindir}/my_print_defaults
%attr(755, root, root) %{_bindir}/myisam_ftdump
%attr(755, root, root) %{_bindir}/myisamchk
@ -738,6 +875,12 @@ fi
%attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_sbindir}/mysqld-debug
%attr(755, root, root) %{_sbindir}/rcmysql
%if %{INNODB_BUILD}
%if %{WITH_INNODB_PLUGIN}
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_innodb_plugin.so*
%endif
%endif
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_example.so*
%attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql
%attr(755, root, root) %{_sysconfdir}/init.d/mysql
@ -841,7 +984,7 @@ fi
%{_datadir}/aclocal/mysql.m4
%{_libdir}/mysql/libdbug.a
%{_libdir}/mysql/libheap.a
%if %{have_libgcc}
%if %{WITH_LIBGCC}
%{_libdir}/mysql/libmygcc.a
%endif
%{_libdir}/mysql/libmyisam.a
@ -879,22 +1022,50 @@ fi
%defattr(-, root, root, 0755)
%attr(-, root, root) %{_datadir}/mysql-test
%attr(755, root, root) %{_bindir}/mysql_client_test
%attr(755, root, root) %{_bindir}/mysql_client_test_embedded
%attr(755, root, root) %{_bindir}/mysqltest_embedded
%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test_embedded.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1*
%if %{EMBEDDED_BUILD}
%attr(755, root, root) %{_bindir}/mysql_client_test_embedded
%attr(755, root, root) %{_bindir}/mysqltest_embedded
%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test_embedded.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqltest_embedded.1*
%endif
%if %{EMBEDDED_BUILD}
%files embedded
%defattr(-, root, root, 0755)
%defattr(-, root, root, 0755)
%attr(644, root, root) %{_libdir}/mysql/libmysqld.a
%endif
##############################################################################
# The spec file changelog only includes changes made to the spec file
# itself - note that they must be ordered by date (important when
# merging BK trees)
##############################################################################
%changelog
* Fri Feb 05 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Formatting changes:
Have a consistent structure of separator lines and of indentation
(8 leading blanks => tab).
- Introduce the variable "src_dir".
- Give the environment variables "MYSQL_BUILD_CC(CXX)" precedence
over "CC" ("CXX").
- Drop the old "with_static" argument analysis, this is not supported
in 5.1 since ages.
- Introduce variables to control the handlers individually, as well
as other options.
- Handle the InnoDB plugin using a positive logic: "WITH_INNODB_PLUGIN",
the old negative logic ("WITHOUT_INNODB_PLUGIN") was obfuscating.
- Use the new "--with-plugin" notation for the table handlers.
- Drop handling "/etc/rc.d/init.d/mysql", the switch to "/etc/init.d/mysql"
was done back in 2002 already.
- Make "--with-zlib-dir=bundled" the default, add an option to disable it.
- Add missing manual pages to the file list.
- Improve the runtime check for "libgcc.a", protect it against being tried
with the Intel compiler "icc".
* Mon Jan 11 2010 Joerg Bruehe <joerg.bruehe@sun.com>
- Change RPM file naming: