DragonFly kernel List (threaded) for 2007-02
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: Plans for 1.8+ (2.0?)
:I can't uderstand whether snapshots are filesystems or files ?...or
:just both possible ?
A snapshot is just a view into a historical data set.
Lets say you have a piece of data that you are modifying every once in
a while. In a normal filesystem that data is overwritten on the physical
media each time it is modified (or at least, each time the OS decides to
flush its caches to disk).
A filesystem which supports a historical data store works differently.
Each flush to disk does NOT overwrite the previous data, it simply tags
it as being replaced with a monotonically increasing transaction-id
(which can double as a time stamp in many cases).
So for example lets say you have the file "fubar" and you write
"hello world" to it. The historical data store would have something
like this for the file 'fubar':
created replaced data
------- -------- --------------------------
10:00 - hello world
Then you modify the file to say 'goodbye world':
created replaced data
------- -------- --------------------------
10:00 10:20 hello world
10:20 - goodbye world
Then you modify the file to say 'hello world AGAIN!':
created replaced data
------- -------- --------------------------
10:00 10:20 hello world
10:20 10:30 goodbye world
10:30 - hello world AGAIN!
And so on and so forth. Mounting a snapshot of the file is as simple
as telling the filesystem the 'as of' date that you want your view to
be. The filesystem then simply ignores any records created after the
as-of date and ignores any records replaced before the as-of date.
And, poof, you see the filesystem as it was as-of the specified date.
As an added bonus, the fact that the data content for any given physical
block is not updated once written means that you can trivially
replicate the data store.
Deletion of old data is just as easy. Lets say you decide you do not
need any data you deleted before 10:31 ? Scanning the transaction id's
(timestamps in my example) for any record marked 'deleted' prior to
10:31 yields a list of records which can be physically destroyed and
their space recovered for future use.
created replaced data
------- -------- --------------------------
10:30 - hello world AGAIN!
The actual mechanism is somewhat more complex, because you need to index
the data elements to reduce the overhead of scanning potentially thousands
of dead records, but that is the jist of how a historical data store
works.
-Matt
Matthew Dillon
<dillon@backplane.com>
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]