couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Smith <...@proven-corporation.com>
Subject Re: Temporal data
Date Sun, 08 Mar 2009 18:59:47 GMT
Ben Hood wrote:
> Jason,
> 
> On Sun, Mar 8, 2009 at 6:32 PM, Jason Smith <jhs@proven-corporation.com> wrote:
>>> I am only interested in being able to retrieve an
>>> arbitrary snapshot so that the application can either compute it's own
>>> diff or just run queries against historical data.
>> Yes at the moment I would probably be doing that with Linux LVM snapshots
>> and juggling lots of couch processes to run off the various mountpoints,
>> which I agree is hardly ideal.
> 
> I don't quite follow - if you were able to mount a particular snapshot
> - why couldn't you just have one particular couch process build a view
> only for that snapshot? I'm presuming that the snapshot queries are
> initiated by one particular user and hence need not be globally
> visible. For example, if one user wants to view an old snapshot, I
> wouldn't expect this to overwrite every other users' view of the
> database.

Well I was thinking out loud, so maybe we are talking past each other. 
But the question is, how do you take point in time snapshots of the data 
set, when AFAIK CouchDB proper doesn't (yet?) have support for that. 
How could I look at my data as it was six months ago?

So my approach would be to exploit the guarantee of coherence that you 
get from the file format.  If I absolutely had to have this feature now, 
I would look into using LVM to snapshot the filesystem.  That gives you 
a fresh read-only mountpoint of your snapshotted filesystem.  From 
there, you can copy the couch data files to a backup location, either 
regularly via cron, or the app could trigger the process.

Whenever you want to see old document versions, you just start a new 
couchdb process on a different port running against one of the backups 
and you query it normally.  Since access to the DB is just via a URL, it 
shouldn't be too bad to change the port number in your app.

Does that make sense?

(Honestly it may be easier to putting version metadata in the documents, 
but I guess if you had lots of different document types it may save code 
to do it with the OS instead, at a cost of making your app less portable 
and use more disk space.  Also, none of this is necessarily 
CouchDB-related.  You could do the same thing with MySQL I suppose.)

-- 
Jason Smith
Proven Corporation
Bangkok, Thailand
http://www.proven-corporation.com

Mime
View raw message