Commit 849eafa7 authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0

into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0

parents 9767b637 a2ceebf2
File mode changed from 100644 to 100755
...@@ -73,5 +73,6 @@ hours: ...@@ -73,5 +73,6 @@ hours:
[nick:]checkout:get [nick:]checkout:get
[jonas:]checkout:get [jonas:]checkout:get
[tomas:]checkout:get [tomas:]checkout:get
[guilhem:]checkout:get
checkout:edit checkout:edit
eoln:unix eoln:unix
...@@ -51,5 +51,5 @@ enum options_client ...@@ -51,5 +51,5 @@ enum options_client
#endif #endif
OPT_TRIGGERS, OPT_TRIGGERS,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_AUTO_CLOSE OPT_TZ_UTC, OPT_AUTO_CLOSE
}; };
...@@ -1003,7 +1003,8 @@ static int dump_remote_log_entries(const char* logname) ...@@ -1003,7 +1003,8 @@ static int dump_remote_log_entries(const char* logname)
{ {
char buf[128]; char buf[128];
LAST_EVENT_INFO last_event_info; LAST_EVENT_INFO last_event_info;
uint len, logname_len; ulong len;
uint logname_len;
NET* net; NET* net;
int error= 0; int error= 0;
my_off_t old_off= start_position_mot; my_off_t old_off= start_position_mot;
......
...@@ -92,7 +92,7 @@ static my_bool verbose=0,tFlag=0,dFlag=0,quick= 1, extended_insert= 1, ...@@ -92,7 +92,7 @@ static my_bool verbose=0,tFlag=0,dFlag=0,quick= 1, extended_insert= 1,
opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0, opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
opt_complete_insert= 0, opt_drop_database= 0, opt_complete_insert= 0, opt_drop_database= 0,
opt_dump_triggers= 0, opt_routines=0; opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1;
static ulong opt_max_allowed_packet, opt_net_buffer_length; static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static my_bool insert_pat_inited=0; static my_bool insert_pat_inited=0;
...@@ -385,6 +385,9 @@ static struct my_option my_long_options[] = ...@@ -385,6 +385,9 @@ static struct my_option my_long_options[] =
{"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table", {"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table",
(gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL, (gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0}, NO_ARG, 1, 0, 0, 0, 0, 0},
{"tz-utc", OPT_TZ_UTC,
"SET TIME_ZONE='UTC' at top of dump to allow dumping of date types between servers with different time zones.",
(gptr*) &opt_tz_utc, (gptr*) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE #ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", {"user", 'u', "User for login if not current user.",
(gptr*) &current_user, (gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, (gptr*) &current_user, (gptr*) &current_user, 0, GET_STR, REQUIRED_ARG,
...@@ -509,6 +512,13 @@ static void write_header(FILE *sql_file, char *db_name) ...@@ -509,6 +512,13 @@ static void write_header(FILE *sql_file, char *db_name)
"\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
"\n/*!40101 SET NAMES %s */;\n",default_charset); "\n/*!40101 SET NAMES %s */;\n",default_charset);
if (opt_tz_utc)
{
fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n");
}
if (!path) if (!path)
{ {
fprintf(md_result_file,"\ fprintf(md_result_file,"\
...@@ -535,6 +545,9 @@ static void write_footer(FILE *sql_file) ...@@ -535,6 +545,9 @@ static void write_footer(FILE *sql_file)
} }
else if (!opt_compact) else if (!opt_compact)
{ {
if (opt_tz_utc)
fprintf(sql_file,"/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;\n");
fprintf(sql_file,"\n/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n"); fprintf(sql_file,"\n/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n");
if (!path) if (!path)
{ {
...@@ -902,6 +915,20 @@ static int dbConnect(char *host, char *user,char *passwd) ...@@ -902,6 +915,20 @@ static int dbConnect(char *host, char *user,char *passwd)
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
return 1; return 1;
} }
/*
set time_zone to UTC to allow dumping date types between servers with
different time zone settings
*/
if (opt_tz_utc)
{
my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */");
if (mysql_query_with_error_report(sock, 0, buff))
{
mysql_close(sock);
safe_exit(EX_MYSQLERR);
return 1;
}
}
return 0; return 0;
} /* dbConnect */ } /* dbConnect */
......
...@@ -158,7 +158,8 @@ extern gptr my_memdup(const byte *from,uint length,myf MyFlags); ...@@ -158,7 +158,8 @@ extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags); extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strdup_with_length(const byte *from, uint length, extern char *my_strdup_with_length(const byte *from, uint length,
myf MyFlags); myf MyFlags);
#define my_free(PTR,FG) my_no_flags_free(PTR) /* we do use FG (as a no-op) in below so that a typo on FG is caught */
#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
#define CALLER_INFO_PROTO /* nothing */ #define CALLER_INFO_PROTO /* nothing */
#define CALLER_INFO /* nothing */ #define CALLER_INFO /* nothing */
#define ORIG_CALLER_INFO /* nothing */ #define ORIG_CALLER_INFO /* nothing */
......
...@@ -61,6 +61,7 @@ dist-hook: ...@@ -61,6 +61,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
...@@ -89,6 +90,7 @@ install-data-local: ...@@ -89,6 +90,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
......
...@@ -79,7 +79,7 @@ Table Create Table ...@@ -79,7 +79,7 @@ Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(20) NOT NULL, `id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default '' `name` varchar(32) NOT NULL default ''
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:9308/federated/t1' ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
SELECT * FROM federated.t2; SELECT * FROM federated.t2;
......
This diff is collapsed.
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;
reset master;
change master to master_host="127.0.0.1",master_port=SLAVE_PORT,master_user="root";
start slave;
create table t1 (n int);
create table t4 (n int);
create table t5 (n int);
create table t6 (n int);
show tables;
Tables_in_test
t1
t4
t5
t6
stop slave;
reset slave;
drop table t1,t4,t5,t6;
...@@ -264,6 +264,14 @@ master-bin.000002 # Query 1 # use `mysqltest1`; insert into t1 values (1) ...@@ -264,6 +264,14 @@ master-bin.000002 # Query 1 # use `mysqltest1`; insert into t1 values (1)
select * from t1; select * from t1;
a a
1 1
create procedure foo()
not deterministic
reads sql data
select * from t1;
call foo();
a
1
drop procedure foo;
drop function fn1; drop function fn1;
drop database mysqltest1; drop database mysqltest1;
drop user "zedjzlcsjhd"@127.0.0.1; drop user "zedjzlcsjhd"@127.0.0.1;
...@@ -834,3 +834,41 @@ ERROR HY000: Not allowed to set autocommit from a stored function or trigger ...@@ -834,3 +834,41 @@ ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create trigger bug12712 create trigger bug12712
before insert on t1 for each row set session autocommit = 0; before insert on t1 for each row set session autocommit = 0;
ERROR HY000: Not allowed to set autocommit from a stored function or trigger ERROR HY000: Not allowed to set autocommit from a stored function or trigger
drop procedure if exists bug13510_1|
drop procedure if exists bug13510_2|
drop procedure if exists bug13510_3|
drop procedure if exists bug13510_4|
create procedure bug13510_1()
begin
declare password varchar(10);
set password = 'foo1';
select password;
end|
ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
create procedure bug13510_2()
begin
declare names varchar(10);
set names = 'foo2';
select names;
end|
ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
create procedure bug13510_3()
begin
declare password varchar(10);
set `password` = 'foo3';
select password;
end|
create procedure bug13510_4()
begin
declare names varchar(10);
set `names` = 'foo4';
select names;
end|
call bug13510_3()|
password
foo3
call bug13510_4()|
names
foo4
drop procedure bug13510_3|
drop procedure bug13510_4|
...@@ -2987,3 +2987,4 @@ select * from (select max(fld) from t1) as foo; ...@@ -2987,3 +2987,4 @@ select * from (select max(fld) from t1) as foo;
max(fld) max(fld)
1 1
drop table t1; drop table t1;
purge master logs before (select adddate(current_timestamp(), interval -4 day));
...@@ -75,7 +75,8 @@ eval CREATE TABLE federated.t2 ( ...@@ -75,7 +75,8 @@ eval CREATE TABLE federated.t2 (
ENGINE="FEDERATED" DEFAULT CHARSET=latin1 ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
SHOW CREATE TABLE federated.t2; --replace_result $SLAVE_MYPORT SLAVE_PORT
eval SHOW CREATE TABLE federated.t2;
INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
......
...@@ -907,3 +907,24 @@ DROP PROCEDURE bug9056_proc1; ...@@ -907,3 +907,24 @@ DROP PROCEDURE bug9056_proc1;
DROP PROCEDURE bug9056_proc2; DROP PROCEDURE bug9056_proc2;
drop table t1; drop table t1;
#
# BUG# 13052 - mysqldump timestamp reloads broken
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (`d` timestamp, unique (`d`));
set time_zone='+00:00';
insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00');
# results should show two different time values
select * from t1;
set time_zone='Europe/Moscow';
# results should show two same time values, despite unique
select * from t1;
set global time_zone='Europe/Moscow';
--exec $MYSQL_DUMP --skip-comments --databases test
--exec $MYSQL_DUMP --skip-tz-utc --skip-comments --databases test
drop table t1;
set global time_zone=default;
set time_zone=default;
# This test checks that in a dual-head setup
# A->B->A, where A has --log-slave-updates (why would it?
# assume that there is a C as slave of A),
# then the Exec_master_log_pos of SHOW SLAVE STATUS does
# not stay too low on B(BUG#13023 due to events ignored because
# of their server id).
# It also will test BUG#13861.
source include/master-slave.inc;
# set up "dual head"
connection slave;
reset master;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root";
start slave;
# now we test it
connection slave;
create table t1 (n int);
save_master_pos;
connection master;
sync_with_master;
# Now test BUG#13861. This will be enabled when Guilhem fixes this
# bug.
# stop slave
# create table t2 (n int); # create one ignored event
# save_master_pos;
# connection slave;
# sync_with_master;
# connection slave;
# show tables;
# save_master_pos;
# create table t3 (n int);
# connection master;
# bug is that START SLAVE UNTIL may stop too late, we test that by
# asking it to stop before creation of t3.
# start slave until master_log_file="slave-bin.000001",master_log_pos=195;
# wait until it's started (the position below is the start of "CREATE
# TABLE t2") (otherwise wait_for_slave_to_stop may return at once)
# select master_pos_wait("slave-bin.000001",137);
# wait_for_slave_to_stop;
# then BUG#13861 causes t3 to show up below (because stopped too
# late).
# show tables;
# start slave;
# BUG#13023 is that Exec_master_log_pos may stay too low "forever":
connection master;
create table t4 (n int); # create 3 ignored events
create table t5 (n int);
create table t6 (n int);
save_master_pos;
connection slave;
sync_with_master;
connection slave;
save_master_pos;
connection master;
# then BUG#13023 caused hang below ("master" looks behind, while it's
# not in terms of updates done).
sync_with_master;
show tables;
# cleanup
stop slave;
reset slave;
drop table t1,t4,t5,t6; # add t2 and t3 later
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
...@@ -258,6 +258,23 @@ sync_slave_with_master; ...@@ -258,6 +258,23 @@ sync_slave_with_master;
select * from t1; select * from t1;
#
# Test for bug #13969 "Routines which are replicated from master can't be
# executed on slave".
#
connection master;
create procedure foo()
not deterministic
reads sql data
select * from t1;
sync_slave_with_master;
# This should not fail
call foo();
connection master;
drop procedure foo;
sync_slave_with_master;
# Clean up # Clean up
connection master; connection master;
drop function fn1; drop function fn1;
......
...@@ -1212,6 +1212,59 @@ call bug9367(); ...@@ -1212,6 +1212,59 @@ call bug9367();
drop procedure bug9367; drop procedure bug9367;
drop table t1; drop table t1;
--enable_parsing --enable_parsing
#
# BUG#13510: Setting password local variable changes current password
#
delimiter |;
--disable_warnings
drop procedure if exists bug13510_1|
drop procedure if exists bug13510_2|
drop procedure if exists bug13510_3|
drop procedure if exists bug13510_4|
--enable_warnings
--error ER_SP_BAD_VAR_SHADOW
create procedure bug13510_1()
begin
declare password varchar(10);
set password = 'foo1';
select password;
end|
--error ER_SP_BAD_VAR_SHADOW
create procedure bug13510_2()
begin
declare names varchar(10);
set names = 'foo2';
select names;
end|
create procedure bug13510_3()
begin
declare password varchar(10);
set `password` = 'foo3';
select password;
end|
create procedure bug13510_4()
begin
declare names varchar(10);
set `names` = 'foo4';
select names;
end|
call bug13510_3()|
call bug13510_4()|
drop procedure bug13510_3|
drop procedure bug13510_4|
delimiter ;|
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
......
...@@ -1962,4 +1962,9 @@ insert into t1 values ('1'); ...@@ -1962,4 +1962,9 @@ insert into t1 values ('1');
select * from (select max(fld) from t1) as foo; select * from (select max(fld) from t1) as foo;
drop table t1; drop table t1;
#
# BUG #10308: purge log with subselect
#
purge master logs before (select adddate(current_timestamp(), interval -4 day));
...@@ -52,7 +52,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags) ...@@ -52,7 +52,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags)
if ((point = (char*)realloc(oldpoint,size)) == NULL) if ((point = (char*)realloc(oldpoint,size)) == NULL)
{ {
if (my_flags & MY_FREE_ON_ERROR) if (my_flags & MY_FREE_ON_ERROR)
my_free(oldpoint,MyFLAGS); my_free(oldpoint, my_flags);
if (my_flags & MY_HOLD_ON_ERROR) if (my_flags & MY_HOLD_ON_ERROR)
DBUG_RETURN(oldpoint); DBUG_RETURN(oldpoint);
my_errno=errno; my_errno=errno;
......
...@@ -232,6 +232,7 @@ $CP mysql-test/t/*.def $BASE/mysql-test/t ...@@ -232,6 +232,7 @@ $CP mysql-test/t/*.def $BASE/mysql-test/t
$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ $CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \
mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
mysql-test/std_data/*.cnf \
$BASE/mysql-test/std_data $BASE/mysql-test/std_data
$CP mysql-test/t/*.test mysql-test/t/*.disabled mysql-test/t/*.opt \ $CP mysql-test/t/*.test mysql-test/t/*.disabled mysql-test/t/*.opt \
mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
......
...@@ -7042,8 +7042,7 @@ ha_innobase::cmp_ref( ...@@ -7042,8 +7042,7 @@ ha_innobase::cmp_ref(
(const char*)ref1, len1, (const char*)ref1, len1,
(const char*)ref2, len2); (const char*)ref2, len2);
} else { } else {
result = field->key_cmp((const char*)ref1, result = field->key_cmp(ref1, ref2);
(const char*)ref2);
} }
if (result) { if (result) {
......
...@@ -1353,7 +1353,8 @@ void MYSQL_LOG::new_file(bool need_lock) ...@@ -1353,7 +1353,8 @@ void MYSQL_LOG::new_file(bool need_lock)
to change base names at some point. to change base names at some point.
*/ */
THD *thd = current_thd; /* may be 0 if we are reacting to SIGHUP */ THD *thd = current_thd; /* may be 0 if we are reacting to SIGHUP */
Rotate_log_event r(thd,new_name+dirname_length(new_name)); Rotate_log_event r(thd,new_name+dirname_length(new_name),
0, LOG_EVENT_OFFSET, 0);
r.write(&log_file); r.write(&log_file);
bytes_written += r.data_written; bytes_written += r.data_written;
} }
...@@ -1432,7 +1433,7 @@ bool MYSQL_LOG::appendv(const char* buf, uint len,...) ...@@ -1432,7 +1433,7 @@ bool MYSQL_LOG::appendv(const char* buf, uint len,...)
DBUG_ASSERT(log_file.type == SEQ_READ_APPEND); DBUG_ASSERT(log_file.type == SEQ_READ_APPEND);
pthread_mutex_lock(&LOCK_log); safe_mutex_assert_owner(&LOCK_log);
do do
{ {
if (my_b_append(&log_file,(byte*) buf,len)) if (my_b_append(&log_file,(byte*) buf,len))
...@@ -1447,7 +1448,6 @@ bool MYSQL_LOG::appendv(const char* buf, uint len,...) ...@@ -1447,7 +1448,6 @@ bool MYSQL_LOG::appendv(const char* buf, uint len,...)
new_file(0); new_file(0);
err: err:
pthread_mutex_unlock(&LOCK_log);
if (!error) if (!error)
signal_update(); signal_update();
DBUG_RETURN(error); DBUG_RETURN(error);
......
...@@ -2962,13 +2962,39 @@ void Rotate_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_ ...@@ -2962,13 +2962,39 @@ void Rotate_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
/* /*
Rotate_log_event::Rotate_log_event() Rotate_log_event::Rotate_log_event() (2 constructors)
*/ */
#ifndef MYSQL_CLIENT
Rotate_log_event::Rotate_log_event(THD* thd_arg,
const char* new_log_ident_arg,
uint ident_len_arg, ulonglong pos_arg,
uint flags_arg)
:Log_event(), new_log_ident(new_log_ident_arg),
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
(uint) strlen(new_log_ident_arg)), flags(flags_arg)
{
#ifndef DBUG_OFF
char buff[22];
DBUG_ENTER("Rotate_log_event::Rotate_log_event(THD*,...)");
DBUG_PRINT("enter",("new_log_ident %s pos %s flags %lu", new_log_ident_arg,
llstr(pos_arg, buff), flags));
#endif
if (flags & DUP_NAME)
new_log_ident= my_strdup_with_length(new_log_ident_arg,
ident_len,
MYF(MY_WME));
DBUG_VOID_RETURN;
}
#endif
Rotate_log_event::Rotate_log_event(const char* buf, uint event_len, Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event) const Format_description_log_event* description_event)
:Log_event(buf, description_event) ,new_log_ident(NULL),alloced(0) :Log_event(buf, description_event) ,new_log_ident(0), flags(DUP_NAME)
{ {
DBUG_ENTER("Rotate_log_event::Rotate_log_event(char*,...)"); DBUG_ENTER("Rotate_log_event::Rotate_log_event(char*,...)");
// The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET // The caller will ensure that event_len is what we have at EVENT_LEN_OFFSET
...@@ -2983,12 +3009,9 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len, ...@@ -2983,12 +3009,9 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len,
(header_size+post_header_len)); (header_size+post_header_len));
ident_offset = post_header_len; ident_offset = post_header_len;
set_if_smaller(ident_len,FN_REFLEN-1); set_if_smaller(ident_len,FN_REFLEN-1);
if (!(new_log_ident= my_strdup_with_length((byte*) buf + new_log_ident= my_strdup_with_length((byte*) buf + ident_offset,
ident_offset, (uint) ident_len,
(uint) ident_len, MYF(MY_WME));
MYF(MY_WME))))
DBUG_VOID_RETURN;
alloced = 1;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -1247,18 +1247,17 @@ public: ...@@ -1247,18 +1247,17 @@ public:
class Rotate_log_event: public Log_event class Rotate_log_event: public Log_event
{ {
public: public:
enum {
DUP_NAME= 2 // if constructor should dup the string argument
};
const char* new_log_ident; const char* new_log_ident;
ulonglong pos; ulonglong pos;
uint ident_len; uint ident_len;
bool alloced; uint flags;
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg, Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
uint ident_len_arg = 0, uint ident_len_arg,
ulonglong pos_arg = LOG_EVENT_OFFSET) ulonglong pos_arg, uint flags);
:Log_event(), new_log_ident(new_log_ident_arg),
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
(uint) strlen(new_log_ident_arg)), alloced(0)
{}
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol); void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli); int exec_event(struct st_relay_log_info* rli);
...@@ -1271,8 +1270,8 @@ public: ...@@ -1271,8 +1270,8 @@ public:
const Format_description_log_event* description_event); const Format_description_log_event* description_event);
~Rotate_log_event() ~Rotate_log_event()
{ {
if (alloced) if (flags & DUP_NAME)
my_free((gptr) new_log_ident, MYF(0)); my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
} }
Log_event_type get_type_code() { return ROTATE_EVENT;} Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;} int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
......
...@@ -5420,3 +5420,5 @@ ER_ROW_IS_REFERENCED_2 23000 ...@@ -5420,3 +5420,5 @@ ER_ROW_IS_REFERENCED_2 23000
eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)"
ER_NO_REFERENCED_ROW_2 23000 ER_NO_REFERENCED_ROW_2 23000
eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)" eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)"
ER_SP_BAD_VAR_SHADOW 42000
eng "Variable '%-.64s' must be quoted with `...`, or renamed"
This diff is collapsed.
...@@ -302,6 +302,17 @@ typedef struct st_relay_log_info ...@@ -302,6 +302,17 @@ typedef struct st_relay_log_info
*/ */
ulong trans_retries, retried_trans; ulong trans_retries, retried_trans;
/*
If the end of the hot relay log is made of master's events ignored by the
slave I/O thread, these two keep track of the coords (in the master's
binlog) of the last of these events seen by the slave I/O thread. If not,
ign_master_log_name_end[0] == 0.
As they are like a Rotate event read/written from/to the relay log, they
are both protected by rli->relay_log.LOCK_log.
*/
char ign_master_log_name_end[FN_REFLEN];
ulonglong ign_master_log_pos_end;
st_relay_log_info(); st_relay_log_info();
~st_relay_log_info(); ~st_relay_log_info();
......
...@@ -1052,8 +1052,10 @@ int sp_head::execute(THD *thd) ...@@ -1052,8 +1052,10 @@ int sp_head::execute(THD *thd)
original thd->db will then have been freed */ original thd->db will then have been freed */
if (dbchanged) if (dbchanged)
{ {
/* No access check when changing back to where we came from.
(It would generate an error from mysql_change_db() when olddb=="") */
if (! thd->killed) if (! thd->killed)
ret= mysql_change_db(thd, olddb, 0); ret= mysql_change_db(thd, olddb, 1);
} }
m_flags&= ~IS_INVOKED; m_flags&= ~IS_INVOKED;
DBUG_RETURN(ret); DBUG_RETURN(ret);
...@@ -2651,9 +2653,24 @@ sp_change_security_context(THD *thd, sp_head *sp, Security_context **backup) ...@@ -2651,9 +2653,24 @@ sp_change_security_context(THD *thd, sp_head *sp, Security_context **backup)
sp->m_definer_host.str, sp->m_definer_host.str,
sp->m_db.str)) sp->m_db.str))
{ {
#ifdef NOT_YET_REPLICATION_SAFE
/*
Until we don't properly replicate information about stored routine
definer with stored routine creation statement all stored routines
on slave are created under ''@'' definer. Therefore we won't be able
to run any routine which was replicated from master on slave server
if we emit error here. This will cause big problems for users
who use slave for fail-over. So until we fully implement WL#2897
"Complete definer support in the stored routines" we run suid
stored routines for which we were unable to find definer under
invoker security context.
*/
my_error(ER_NO_SUCH_USER, MYF(0), sp->m_definer_user.str, my_error(ER_NO_SUCH_USER, MYF(0), sp->m_definer_user.str,
sp->m_definer_host.str); sp->m_definer_host.str);
return TRUE; return TRUE;
#else
return FALSE;
#endif
} }
*backup= thd->security_ctx; *backup= thd->security_ctx;
thd->security_ctx= &sp->m_security_ctx; thd->security_ctx= &sp->m_security_ctx;
......
...@@ -7992,6 +7992,18 @@ option_value: ...@@ -7992,6 +7992,18 @@ option_value:
$2= $2 ? $2: global_system_variables.character_set_client; $2= $2 ? $2: global_system_variables.character_set_client;
lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2)); lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2));
} }
| NAMES_SYM equal expr
{
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
LEX_STRING names;
names.str= (char *)"names";
names.length= 5;
if (spc && spc->find_pvar(&names))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
YYABORT;
}
| NAMES_SYM charset_name_or_default opt_collate | NAMES_SYM charset_name_or_default opt_collate
{ {
LEX *lex= Lex; LEX *lex= Lex;
...@@ -8009,6 +8021,17 @@ option_value: ...@@ -8009,6 +8021,17 @@ option_value:
{ {
THD *thd=YYTHD; THD *thd=YYTHD;
LEX_USER *user; LEX_USER *user;
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
LEX_STRING pw;
pw.str= (char *)"password";
pw.length= 8;
if (spc && spc->find_pvar(&pw))
{
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str);
YYABORT;
}
if (!(user=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) if (!(user=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
YYABORT; YYABORT;
user->host=null_lex_str; user->host=null_lex_str;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment