couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <>
Subject I got a little carried away ...
Date Thu, 05 Mar 2009 01:34:42 GMT
I was working through some replication tickets this week and thinking  
more and more that the replicator could benefit from being  
restructured along OTP principles.  So, I went ahead and did it.   
Here's the structure I've worked out so far:

* couch_primary_services gets a new child  
(couch_replication_supervisor) which is itself a supervisor using a  
one_for_one strategy.

* Replications are modeled as gen_servers and added as transient  
children of couch_rep_sup.  couch_rep_sup ensures that identical  
replications do not run simultaneously.

* The gen_server spawn_links a separate process that enumerates the  
docs on the source and makes synchronous calls to the gen_server  
telling it to copy the documents that don't already exist on the target.

* Opening and saving of documents and attachments is handled  
internally by the gen_server.  I'm hoping that concentrating all this  
activity in the server will help us do a better job of pipeline and  
memory management.

Sorry for not discussing a change this big ahead of time.  Damien, I  
saw that you had some recent checkins related to replication security;  
I'd be happy to merge those in.  The replication API itself has not  
changed at all.

This branch is still work-in-progress, but in my opinion it's almost  
as fast as and more robust than the code in trunk right now.  If it  
meets with peoples' approval and we can get some feedback from the  
various reporters in JIRA, it might make sense to tag it for 0.9.   


View raw message