Commit 5dcfa572 authored by unknown's avatar unknown

Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0

into  mysql.com:/users/lthalmann/bk/mysql-5.0-mysqlbinlog-ulong

parents 7b8f2df2 ada1f886
File mode changed from 100644 to 100755
......@@ -73,5 +73,6 @@ hours:
[nick:]checkout:get
[jonas:]checkout:get
[tomas:]checkout:get
[guilhem:]checkout:get
checkout:edit
eoln:unix
......@@ -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_with_length(const byte *from, uint length,
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 /* nothing */
#define ORIG_CALLER_INFO /* nothing */
......
......@@ -79,7 +79,7 @@ Table Create Table
t2 CREATE TABLE `t2` (
`id` int(20) NOT NULL,
`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 (2, 'fee');
SELECT * FROM federated.t2;
......
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;
......@@ -2987,3 +2987,4 @@ select * from (select max(fld) from t1) as foo;
max(fld)
1
drop table t1;
purge master logs before (select adddate(current_timestamp(), interval -4 day));
......@@ -75,7 +75,8 @@ eval CREATE TABLE federated.t2 (
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
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 (2, 'fee');
......
# 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
......@@ -1962,4 +1962,9 @@ insert into t1 values ('1');
select * from (select max(fld) from t1) as foo;
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)
if ((point = (char*)realloc(oldpoint,size)) == NULL)
{
if (my_flags & MY_FREE_ON_ERROR)
my_free(oldpoint,MyFLAGS);
my_free(oldpoint, my_flags);
if (my_flags & MY_HOLD_ON_ERROR)
DBUG_RETURN(oldpoint);
my_errno=errno;
......
......@@ -1353,7 +1353,8 @@ void MYSQL_LOG::new_file(bool need_lock)
to change base names at some point.
*/
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);
bytes_written += r.data_written;
}
......@@ -1432,7 +1433,7 @@ bool MYSQL_LOG::appendv(const char* buf, uint len,...)
DBUG_ASSERT(log_file.type == SEQ_READ_APPEND);
pthread_mutex_lock(&LOCK_log);
safe_mutex_assert_owner(&LOCK_log);
do
{
if (my_b_append(&log_file,(byte*) buf,len))
......@@ -1447,7 +1448,6 @@ bool MYSQL_LOG::appendv(const char* buf, uint len,...)
new_file(0);
err:
pthread_mutex_unlock(&LOCK_log);
if (!error)
signal_update();
DBUG_RETURN(error);
......
......@@ -2962,13 +2962,39 @@ void Rotate_log_event::print(FILE* file, bool short_form, LAST_EVENT_INFO* last_
#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,
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*,...)");
// 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,
(header_size+post_header_len));
ident_offset = post_header_len;
set_if_smaller(ident_len,FN_REFLEN-1);
if (!(new_log_ident= my_strdup_with_length((byte*) buf +
ident_offset,
(uint) ident_len,
MYF(MY_WME))))
DBUG_VOID_RETURN;
alloced = 1;
new_log_ident= my_strdup_with_length((byte*) buf + ident_offset,
(uint) ident_len,
MYF(MY_WME));
DBUG_VOID_RETURN;
}
......
......@@ -1247,18 +1247,17 @@ public:
class Rotate_log_event: public Log_event
{
public:
enum {
DUP_NAME= 2 // if constructor should dup the string argument
};
const char* new_log_ident;
ulonglong pos;
uint ident_len;
bool alloced;
uint flags;
#ifndef MYSQL_CLIENT
Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
uint ident_len_arg = 0,
ulonglong pos_arg = LOG_EVENT_OFFSET)
: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)
{}
uint ident_len_arg,
ulonglong pos_arg, uint flags);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
......@@ -1271,8 +1270,8 @@ public:
const Format_description_log_event* description_event);
~Rotate_log_event()
{
if (alloced)
my_free((gptr) new_log_ident, MYF(0));
if (flags & DUP_NAME)
my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
}
Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
......
This diff is collapsed.
......@@ -302,6 +302,17 @@ typedef struct st_relay_log_info
*/
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();
......
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