CouchDB - 删除后视图未更新
我有一个与此类似的观点(一个人为的例子):
函数(文档){
if (doc.attrib) { 发出([doc.attrib],doc._id) }
}
都按预期进行,直到数据被删除。我遇到了这种疯狂的情况,实际数据库中没有数据(通过在curl上运行的_all_docs和_changes以及Futon上的all_documents确认)。然而,该视图仍然会产生数据(同样在curl和Futon上)。
删除包括通过 ektorp 进行批量删除和清除操作。每次确认这些工作按预期进行后运行 _changes。重新创建视图使其反映数据库中文档的真实状态。
我是否在这里错过了一些明显的东西,或者 CouchDB 中的视图只是增量的?
I have a view similar to this (a contrived example):
function(doc) {
if (doc.attrib) {
emit([doc.attrib],doc._id)
}
}
Everything works as expected until the data is deleted. I get this crazy scenario where there is no data in the actual database (confirmed via _all_docs and _changes run on curl as well as all_documents on Futon). However the view still yields data (again on both curl and Futon).
The delete comprises Bulk delete and purge operations via ektorp. Running _changes after each confirms these work as expected. re-creating the view makes it reflect the true state of the documents in the DB.
Have I missed something obvious here or are views in CouchDB only incremental?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您真的清除了数据吗?这将使视图无效并导致完全重建。我会注意到,不建议正常使用 _purge。它仅在意外情况下存在,例如将明文密码放入文档中。
不过,您可能在 _purge 中暴露了一个错误,因此,如果您可以使用 _purge 可靠地引发此错误,但如果您只是删除则不然,我鼓励您在我们的 JIRA 上提交票证(https://issues.apache.org/jira/浏览/COUCHDB)。
我还要指出,如果您清除,修复方法将是清除索引,没有可能的增量方法(您实际上是在删除增量方法所需的信息)。
Did you really _purge the data? That should invalidate the view and cause a full rebuild. I'll note that _purge is not recommended for normal use. It exists only for accidents like putting your plaintext password in a document.
You may have exposed a bug in _purge, though, so if you can reliably induce this with _purge but not if you just delete, I encourage you to file a ticket on our JIRA (https://issues.apache.org/jira/browse/COUCHDB).
I'll note also that the fix will be to blow away the index if you purge, there is no incremental approach possible (you are literally removing the information that an incremental approach requires).