[DBIx-Class-Devel] DBIC Replication

fREW Schmidt frioux at gmail.com
Wed May 8 21:00:16 GMT 2013


Hello all,

Note: The below ideas would benefit the myriad of journalling
solutions (AuditLog, upcoming shadow and the other thing vanstyn is
working on, the abandoned Journal;) so it's not just for my weird case
that this matters.

I briefly discussed this with riba, but I figured I might as well
mention it on the list to get gears turning.

At work we are planning on implementing DBIC level replication (via
log shipping, basically) because:

 * sometimes it is impossible for the underlying database to know how
   to merge two actions, whereas in the app layer we can make a
   sensible choice
 * we want to support heterogeneous configurations (ie some SQL Server
   and some Postgres)
 * not that it matters much but Merge Replication doesn't come with free
   SQL Server, or didn't in 2008r2 anyway

One of the things that I'd like to support, if possible, is resultset
methods.  It doesn't *seem* possible because when using a resultset
method we would basically be saying: "yes, I will *not* be using the
application to handle merges at all" but maybe that's ok.

The idea is to do `$rs->delete` efficiently when possible.  FWIW I'd
probably rename things so that ->delete is ->delete_all and
->native_delete is the original ->delete, but that's a side note.
Same goes for ->update.  The problem is that currently, as far as I
know, resultsets are not introspectable.  So to support $rs->delete
we'd need some kind of way to say: "what are your arguments, $rs?".
This is far enough in the future that a data-query based result may be
sensible.

Additionally, I think DBIC collapses to native-sql too soon sometimes
in our case, so the following would not be cross-db compatible:

  $rs->as_subselect_rs->delete;

I propose (and am willing to work towards) making such "flattening" a
DQ tree, so that it is still at least something generic.  Does that
sound OK to everyone?

As for the ultimate format, the only sane thing to ship in my mind is
DQ trees and maybe some metadata.  IE if it's a "native" call just
translate and run, otherwise introspect it and whatnot.

--
fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20130508/45b64c23/attachment.pgp


More information about the DBIx-Class-Devel mailing list