Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts: Text conflict in configure.in Text conflict in dbug/dbug.c Text conflict in mysql-test/r/ps.result Text conflict in mysql-test/t/ps.test Text conflict in sql/CMakeLists.txt Text conflict in sql/ha_ndbcluster.cc Text conflict in sql/mysqld.cc Text conflict in sql/sql_plugin.cc Text conflict in sql/sql_table.cc
This commit is contained in:
commit
85ed11c60d
17
configure.in
17
configure.in
@ -19,15 +19,16 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# Minimum Autoconf version required.
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
# Various people throughout the community may parse configure.in to
|
||||
# get the MySQL version from the source branch. If the formatting
|
||||
# of this line is going to be changed, please announce the change to
|
||||
# internals@lists.mysql.com in advance of pushing the change.
|
||||
#
|
||||
# Remember to also update version.c in ndb.
|
||||
# When changing major version number please also check switch statement
|
||||
# in client/mysqlbinlog.cc:check_master_version().
|
||||
dnl Various people throughout the community may parse configure.in to
|
||||
dnl get the MySQL version from the source branch. If the formatting
|
||||
dnl of this line is going to be changed, please announce the change to
|
||||
dnl internals@lists.mysql.com in advance of pushing the change.
|
||||
dnl
|
||||
dnl When changing the major version number please also check the switch
|
||||
dnl statement in mysqlbinlog::check_master_version(). You may also need
|
||||
dnl to update version.c in ndb.
|
||||
AC_INIT([MySQL Server], [5.5.5-m3], [], [mysql])
|
||||
|
||||
AC_CONFIG_SRCDIR([sql/mysqld.cc])
|
||||
AC_CANONICAL_SYSTEM
|
||||
# USTAR format gives us the possibility to store longer path names in
|
||||
|
11
dbug/dbug.c
11
dbug/dbug.c
@ -507,7 +507,13 @@ int DbugParse(CODE_STATE *cs, const char *control)
|
||||
rel= control[0] == '+' || control[0] == '-';
|
||||
if ((!rel || (!stack->out_file && !stack->next)))
|
||||
{
|
||||
FreeState(cs, stack, 0);
|
||||
/*
|
||||
We need to free what's already in init_settings, because unlike
|
||||
the thread related stack frames there's a chance that something
|
||||
is in these variables already.
|
||||
*/
|
||||
if (stack == &init_settings)
|
||||
FreeState(cs, stack, 0);
|
||||
stack->flags= 0;
|
||||
stack->delay= 0;
|
||||
stack->maxdepth= 0;
|
||||
@ -1709,7 +1715,10 @@ void _db_end_()
|
||||
while ((discard= cs->stack))
|
||||
{
|
||||
if (discard == &init_settings)
|
||||
{
|
||||
FreeState (cs, discard, 0);
|
||||
break;
|
||||
}
|
||||
cs->stack= discard->next;
|
||||
FreeState(cs, discard, 1);
|
||||
}
|
||||
|
@ -593,30 +593,37 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd,
|
||||
const char *key, unsigned int key_length,
|
||||
int using_trx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
Provide a handler data getter to simplify coding
|
||||
*/
|
||||
inline
|
||||
void *
|
||||
thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
|
||||
{
|
||||
return *thd_ha_data(thd, hton);
|
||||
}
|
||||
void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
|
||||
|
||||
|
||||
/**
|
||||
Provide a handler data setter to simplify coding
|
||||
|
||||
@details
|
||||
Set ha_data pointer (storage engine per-connection information).
|
||||
|
||||
To avoid unclean deactivation (uninstall) of storage engine plugin
|
||||
in the middle of transaction, additional storage engine plugin
|
||||
lock is acquired.
|
||||
|
||||
If ha_data is not null and storage engine plugin was not locked
|
||||
by thd_set_ha_data() in this connection before, storage engine
|
||||
plugin gets locked.
|
||||
|
||||
If ha_data is null and storage engine plugin was locked by
|
||||
thd_set_ha_data() in this connection before, storage engine
|
||||
plugin lock gets released.
|
||||
|
||||
If handlerton::close_connection() didn't reset ha_data, server does
|
||||
it immediately after calling handlerton::close_connection().
|
||||
*/
|
||||
inline
|
||||
void
|
||||
thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
|
||||
const void *ha_data)
|
||||
{
|
||||
*thd_ha_data(thd, hton)= (void*) ha_data;
|
||||
void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
|
||||
const void *ha_data);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -165,3 +165,6 @@ void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||
void mysql_query_cache_invalidate4(void* thd,
|
||||
const char *key, unsigned int key_length,
|
||||
int using_trx);
|
||||
void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
|
||||
void thd_set_ha_data(void* thd, const struct handlerton *hton,
|
||||
const void *ha_data);
|
||||
|
8
mysql-test/r/bug46261.result
Normal file
8
mysql-test/r/bug46261.result
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# Bug#46261 Plugins can be installed with --skip-grant-tables
|
||||
#
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
UNINSTALL PLUGIN example;
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
End of 5.1 tests
|
@ -18,3 +18,26 @@ SELECT MAX(a) FROM t1 GROUP BY a,b;
|
||||
ERROR 23000: Can't write; duplicate key in table 'tmp_table'
|
||||
set tmp_table_size=default;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #50946: fast index creation still seems to copy the table
|
||||
#
|
||||
CREATE TABLE t1 (a INT(100) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1), (0), (2);
|
||||
SET SESSION debug='+d,alter_table_only_index_change';
|
||||
ALTER TABLE t1 ADD INDEX a(a);
|
||||
SET SESSION debug=DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(100) NOT NULL,
|
||||
KEY `a` (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -2355,6 +2355,34 @@ Index_type BTREE
|
||||
Comment
|
||||
Index_comment
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
|
||||
# JOINed during an UPDATE
|
||||
#
|
||||
CREATE TABLE t1 (d INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT, b INT,
|
||||
c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
|
||||
set up our data elements
|
||||
INSERT INTO t1 (d) VALUES (1);
|
||||
INSERT INTO t2 (a,b) VALUES (1,1);
|
||||
SELECT SECOND(c) INTO @bug47453 FROM t2;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
#should be 0
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
SECOND(c)-@bug47453
|
||||
0
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# Test for bug #39932 "create table fails if column for FK is in different
|
||||
|
@ -1146,6 +1146,16 @@ ROW(t1.b, 1111.11) <=> ROW('','');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
a b a b
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
CREATE TABLE t1 (f1 int);
|
||||
CREATE TABLE t2 (f1 int);
|
||||
@ -1174,14 +1184,4 @@ NULL
|
||||
NULL
|
||||
1
|
||||
DROP TABLE t1, t2, mm1;
|
||||
#
|
||||
# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
a b a b
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
4
mysql-test/r/loaddata.result
Executable file → Normal file
4
mysql-test/r/loaddata.result
Executable file → Normal file
@ -204,10 +204,10 @@ a b c
|
||||
15 NULL Fifteen
|
||||
show variables like "secure_file_pri%";
|
||||
Variable_name Value
|
||||
secure_file_priv MYSQLTEST_VARDIR/
|
||||
secure_file_priv MYSQLTEST_VARDIR
|
||||
select @@secure_file_priv;
|
||||
@@secure_file_priv
|
||||
MYSQLTEST_VARDIR/
|
||||
MYSQLTEST_VARDIR
|
||||
set @@secure_file_priv= 0;
|
||||
ERROR HY000: Variable 'secure_file_priv' is a read only variable
|
||||
truncate table t1;
|
||||
|
@ -2992,6 +2992,19 @@ select @plaintext;
|
||||
bcd
|
||||
deallocate prepare encode;
|
||||
deallocate prepare decode;
|
||||
#
|
||||
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
#
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
|
||||
ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
|
||||
EXECUTE stmt;
|
||||
1
|
||||
EXECUTE stmt;
|
||||
1
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
|
||||
End of 5.1 tests.
|
||||
|
||||
|
@ -457,3 +457,12 @@ abc 1 abc 1
|
||||
select host,user from mysql.user where (host,user) = ('localhost','test');
|
||||
host user
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
#
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
SELECT 1 FROM t1 WHERE ROW(a, b) >=
|
||||
ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
@ -10,3 +10,16 @@ set debug= '-P';
|
||||
select @@debug;
|
||||
@@debug
|
||||
T
|
||||
#
|
||||
# Bug #52629: memory leak from sys_var_thd_dbug in
|
||||
# binlog.binlog_write_error
|
||||
#
|
||||
SET GLOBAL debug='d,injecting_fault_writing';
|
||||
SELECT @@global.debug;
|
||||
@@global.debug
|
||||
d,injecting_fault_writing
|
||||
SET GLOBAL debug='';
|
||||
SELECT @@global.debug;
|
||||
@@global.debug
|
||||
|
||||
End of 5.1 tests
|
||||
|
@ -246,4 +246,18 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER 'user49119'@'localhost';
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
grant all on *.* to foo@"1.2.3.4";
|
||||
revoke all privileges, grant option from "foo";
|
||||
ERROR HY000: Can't revoke all privileges for one or more of the requested users
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
|
||||
master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
|
||||
DROP USER foo@"1.2.3.4";
|
||||
"End of test"
|
||||
|
@ -318,4 +318,33 @@ DROP USER 'user49119'@'localhost';
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
#
|
||||
# Bug #51987 revoke privileges logs wrong error code
|
||||
#
|
||||
|
||||
-- connection master
|
||||
-- source include/master-slave-reset.inc
|
||||
-- connection master
|
||||
|
||||
grant all on *.* to foo@"1.2.3.4";
|
||||
-- error ER_REVOKE_GRANTS
|
||||
revoke all privileges, grant option from "foo";
|
||||
|
||||
## assertion: revoke is logged
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
-- sync_slave_with_master
|
||||
|
||||
## assertion: slave replicates revoke and does not fail because master
|
||||
## logged revoke with correct expected error code
|
||||
-- let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1)
|
||||
if ($err)
|
||||
{
|
||||
-- die UNEXPECTED ERROR AT SLAVE: $err
|
||||
}
|
||||
|
||||
-- connection master
|
||||
DROP USER foo@"1.2.3.4";
|
||||
-- sync_slave_with_master
|
||||
|
||||
--echo "End of test"
|
||||
|
22
mysql-test/suite/sys_vars/r/secure_file_priv.result
Normal file
22
mysql-test/suite/sys_vars/r/secure_file_priv.result
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Bug50373 --secure-file-priv=""
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(50));
|
||||
INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
|
||||
SHOW VARIABLES LIKE 'secure_file_priv';
|
||||
Variable_name Value
|
||||
secure_file_priv
|
||||
c1
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
loaded_file
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
|
||||
DROP TABLE t1;
|
1
mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
Normal file
1
mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--secure_file_priv=''
|
21
mysql-test/suite/sys_vars/t/secure_file_priv.test
Normal file
21
mysql-test/suite/sys_vars/t/secure_file_priv.test
Normal file
@ -0,0 +1,21 @@
|
||||
--echo #
|
||||
--echo # Bug50373 --secure-file-priv=""
|
||||
--echo #
|
||||
CREATE TABLE t1 (c1 VARCHAR(50));
|
||||
INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
|
||||
SHOW VARIABLES LIKE 'secure_file_priv';
|
||||
--disable_query_log
|
||||
# Atempt to create a file where we normally aren't allowed to create one.
|
||||
# Doing this in a portable manner is difficult but we should be able to
|
||||
# count on the depth of the directory hierarchy used. Three steps up from
|
||||
# the datadir is the 'mysql_test' directory.
|
||||
--let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')`;
|
||||
--eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE';
|
||||
DELETE FROM t1;
|
||||
--eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
--eval SELECT load_file('$PROTECTED_FILE') AS loaded_file;
|
||||
--enable_query_log
|
||||
remove_file $PROTECTED_FILE;
|
||||
DROP TABLE t1;
|
||||
|
1
mysql-test/t/bug46261-master.opt
Normal file
1
mysql-test/t/bug46261-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--skip-grant-tables $EXAMPLE_PLUGIN_OPT
|
16
mysql-test/t/bug46261.test
Normal file
16
mysql-test/t/bug46261.test
Normal file
@ -0,0 +1,16 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_example_plugin.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46261 Plugins can be installed with --skip-grant-tables
|
||||
--echo #
|
||||
|
||||
--replace_regex /\.dll/.so/
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO;
|
||||
|
||||
--replace_regex /\.dll/.so/
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
eval UNINSTALL PLUGIN example;
|
||||
|
||||
--echo End of 5.1 tests
|
@ -33,3 +33,19 @@ set tmp_table_size=default;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #50946: fast index creation still seems to copy the table
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT(100) NOT NULL);
|
||||
INSERT INTO t1 VALUES (1), (0), (2);
|
||||
SET SESSION debug='+d,alter_table_only_index_change';
|
||||
ALTER TABLE t1 ADD INDEX a(a);
|
||||
SET SESSION debug=DEFAULT;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests
|
||||
--echo #
|
||||
|
@ -589,6 +589,36 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
|
||||
--echo # JOINed during an UPDATE
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (d INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT, b INT,
|
||||
c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
|
||||
|
||||
--echo set up our data elements
|
||||
INSERT INTO t1 (d) VALUES (1);
|
||||
INSERT INTO t2 (a,b) VALUES (1,1);
|
||||
SELECT SECOND(c) INTO @bug47453 FROM t2;
|
||||
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
|
||||
SELECT SLEEP(1);
|
||||
|
||||
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
|
||||
|
||||
--echo #should be 0
|
||||
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
|
||||
|
@ -807,6 +807,17 @@ WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
|
||||
ROW(t1.b, 1111.11) <=> ROW('','');
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
||||
@ -840,15 +851,4 @@ ENGINE=MERGE UNION=(t1,t2);
|
||||
SELECT t1.a FROM mm1,t1;
|
||||
DROP TABLE t1, t2, mm1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
|
||||
INSERT INTO t1 VALUES (0,0), (1,1);
|
||||
|
||||
SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -3065,6 +3065,20 @@ select @plaintext;
|
||||
deallocate prepare encode;
|
||||
deallocate prepare decode;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
--echo #
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
|
||||
ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
|
||||
--disable_warnings
|
||||
EXECUTE stmt;
|
||||
EXECUTE stmt;
|
||||
--enable_warnings
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
|
@ -255,3 +255,14 @@ select * from t1,t2 where (a,b) = (c,d);
|
||||
|
||||
select host,user from mysql.user where (host,user) = ('localhost','test');
|
||||
drop table t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
|
||||
--echo #
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
|
||||
INSERT INTO t1 VALUES (0, 0),(0, 0);
|
||||
--disable_warnings
|
||||
SELECT 1 FROM t1 WHERE ROW(a, b) >=
|
||||
ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
|
||||
--enable_warnings
|
||||
DROP TABLE t1;
|
||||
|
@ -10,3 +10,16 @@ set debug= '+P';
|
||||
select @@debug;
|
||||
set debug= '-P';
|
||||
select @@debug;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #52629: memory leak from sys_var_thd_dbug in
|
||||
--echo # binlog.binlog_write_error
|
||||
--echo #
|
||||
|
||||
SET GLOBAL debug='d,injecting_fault_writing';
|
||||
SELECT @@global.debug;
|
||||
SET GLOBAL debug='';
|
||||
SELECT @@global.debug;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -270,6 +270,14 @@ foreach my $rdb ( @db_desc ) {
|
||||
my $db = $rdb->{src};
|
||||
my @dbh_tables = get_list_of_tables( $db );
|
||||
|
||||
## filter out certain system non-lockable tables.
|
||||
## keep in sync with mysqldump.
|
||||
if ($db =~ m/^mysql$/i)
|
||||
{
|
||||
@dbh_tables = grep
|
||||
{ !/^(apply_status|schema|general_log|slow_log)$/ } @dbh_tables
|
||||
}
|
||||
|
||||
## generate regex for tables/files
|
||||
my $t_regex;
|
||||
my $negated;
|
||||
|
@ -47,7 +47,7 @@ SET (SQL_SOURCE
|
||||
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
|
||||
item_create.cc item_func.cc item_geofunc.cc item_row.cc
|
||||
item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
|
||||
key.cc log.cc lock.cc message.rc
|
||||
key.cc log.cc lock.cc
|
||||
log_event.cc rpl_record.cc rpl_reporting.cc
|
||||
log_event_old.cc rpl_record_old.cc
|
||||
message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
|
||||
@ -92,7 +92,7 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h)
|
||||
SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc)
|
||||
ELSE()
|
||||
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
|
||||
ENDIF()
|
||||
|
12
sql/field.cc
12
sql/field.cc
@ -8464,14 +8464,20 @@ bool Field_num::eq_def(Field *field)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check whether two numeric fields can be considered 'equal' for table
|
||||
alteration purposes. Fields are equal if they are of the same type
|
||||
and retain the same pack length.
|
||||
*/
|
||||
|
||||
uint Field_num::is_equal(Create_field *new_field)
|
||||
{
|
||||
return ((new_field->sql_type == real_type()) &&
|
||||
((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
|
||||
UNSIGNED_FLAG)) &&
|
||||
((new_field->flags & UNSIGNED_FLAG) ==
|
||||
(uint) (flags & UNSIGNED_FLAG)) &&
|
||||
((new_field->flags & AUTO_INCREMENT_FLAG) ==
|
||||
(uint) (flags & AUTO_INCREMENT_FLAG)) &&
|
||||
(new_field->length <= max_display_length()));
|
||||
(new_field->pack_length == pack_length()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,7 +174,7 @@ redo:
|
||||
}
|
||||
|
||||
|
||||
plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
|
||||
plugin_ref ha_lock_engine(THD *thd, const handlerton *hton)
|
||||
{
|
||||
if (hton)
|
||||
{
|
||||
@ -642,9 +642,13 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
|
||||
there's no need to rollback here as all transactions must
|
||||
be rolled back already
|
||||
*/
|
||||
if (hton->state == SHOW_OPTION_YES && hton->close_connection &&
|
||||
thd_get_ha_data(thd, hton))
|
||||
hton->close_connection(hton, thd);
|
||||
if (hton->state == SHOW_OPTION_YES && thd_get_ha_data(thd, hton))
|
||||
{
|
||||
if (hton->close_connection)
|
||||
hton->close_connection(hton, thd);
|
||||
/* make sure ha_data is reset and ha_data_lock is released */
|
||||
thd_set_ha_data(thd, hton, NULL);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2066,7 +2066,7 @@ extern ulong total_ha, total_ha_2pc;
|
||||
/* lookups */
|
||||
handlerton *ha_default_handlerton(THD *thd);
|
||||
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name);
|
||||
plugin_ref ha_lock_engine(THD *thd, handlerton *hton);
|
||||
plugin_ref ha_lock_engine(THD *thd, const handlerton *hton);
|
||||
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type);
|
||||
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
|
||||
handlerton *db_type);
|
||||
|
@ -60,9 +60,9 @@ public:
|
||||
/* Allow owner function to use string buffers. */
|
||||
String value1, value2;
|
||||
|
||||
Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(TRUE),
|
||||
Arg_comparator(): comparators(0), thd(0), a_cache(0), b_cache(0), set_null(TRUE),
|
||||
get_value_a_func(0), get_value_b_func(0) {};
|
||||
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0),
|
||||
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), comparators(0), thd(0),
|
||||
a_cache(0), b_cache(0), set_null(TRUE),
|
||||
get_value_a_func(0), get_value_b_func(0) {};
|
||||
|
||||
@ -118,6 +118,11 @@ public:
|
||||
return (owner->type() == Item::FUNC_ITEM &&
|
||||
((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
|
||||
}
|
||||
void cleanup()
|
||||
{
|
||||
delete [] comparators;
|
||||
comparators= 0;
|
||||
}
|
||||
|
||||
friend class Item_func;
|
||||
};
|
||||
@ -371,6 +376,11 @@ public:
|
||||
CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
|
||||
uint decimal_precision() const { return 1; }
|
||||
void top_level_item() { abort_on_null= TRUE; }
|
||||
void cleanup()
|
||||
{
|
||||
Item_int_func::cleanup();
|
||||
cmp.cleanup();
|
||||
}
|
||||
|
||||
friend class Arg_comparator;
|
||||
};
|
||||
|
@ -7771,10 +7771,25 @@ static int fix_paths(void)
|
||||
*/
|
||||
if (opt_secure_file_priv)
|
||||
{
|
||||
convert_dirname(buff, opt_secure_file_priv, NullS);
|
||||
x_free(opt_secure_file_priv);
|
||||
opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
|
||||
if (*opt_secure_file_priv == 0)
|
||||
{
|
||||
opt_secure_file_priv= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
convert_dirname(buff, opt_secure_file_priv, NullS);
|
||||
char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE));
|
||||
if (secure_file_real_path == 0 ||
|
||||
my_realpath(secure_file_real_path, buff, 0))
|
||||
{
|
||||
sql_print_warning("Failed to normalize the argument for --secure-file-priv.");
|
||||
return 1;
|
||||
}
|
||||
my_free(opt_secure_file_priv, MYF(0));
|
||||
opt_secure_file_priv= secure_file_real_path;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -6255,21 +6255,21 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
|
||||
mysql_mutex_unlock(&acl_cache->lock);
|
||||
|
||||
int binlog_error=
|
||||
if (result)
|
||||
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
|
||||
|
||||
result= result |
|
||||
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
|
||||
|
||||
mysql_rwlock_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
|
||||
/* error for writing binary log has already been reported */
|
||||
if (result && !binlog_error)
|
||||
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
|
||||
/* Restore the state of binlog format */
|
||||
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
DBUG_RETURN(result || binlog_error);
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
|
||||
|
@ -305,6 +305,37 @@ void **thd_ha_data(const THD *thd, const struct handlerton *hton)
|
||||
return (void **) &thd->ha_data[hton->slot].ha_ptr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Provide a handler data getter to simplify coding
|
||||
*/
|
||||
extern "C"
|
||||
void *thd_get_ha_data(const THD *thd, const struct handlerton *hton)
|
||||
{
|
||||
return *thd_ha_data(thd, hton);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Provide a handler data setter to simplify coding
|
||||
@see thd_set_ha_data() definition in plugin.h
|
||||
*/
|
||||
extern "C"
|
||||
void thd_set_ha_data(THD *thd, const struct handlerton *hton,
|
||||
const void *ha_data)
|
||||
{
|
||||
plugin_ref *lock= &thd->ha_data[hton->slot].lock;
|
||||
if (ha_data && !*lock)
|
||||
*lock= ha_lock_engine(NULL, (handlerton*) hton);
|
||||
else if (!ha_data && *lock)
|
||||
{
|
||||
plugin_unlock(NULL, *lock);
|
||||
*lock= NULL;
|
||||
}
|
||||
*thd_ha_data(thd, hton)= (void*) ha_data;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
long long thd_test_options(const THD *thd, long long test_options)
|
||||
{
|
||||
|
@ -1470,7 +1470,11 @@ struct Ha_data
|
||||
@sa trans_register_ha()
|
||||
*/
|
||||
Ha_trx_info ha_info[2];
|
||||
|
||||
/**
|
||||
NULL: engine is not bound to this thread
|
||||
non-NULL: engine is bound to this thread, engine shutdown forbidden
|
||||
*/
|
||||
plugin_ref lock;
|
||||
Ha_data() :ha_ptr(NULL) {}
|
||||
};
|
||||
|
||||
|
@ -396,9 +396,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||
}
|
||||
else if (opt_secure_file_priv)
|
||||
{
|
||||
char secure_file_real_path[FN_REFLEN];
|
||||
(void) my_realpath(secure_file_real_path, opt_secure_file_priv, 0);
|
||||
if (strncmp(secure_file_real_path, name, strlen(secure_file_real_path)))
|
||||
if (strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
|
||||
{
|
||||
/* Read only allowed from within dir specified by secure_file_priv */
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
|
||||
|
@ -1160,8 +1160,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
We have name + wildcard in packet, separated by endzero
|
||||
*/
|
||||
arg_end= strend(packet);
|
||||
uint arg_length= arg_end - packet;
|
||||
|
||||
/* Check given table name length. */
|
||||
if (arg_length >= packet_length || arg_length > NAME_LEN)
|
||||
{
|
||||
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
|
||||
break;
|
||||
}
|
||||
thd->convert_string(&conv_name, system_charset_info,
|
||||
packet, (uint) (arg_end - packet), thd->charset());
|
||||
packet, arg_length, thd->charset());
|
||||
table_list.alias= table_list.table_name= conv_name.str;
|
||||
packet= arg_end + 1;
|
||||
|
||||
|
@ -1755,6 +1755,12 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
|
||||
struct st_plugin_int *tmp;
|
||||
DBUG_ENTER("mysql_install_plugin");
|
||||
|
||||
if (opt_noacl)
|
||||
{
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
|
||||
if (check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -1829,6 +1835,12 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
|
||||
struct st_plugin_int *plugin;
|
||||
DBUG_ENTER("mysql_uninstall_plugin");
|
||||
|
||||
if (opt_noacl)
|
||||
{
|
||||
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
|
||||
|
||||
if (check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
|
||||
|
@ -6935,7 +6935,14 @@ view_err:
|
||||
&index_add_buffer, &index_add_count,
|
||||
&candidate_key_count))
|
||||
goto err;
|
||||
|
||||
|
||||
DBUG_EXECUTE_IF("alter_table_only_metadata_change", {
|
||||
if (need_copy_table_res != ALTER_TABLE_METADATA_ONLY)
|
||||
goto err; });
|
||||
DBUG_EXECUTE_IF("alter_table_only_index_change", {
|
||||
if (need_copy_table_res != ALTER_TABLE_INDEX_CHANGED)
|
||||
goto err; });
|
||||
|
||||
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
|
||||
need_copy_table= need_copy_table_res;
|
||||
}
|
||||
|
@ -1337,6 +1337,16 @@ int multi_update::prepare(List<Item> ¬_used_values,
|
||||
{
|
||||
table->read_set= &table->def_read_set;
|
||||
bitmap_union(table->read_set, &table->tmp_set);
|
||||
/*
|
||||
If a timestamp field settable on UPDATE is present then to avoid wrong
|
||||
update force the table handler to retrieve write-only fields to be able
|
||||
to compare records and detect data change.
|
||||
*/
|
||||
if (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
|
||||
table->timestamp_field &&
|
||||
(table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_UPDATE ||
|
||||
table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH))
|
||||
bitmap_union(table->read_set, table->write_set);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user