Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Enable permanent replication by writing to "_replicator" database instead of "_replicate" database. #349

Open
carlosduclos opened this issue Feb 2, 2017 · 3 comments

Comments

@carlosduclos
Copy link

According to http://guide.couchdb.org/draft/replication.html (and own testing), writing a replication document to "_replicate" will enable replication only for the current server session, but after a server restart it will not enable it again.

Relates to #290

@carlosduclos
Copy link
Author

CouchDB developers in their infinite wisdom handle requests to "_replicator" differently from requests to "_replicate".

While requests to "_replicate" replied with a full response, requests to "_replicator" reply with a partial response and need to be polled until the replication is done. Working on implementing that.

@carlosduclos
Copy link
Author

After a few tries, I came to the conclusion that this requires at least two different methods. The reason is that replication will be scheduled after a write to "_replicator" and couchdb will handle the status internally. At some point in time the replication will finish (either successfully or with error), but there is no way to know when.

The idea behind this is to allow for a fully asynchronous API that can monitor the status of the replication without having to wait on it. This is especially important in large replication where the time involved in replication might be measured in several minutes, hours or even days!

So I have come up with three methods:

  • enableReplication: Starts the replication from a given db to a target db.
  • queryReplication: Queries the state of the replication at that time.
  • disableReplication: Stops the replication process.

@carlosduclos
Copy link
Author

Sent pull request #350

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant