webapi for metadata in vdrive #117
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#117
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For a backup application (in which the vdrive is used to mirror the
filesystem that the user wants backed up), it would be useful to know quickly
that a given file was already present in the vdrive at a given location. The
DHT layer is responsible for efficiently handling files that are already
present in the grid, but that still requires a good bit of encoding work (and
convergence must be enabled). The goal here is to avoid getting to the
encoding phase at all.
I'm thinking that the dirnode edges could contain some metadata that serves
to roughly identify the file (like a quick hash of the file contents, or
maybe just timestamp+length), and the backup process could refrain from
re-pushing anything that looks like it hasn't changed. The exact criteria
used would depend upon how the user wants to make the tradeoff between
performance and robustness. If they're feeling casual and don't want to spend
a lot of CPU or disk IO, then they set it to compare just timestamp+length.
If they're paranoid that they've replaced one file on their disk with a
different file of the exact same length (and also set the timestamp back to
match), then they can set their node to use a full secure hash for comparison
purposes. An intermediate position is possible too: in some circumstances, we
could use a fast non-cryptographic hash here (perhaps just a CRC).
Note that the vdrive as it stands today has no concept of metadata: it is
purely a graph of named edges connecting non-terminal dirnodes with terminal
filenodes and other dirnodes. All of the usual disk-based filesystem metadata
like ctimes and mtimes are left out, as well as even-less-appropriate
metadata like "owner" and "permissions". A backup application, serving as a
bridge between a disk-based filesystem and the vdrive, will want some of this
metadata around (so that the app can restore the metadata as well as the data
itself). This metadata doesn't necessarily have to go on the vdrive edges,
though.. it depends upon how we want to build the backup app.
Also note that a backup application is not obligated to conform to the vdrive
layer (although it would be handy for browsing if it did). The app could, for
example, upload all files to the mesh, get their URIs, then write out a
single big file with one pathname/metadata/URI tuple per line, and upload
that, and remember its URI. (i.e. bypass the vdrive completely). It could
also store the files in the vdrive normally, but stash just the metadata in a
separately-uploaded file.
On my MacBook Pro, adler32 (from Python's zlib module) hashes a 120-million-byte file in 0.475 seconds, and sha256 (from Python's hashlib module) hashes it in 1.717 seconds.
adler32 does a 734 million byte file in 2.646 seconds and sha256 does it in 10.166 seconds.
This kind of thing makes me wish we used the Tiger hash. The new implementation of Tiger hash in the crypto++ library is about 2.5 times as fast as sha-256.
http://cryptopp.com/benchmarks.html
That C++/assembly implementation of Tiger hashes 217 MiB/second on a modern desktop, which means that the limiting factors would really be disk speed and Python interpreter. For comparison, the Crypto++ implementation of SHA-256 does 81 MiB/second.
This makes me wonder how much overhead we have just to read in a file in Python. Here, the nullsum test just reads in the data. It processes the 734 million byte file in 2.224 seconds.
Attachment sha256sum.py (311 bytes) added
sha256sum.py
Attachment nullsum.py (256 bytes) added
nullsum.py
Attachment adler32sum.py (306 bytes) added
adler32sum.py
I think that leveraging existing backup software will work pretty well if we can just preserve ctime/mtime/length and the usual unix/windows permission fields.
I'm currently thinking that the dirnode structure should be enhanced to record a dictionary of metadata next to the child URI.
we have a proposal for the metadata API floating around somewhere.. we should
gather some more feedback from Mike and the others and then actually go and
implement it.
The dirnode storage layout has a place for metadata already, as a
JSON-encoded dictionary. We're just lacking the dirnode methods to modify it
and the HTTP interfaces to drive them.
Here's the proposals that we threw together back in october.
the feedback we've received so far is from Mike:
We have three conceivable uses for this metadata. The first is to record enough information to allow a roundtrip (from a normal unix-ish filesystem, through tahoe, and back again) to restore most of the original file. This means a timestamp, at least, and maybe some mode information (the same sort of information that 'tar' records).
The second is a set of hashes, something application-specific, to allow a custom backup tool to be more efficient.
The third is arbitrary application data, perhaps tags or something.
The most important need right now is for the first use case (timestamps), so I'm retitling this ticket. We'll probably implement the framework for all three at the same time, so I'm not creating a separate ticket for the second two use cases.
metadata in vdrive to improve backup-application performanceto metadata in vdrive to record timestampsIt occurred to me today that a good starting point would just be to automatically add timestamps every time we do
DirectoryNode.add_child
. Rob pointed out that the algorithm could be:that would probably give us enough information for the FUSE plugins to show meaningful timestamps.
To allow 'cp -r' to look right, we'd still need to provide a way to set this metadata, of course. The tasks are:
I've modified the dirnode methods to add metadata setters on
add_node/add_uri, and arranged the defaults to automatically add ctime/mtime
keys. I've also added metadata the the ?t=json output (i.e. zooko's "WAPI"),
and to the human-oriented HTML web page (zooko's "WUI").
This is enough for front-ends to display timestamps, and might be sufficient
for 1.0 . In the longer run, we still need:
timestamps from some other filesystem
metadata in vdrive to record timestampsto webapi for metadata in vdriveThis was fixed long ago.