[ZODB-Dev] Synchronizing Mirror Sites

Shane Hathaway shane at zope.com
Tue Jul 22 12:04:37 EDT 2003


Norfleet, Sheppard S. wrote:
> Ok, in this case how would I go about replication at the application level.
> This is my first foray into ZODB.  Is there already a replication service
> that doesnt require the master server's IP to be always available(queued). I
> believe ZEO requires the IP to be available at any time.

If you do replication at the application level, you don't need to change 
ZODB or learn a lot about it.  Instead, you have to come up with your 
own application-specific mirroring protocol.  Sorry.  It might work 
something like this:

log = ChangeLog()

class Foo:

     def setBar(self, b):
         self.bar = b
         log.add(self, 'setBar', b)

class ChangeLog:

     def __init__(self):
         self.changes = {}

     def add(self, obj, method, *args):
         self.changes[(obj, method)] = args

     def replay(self):
         for (obj, method), args in self.changes.items():
             getattr(obj, method)(*args)

Replication would involve copying the ChangeLog object to another node 
and calling replay().  Again, it has little to do with ZODB.  For simple 
applications it might work fine.

>>Alternatively, you can use Ape with a version control tool to merge data at
> 
> the database level.
> 
> Sorry, what would the effect of a corrupted ZODB cache be?  Not good, eh?

Ape doesn't corrupt the ZODB cache, but it doesn't keep it in sync 
automatically with the data yet.  The result is countless 
ConflictErrors.  I'm working on it.

Shane




More information about the ZODB-Dev mailing list