Does replication in couchdb affects the _changes feed?

80 Views Asked by At

We are using CouchDB (v 2.3.1).

We have a replication to copy the data from one server to another. The source server will also keep getting new data from time to time.

I am working on a similar algorithm mentioned below:

1. read /dbname/_changes
2. process each row idempotently
3. periodically (every X seconds or every X rows) store the "seq" value of the last row you processed

If you ever crash, or if you weren't using continuous=true, you can do this same procedure again but modified in step 1;

revised 1. read /dbname/_changes?since=X

where X is the value you saved in step 3. If you're not using continuous mode then you could just record the "last_seq" value at the end of consuming the non-continuous response.

Reference: Algo reference

Question - 1 In this scenario, does the replication affect the _changes feed maintained by CouchDB?

1

There are 1 best solutions below

4
On

Not entirely sure what you're asking, IF you're reading the target DB _changes, then yes a replication from source to that DB will change the _changes feed of that target DB.

If you're asking whether your act of reading the _changes feed will impact or be impacted by the replication reading the _changes feed, then no. The read operation doesn't change the state of the server/DB in any way.

To clarify the seq/last_seq is unchanged by reads, and continuous replications maintain their own state of the last_seq they processed, see /_scheduler/docs more here.