Michael Stoppelman wrote:
> comments inline.
>
> On Tue, Aug 26, 2008 at 2:02 AM, Mats Kindahl <[EMAIL PROTECTED]> wrote:
>
>> Michael Stoppelman wrote:
>>> Are there any plans to support master fail-over in drizzle natively?
>> In what sense? Automatically? Probably not immediately, but since it
>> will support plug-ins, it will be possible to write such a thing.
>>
>
> One of the biggest issue with the cloud (like EC2) is that hosts come up and
> down at the whim of the company running it. When your primary database goes
> down it's really one of the worst feelings in the world. If drizzle natively
> supported master failover (automating the 12 step process mysql has [as
> outlined by the new mysql book]), it would save millions of man hours in the
> world and reduce stress of developers/systems folks globally :).
I can imagine. :)
You should have a look at
http://drizzle.wikia.com/wiki/Simple_Replication
The biggest issue with the current replication is that there is no
"global" transaction id, i.e., there is no way to uniquely identify a
specific transaction that has been applied.
Once that is introduced, I'm planning on using a vector clock to track
progress of replication for a slave. By doing this, the slave is not
dependent on the specific log position that the master supplied, at the
cost of a little more expensive negotiation when connecting.
So, once the global transaction id's plus the negotiation when
connecting is in place, it will be simple for a client to redirect the
slave to another master. For kicks, we can use the work in
http://code.launchpad.net/~mkindahl/mysql-server/replication-scripting
and extend it so that a Lua script is executed when the slave detects
that it has lost the master.
>> However, the replication needs to support master fail-over by ensuring
>> that enough data are at the slave to be able to start replicating from
>> another master if the first one goes down, and that is planned.
>>
>
> I'm not exactly sure what would be required from an ACID standpoint, but if
> it can be solved it would be awesome. I'm not sure what RightScale does
> exactly (I've never used their product), but I think they support automated
> master failover. It would be neat for this to be just a feature of drizzle.
I don't think we have to use ACID in this mix at all, except storing the
replication data in transactional tables. Basically, the vector clock
consists of a table that tracks progress of each server that is has
received events from:
CREATE TABLE Slave_Progress (
Server_Id UNSIGNED INT NOT NULL,
Last_Trans_Id UNSIGNED INT NOT NULL,
PRIMARY KEY (Server_Id, Last_Trans_Id));
The master keeps a table available to record the (local) position of
each transaction it has seen, whether it's own or somebody else's.
CREATE TABLE Binary_Log_Index (
Server_Id UNSIGNED INT NOT NULL,
Trans_Id UNSIGNED INT NOT NULL,
Log_Pos UNSIGNED INT NOT NULL,
PRIMARY KEY (Server_Id, Trans_Id));
When connecting, the slave sends over it's vector to tell the master
what it knows about the replication state. After that, the master
decides where to start replicating by taking the earliest position that
is guaranteed to not miss any events, basically computing:
SELECT MIN(Log_Pos)
FROM Slave_Progress S, Binary_Log_Index B
WHERE S.Server_Id = B.Server_Id AND S.Trans_Id = B.Trans_Id;
After this position, it might be that the slave has seen some of the
events, but since it has the progress table already, it has enough
information to skip the events that it has already executed.
This is just a sketch, there are some extra issues that need to be
handled, like what happens when there are changes in the master from
servers that the slave hasn't seen, and some way of easily bootstrapping
slaves.
Just my few cents,
Mats Kindahl
--
Mats Kindahl
Lead Software Developer
Replication Team
MySQL AB, www.mysql.com
begin:vcard
fn:Mats Kindahl
n:Kindahl;Mats
org:Sun Microsystems
adr;quoted-printable:;;Tegv=C3=A4gen 3;Storvreta;SE;74334;Sweden
email;internet:[EMAIL PROTECTED]
title:Lead Replication Software Developer
x-mozilla-html:FALSE
version:2.1
end:vcard
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp