Hi!

----- Original Message -----
From: "Benjamin Pflugmann" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.mysql
Sent: Saturday, December 07, 2002 4:59 PM
Subject: Re: Question about SLAVE STOP


> Hello.
>
> On Sat 2002-12-07 at 14:26:00 +0100, [EMAIL PROTECTED] wrote:
> > Hello.
> >
> > On Fri 2002-12-06 at 16:13:54 -0600, [EMAIL PROTECTED]
wrote:
> > >
> > > First off, we are using Innodb tables on version 3.23.53a-max.
> > >
> > > If the command STOP SLAVE is issued in the middle of the following
type of
> > > transaction:
> > >
> > > set autocommit = 0;
> > > update...;
> > > update...;
> > > update...;
> > > commit;
> > >
> > > does it roll back the current transaction or wait for it to complete?
> [...]
> > I decided to dig in the source a bit (v3.23.46).
> [...]
> > In short, it seems the slave thread effectively runs in auto-commit
> > mode which is not what you want.
> >
> > I found a somewhat old post by Heikki (the InnoDB deveoper) which
> > basically says the same:
> >
> >   http://lists.mysql.com/cgi-ez/ezmlm-cgi?1:mss:79650
>
> I just happened to see in the changelog, that this is out of date. As
> of 3.23.52, it wraps BEGIN/COMMIT:
>
>   D.3.3 Changes in release 3.23.52 (14 Aug 2002)
>
>     * Wrap BEGIN/COMMIT around transaction in the binary log. This
>       makes replication honour transactions.
>
> Sorry about that. Teaches me to not presume that there were no
> important changes in the last few stable releases.

a good point from Carl. It may be the slave rolls back the current
transaction if SLAVE STOP is issued in the middle of a transaction.

Thus, we may have a defect in replication: if execution was inside BEGIN ...
END, when you issue SLAVE START it should restart the slave from the latest
BEGIN in the binlog.

Since MySQL atomically writes to the binlog the records associated with a
transaction, it may be that SLAVE STOP + SLAVE START usually does not break
transactions. But it might happen.

I guess the easy solution is simply to prevent the slave from stopping when
we have a BEGIN open in the replication. It should wait for END.

I looked into the source code of 4.0.6, but I did not see how slave_stop()
and terminate_slave_thread() protect against killing the slave thread in the
middle of an SQL statement. If that is allowed, then SLAVE STOP might also
break MyISAM replication. But we have no bug reports of SLAVE STOP breaking
replication. If there is a bug, it does not occur too often.

I am forwarding this to the replication developer of MySQL AB. He has to
check the mechanisms.

> Bye,
>
> Benjamin.
>
> --
> [EMAIL PROTECTED]

Best regards,

Heikki Tuuri
Innobase Oy
---
InnoDB - transactions, hot backup, and foreign key support for MySQL
See http://www.innodb.com, download MySQL-Max from http://www.mysql.com

sql query




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to