[Dbix-class] Storage::DBI::Replication

Tim Bunce Tim.Bunce at pobox.com
Fri Sep 15 17:07:59 CEST 2006


On Fri, Sep 15, 2006 at 01:19:40PM +0200, Norbert CSONGRADI wrote:
> I created a branch for replication support in DBIC 
> (http://dev.catalyst.perl.org/trac/bast/browser/branches/DBIx-Class/replication).
> The new Storage module (Storage::DBI::Replication) supports replicated data 
> sources: one master database and many slaves.
> 
> Please check it's documentation on details how to set up and use it.
> We use it in production enviroment with MySQL. If you could test it with other 
> databases or could test transactions, please report me any success or 
> failure.
> 
> For me, currently the only missing feature is the handling of replication lag. 
> In non-DBIC enviroment, we added a flag to the database handler "urgent" 
> which forces using of the master database handle for any kind of operations 
> (both write and read) for the current session. Is it acceptable for DBIC in 
> your opinion?

It's by far the simplest approach.

A slight addition may be useful: the urgent flag could be either 0 or 1
or, if greater than 1, then treat it as the timestamp of the operation on
the master database. That way (a subclass of) the Storage::DBI::Replication
code has the option compare the timestamp with the current replication lag
to decide if it really needs to use the master or not.

Tim.

> More documentation, code cleanup, and tests are on the way...
> 
> -- 
>    Norbert Csongradi
> 
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/



More information about the Dbix-class mailing list