我在使用 couchdb 复制时遇到了这个问题:我正在使用带有此设置文档的复制器数据库:
{
"_id": "source_to_target",
"_rev": "1-2a6510e28c2cc7caf0d58a85d705d2b8",
"source": "http://xxxx:xxxx@localhost:5984/sourcedb",
"target": "targetdb",
"create_target": true,
"continuous": true,
"filter": "sourcedb/repl_filter",
"query_params": {
"someproperty": "somevalue"
},
"user_ctx": {
"name": "someadmin",
"roles": [
"_admin"
]
}
}
问题是过滤器功能被忽略了。我确信这是正确的,因为如果我调用:
curl -X GET "http://localhost:5984/sourcedb/_changes?filter=sourcedb/repl_filter&someproperty=somevalue&feed=continuous&style=all_docs&since=0"
结果被正确过滤。
我执行如下测试:
我完全擦除了目标数据库。然后我删除上面的复制并从头开始重新创建它。一旦上面显示的复制文档被提交,复制就会开始,而不是过滤的文档,目标数据库获取所有文档,这构成了我的问题。日志提示了原因:
[Fri, 20 Jul 2012 17:43:38 GMT] [info] [<0.5860.17>] Replication records differ. Scanning histories to find a common ancestor.
[Fri, 20 Jul 2012 17:43:38 GMT] [info] [<0.5860.17>] no common ancestry -- performing full replication
,这让我摸不着头脑,因为我在开始复制之前完全擦除了目标数据库,为什么要使用尚未创建的数据库搜索常见的祖先?显然我错过了一些东西,但我无法弄清楚。有什么建议么?