我们正在使用 CouchDB(v 2.3.1)。
我们有一个复制功能,可以将数据从一台服务器复制到另一台服务器。源服务器也会时不时地不断获取新数据。
我正在研究下面提到的类似算法:
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.
参考:算法参考
问题 - 1 在这种情况下,复制是否会影响 CouchDB 维护的 _changes feed?
不完全确定您在问什么,如果您正在读取目标数据库
_changes
,那么是的,从源到该数据库的复制将更改该目标数据库的_changes
提要。
如果您询问您阅读
_changes
提要的行为是否会影响或受到阅读 _changes
提要的复制的影响,那么不会。读取操作不会以任何方式改变服务器/数据库的状态。
为了澄清
seq
/last_seq
不会因读取而改变,并且连续复制会维持其处理的 last_seq
的状态,请参阅 /_scheduler/docs
更多信息。