老数据CouchDB的访问? [英] Are old data accessible in CouchDB?

查看:175
本文介绍了老数据CouchDB的访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过一些关于CouchDB的,我真的事实,即它的追加仅兴趣。我可能是误解,但我的理解是,它的工作原理有点像这样:

I've read a bit about CouchDB and I'm really intrigued by the fact that it's "append-only". I may be misunderstanding that, but as I understand it, it works a bit like this:


  • 数据在时添加的 T0 的到数据库,告诉ID为1的名称的用户是Cedrik马丁

  • data is added at time t0 to the DB telling that a user with ID 1's name is "Cedrik Martin"

查询要求的什么是ID为1的用户的名字吗?的回报的Cedrik马丁

在时间的 T1 的某一更新到数据库说服力的:用户ID为1的名字是塞德里克·马丁的(改变'K'到'C')

at time t1 an update is made to the DB telling: "User with ID 1's name is Cedric Martin" (changing the 'k' to a 'c').

查询再次询问的什么是ID为1的用户名为的现在返回塞德里克·马丁

a query asking again "what is the name of the user with ID 1" now returns "Cedric Martin"

这是一个愚蠢的例子,但它是因为我想了解关于CouchDB的东西根本。

It's a silly example, but it's because I'd like to understand something fundamental about CouchDB.

看到更新已经使用在DB年底追加制成,可以查询数据库,因为它是在t0时刻,没有做什么特别的?

Seen that the update has been made using an append at the end of the DB, is it possible to query the DB "as it was at time t0", without doing anything special?

我可以问的CouchDB的那是什么t0时刻ID为1的用户的名字吗?的?

Can I ask CouchDB "What was the name of the user with ID 1 at time t0?" ?

修改第一个答案非常有趣,所以我有一个更precise问题:只要我没有压缩一个CouchDB的,我可以编写查询不知何故引用透明(的他们会总是产生相同的结果)?例如,如果我查询的将文档D修订版R的,我保证总是得到相同的答案回来,只要我不密实的DB?

EDIT the first answer is very interesting and so I've got a more precise question: as long as I'm not "compacting" a CouchDB, I can write queries that are somehow "referentially transparent" (i.e. they'll always produce the same result)? For example if I query for "document d at revision r", am I guaranteed to always get the same answer back as long as I'm not compacting the DB?

推荐答案

也许使用CouchDB做出了最常见的错误是认为它提供了一个版本系统,为您的数据。事实并非如此。

Perhaps the most common mistake made with CouchDB is to believe it provides a versioning system for your data. It does not.

压实删除所有文件,所有非最新版本和复制只复制的任何文件的最新版本。如果你需要历史版本,您必须$ P $使用似乎不错,给您的任何方案pserve他们在您的最新版本。

Compaction removes all non-latest revisions of all documents and replication only replicates the latest revisions of any document. If you need historical versions, you must preserve them in your latest revision using any scheme that seems good to you.

_转速时,如上所述,一个不幸的名字,但没有其它字被建议是任何清晰。 _mvcc和_mcvv_token之前就已经提出。与两个问题是发生了什么事情难免会出现包括任何类别旧版本保留在磁盘上,直到压实,这将意味着还在它的用户版本系统。

"_rev" is, as noted, an unfortunate name, but no other word has been suggested that is any clearer. "_mvcc" and "_mcvv_token" have been suggested before. The issue with both is that any description of what's going on there will inevitably include the "old versions remain on disk until compaction" which will still imply that it's a user versioning system.

要回答这个问题,我能问CouchDB的什么是ID为1的用户在t0时刻的名字吗??,简单的答案是NO。长的答案是是的,但后来它不会工作,这是说不的另一种方式。 :)

To answer the question "Can I ask CouchDB "What was the name of the user with ID 1 at time t0?" ?", the short answer is "NO". The long answer is "YES, but then later it won't work", which is just another way of saying "NO". :)

这篇关于老数据CouchDB的访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆