borg icon indicating copy to clipboard operation
borg copied to clipboard

directory content is only implicitly known

Open ThomasWaldmann opened this issue 10 years ago • 6 comments

Adding suggested labels based on user approval: enhancement for issue #32, enhancement for issue #191, enhancement for issue #641, enhancement for issue #939. No labels removed.

ThomasWaldmann avatar May 22 '15 22:05 ThomasWaldmann

Can we efficiently access random items in metadata[b'items']? The code accessing that so far is strictly linear access.

If we could, a directory tree index could be added separately, only containing indexes into the items. This could speed up all content-reading actions significantly if only a subset is accessed.

Edit: Ah, no, msgpack only has a streaming unpacker it seems. But maybe we can seek before feeding data to unpacker and this way emulate random access?

enkore avatar Mar 16 '16 09:03 enkore

basically to make this safe, there is need for dependency tracking, so metadata of a directory will only get written after its content is done

this could be tracked as tree of contents that constructs as unpacking is done, and deconstructs as items are written,

every time a treee turns empty, we can write directory metadata

the pipeline can be created in a way that a tree cannot turn empty unless all its content is processed

RonnyPfannschmidt avatar Mar 16 '16 10:03 RonnyPfannschmidt

That would make it unnecessary to make another pass over all dirs in borg extract, but doesn't speed up "random access" to directories / files for listing/extracting subtrees.

Concrete example: listing all files in /home takes a minute or so, listing a subtree with a few dozen files still takes ~20 s (because iter_items / unpack_many needs to read, unpack, decode, filter all items)

enkore avatar Mar 16 '16 10:03 enkore

well, a backup tool has to make some trade-offs, - since the metadata is supposed to be sorted, i believe that binary search is reasonably fast for that kind of access

RonnyPfannschmidt avatar Mar 16 '16 10:03 RonnyPfannschmidt

If I understand things correctly accessing items non-linearly is not trivial to do.

enkore avatar Mar 16 '16 10:03 enkore

(I'm not saying that this is an actual problem that needs solving, I think it's "fast enough", at least for me)

enkore avatar Mar 16 '16 10:03 enkore