On Fri, Nov 28, 2003 at 03:25:26PM +0100, Guilhem Bichot wrote:
> On Mon, 2003-11-24 at 22:49, Tim Bunce wrote:
> > On Mon, Nov 24, 2003 at 02:59:40PM +0100, Guilhem Bichot wrote:
> > > On Mon, 2003-11-24 at 12:18, Tim Bunce wrote:
> > > > On Sun, Nov 23, 2003 at 05:03:04PM +0100, guilhem@xxxxxxxxx wrote:
> > > > >
> > > > > ChangeSet
> > > > > 1.1633 03/11/23 17:02:59 guilhem@gbichot2 +6 -0
> > > > > Replication:
> > > > > Now the I/O thread (in flush_master_info()) flushes the relay log
> > > > > to disk
> > > > > after reading every event. Slower but provides additionnal safety
> > > > > in case
> > > > > of brutal crash.
> > > > > I had to make the flush optional (i.e. add a if(some_bool_argument)
> > > > > in the function)
> > > > > because sometimes flush_master_info() is called when there is no
> > > > > usable
> > > > > relay log (the relay log's IO_CACHE is not initialized so can't be
> > > > > flushed).
> > > >
> > > > > @@ -2124,6 +2101,20 @@
> > > > > (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath,
> > > > > mi->ssl_cert,
> > > > > mi->ssl_cipher, mi->ssl_key);
> > > > > flush_io_cache(file);
> > > > > + if (flush_relay_log_cache)
> > > > > + flush_io_cache(mi->rli.relay_log.get_log_file());
> > > >
> > > > Shouldn't that flush be done before the flush_io_cache(file) call above,
> > > > so that the relay log is flushed before master.info is?
> > >
> > > Hi Tim,
> > >
> > > No order is perfect, if the slave mysqld dies brutally between the two
> > > flush_io_cache().
> > > With the order I coded, master.info will contain coordinates of the end
> > > of an event which we have lost in the crash. So, even after restart,
> > > there will me a missing event in the relay log, which will spoil the
> > > slave's data.
> > > With the other order, we will have one event in the relay log, but
> > > master.info will contain coordinates of the previous event, so when the
> > > slave I/O thread later restarts, it will fetch the event again from the
> > > master, so we will have a duplicated event in the relay log, which will
> > > spoil the slave's data.
> > > So, I don't know. Which one do you think is the "least bad"?
> >
> > When you say "spoil the slave's data" do you mean that it can't detect
> > either situation and just continues as if nothing was wrong?
> >
> > Tim.
>
> Yes, that's what I mean.
> Maybe it's better to have a query twice in the relay log (because later
> we could add checks to say "oh, I have just seen the same query; I'll
> ignore this one". I mean with a duplicate info we can scrap one; but
> with lacking info there's nothing we can do.
> So I will swap the flush commands, like you had suggested.
Okay, thanks.
Tim.
--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:
http://lists.mysql.com/internals?unsub=gcdmd-internals@xxxxxxxxxxx
|