Commit graph

92 commits

Author SHA1 Message Date
Thomas Waldmann
27de1b0a43 add a wrapper around liblz4 2015-08-01 15:07:54 +02:00
Thomas Waldmann
3be55bedd3 chunker: n needs to be a signed size_t
... as it is also used for the read() return value, which can be negative in case of errors.
2015-07-30 15:21:13 +02:00
Thomas Waldmann
195545075a repo delete: add destroy to allowed rpc methods, fixes issue #114
also: add test, automate YES confirmation for testing
2015-07-26 17:38:16 +02:00
Thomas Waldmann
ed2548ca02 add a __main__.py to nuitka works 2015-07-20 16:16:32 +02:00
Thomas Waldmann
e4a41c8981 fix Traceback when running check --repair, attic issue #232
This fix is maybe not perfect yet, but maybe better than nothing.

A comment by Ernest0x (see https://github.com/jborg/attic/issues/232 ):

@ThomasWaldmann your patch did the job.
attic check --repair did the repairing and attic delete deleted the archive.
Thanks.

That said, however, I am not sure if the best place to put the check is where
you put it in the patch. For example, the check operation uses a custom msgpack
unpacker class named "RobustUnpacker", which it does try to check for correct
format (see the comment: "Abort early if the data does not look like a
serialized dict"), but it seems it does not catch my case. The relevant code
in 'cache.py', on the other hand, uses msgpack's Unpacker class.
2015-07-15 13:32:05 +02:00
Thomas Waldmann
9b9c808713 fixed some minor issues found by pycharm/pytest-flakes 2015-07-15 11:30:25 +02:00
Thomas Waldmann
cc88d174af fix typos 2015-07-15 11:14:53 +02:00
Thomas Waldmann
b644565546 repo key mode (and deprecate passphrase mode), fixes #85
see usage.rst change for a description and why this is needed
2015-07-15 00:01:07 +02:00
Thomas Waldmann
b2f460d591 fix filenames used for locking, update docs about locking 2015-07-13 23:20:46 +02:00
Thomas Waldmann
2deb520e67 locking code: extract timeout/sleep code into reusable TimeoutTimer class 2015-07-13 16:45:18 +02:00
Thomas Waldmann
e4c519b1e9 new locking code
exclusive locking by atomic mkdir fs operation
on top of that, shared (read) locks and exclusive (write) locks using a json roster.
2015-07-13 13:55:28 +02:00
Thomas Waldmann
434dac0e48 move locking code to own module, same for locking tests
fix imports, no other changes.
2015-07-12 23:41:52 +02:00
Thomas Waldmann
d8e9a9bf96 skip test_crash_before_compact test for RemoteRepository
it was silently failing until recently. and it can't work the way it is on RemoteRepository.
it's still active (and now even really working) for the (local) Repository tests.
2015-07-12 23:29:34 +02:00
Thomas Waldmann
414dba3de7 remove usage of evil / broken unittest.mock, use mock from pypi
see testsuite.mock docstring for more details.

one test shows brokenness right now that was hidden / silent until now.
2015-07-12 23:08:44 +02:00
Thomas Waldmann
bd354d7bb4 create a RepositoryCache implementation that can cope with any amount of data, fixes attic #326
the old code blows up with an integer OverflowError when the cache file goes beyond 2GiB size.
the new code just reuses the Repository implementation as a local temporary key/value store.

still an issue: if the place where the temporary RepositoryCache is stored (usually /tmp) can't
cope with the cache size and runs full.

if you copy data from a fuse mount, the cache size is the copied deduplicated data size.
so, if you have lots of data to extract (more than your /tmp can hold), rather do not use fuse!

besides fuse mounts, this also affects attic check and cache sync (in these cases, only the
metadata size counts, but even that can go beyond 2GiB for some people).
2015-07-12 00:18:49 +02:00
TW
4b81f380f8 Merge pull request #88 from ThomasWaldmann/py3style
style and cosmetic fixes, no semantic changes
2015-07-11 18:39:42 +02:00
Thomas Waldmann
0580f2b4eb style and cosmetic fixes, no semantic changes
use simpler super() syntax of python 3.x

remove fixed errors/warnings' codes from setup.cfg flake8 configuration

fix file exclusion list for flake8
2015-07-11 18:31:49 +02:00
Thomas Waldmann
a59211f295 use borg-tmp as prefix for temporary files / directories
also: remove some unused temp dir. code
2015-07-11 17:22:12 +02:00
Thomas Waldmann
4068fc1e31 clarify help text, fixes #73 2015-06-28 14:02:38 +02:00
TW
562f3c7c33 Merge pull request #72 from ThomasWaldmann/loggedio-exceptions
Loggedio exceptions
2015-06-27 22:17:02 +02:00
Thomas Waldmann
08688fbc13 Merge branch 'master' into loggedio-exceptions
Conflicts:
	borg/repository.py
2015-06-27 22:02:26 +02:00
TW
3303619b5f Merge pull request #69 from ThomasWaldmann/fix-prune-options
the short prune options without "keep-" are deprecated, so do not sug…
2015-06-26 01:19:29 +02:00
Thomas Waldmann
b92dd1bab2 the short prune options without "keep-" are deprecated, so do not suggest them 2015-06-26 00:04:35 +02:00
Thomas Waldmann
89db9b8b9e improve at-end error logging
always use archiver.print_error, so it goes to sys.stderr

always say "Error: ..." for errors

for rc != 0 always say "Exiting with failure status ..."

catch all exceptions subclassing Exception, so we can log them in same way and set exit_code=1
2015-06-25 23:57:38 +02:00
Thomas Waldmann
6964799d13 borg create --compression 0..9 for variable compression 2015-06-25 22:16:23 +02:00
Thomas Waldmann
54e8dd8419 misc chunker parameter changes
- use power-of-2 sizes / n bit hash mask so one can give them more easily
- chunker api: give seed first, so we can give *chunker_params after it
- fix some tests that aren't possible with 2^N
- make sparse file extraction zero detection flexible for variable chunk max size
2015-06-21 01:46:41 +02:00
Thomas Waldmann
3b9b976f2a borg create --chunker-params=... 2015-06-20 01:20:46 +02:00
Thomas Waldmann
6d0a00496a determine and report chunk counts in chunks index
borg info repo::archive now reports unique chunks count, total chunks count

also: use index->key_size instead of hardcoded value
2015-06-19 23:53:23 +02:00
Thomas Waldmann
2743ab1593 better Exception msg if there is no Borg installed on the remote repository server
(still a bit ugly to get even 2 tracebacks)
2015-06-18 23:18:05 +02:00
Thomas Waldmann
dd78e1a56e improve docs, usage help, changelog 2015-06-11 22:18:12 +02:00
Thomas Waldmann
614261604e don't hardcode MAGIC length 2015-06-02 02:41:23 +02:00
Thomas Waldmann
3dce75306a LoggedIO: better error checks / exceptions / exception handling
It doesn't just say "error reading segment X", but also what went wrong and at what offset.
2015-06-02 02:30:07 +02:00
Thomas Waldmann
646cdca312 "extract" micro optimization: first check for regular files, then for directories, check for fifos late
regular files are most common, more than directories. fifos are rare.

was no big issue, the calls are cheap, but also no big issue to just fix the order.
2015-05-31 21:55:15 +02:00
Thomas Waldmann
ed1e5e9c13 "create" micro optimization: do not check for sockets early
they are rare, so it's pointless to check for them first.

seen the stat..S_ISSOCK in profiling results with high call count.
was no big issue, that call is cheap, but also no big issue to just fix the order.
2015-05-31 21:54:51 +02:00
Thomas Waldmann
a3f4d19515 speed up chunks cache sync, fixes #18
Re-synchronize chunks cache with repository.

If present, uses a compressed tar archive of known backup archive
indices, so it only needs to fetch infos from repo and build a chunk
index once per backup archive.

If out of sync, the tar gets rebuilt from known + fetched chunk infos,
so it has complete and current information about all backup archives.

Finally, it builds the master chunks index by merging all indices from
the tar.

Note: compression (esp. xz) is very effective in keeping the tar
            relatively small compared to the files it contains.

Use python >= 3.3 to get better compression with xz,
there's a fallback to bz2 or gz when xz is not supported.
2015-05-31 19:17:01 +02:00
Thomas Waldmann
072326fef0 chunker: get rid of read_buf
if we have a OS file handle, we can directly read to the final destination - one memcpy less.
if we have a Python file object, we get a Python bytes object as read result (can't save the memcpy here).
2015-05-31 18:41:23 +02:00
Thomas Waldmann
926454c0d8 explicitely specify binary mode to open binary files
on POSIX OSes, it doesn't make a difference, but it is cleaner and also good for portability.
2015-05-31 17:57:45 +02:00
Thomas Waldmann
776bb9fabc hashindex: improve error messages 2015-05-31 17:48:19 +02:00
Thomas Waldmann
91e10fec5f Merge branch 'master' of github.com:jborg/attic 2015-05-31 17:37:02 +02:00
Thomas Waldmann
d067bc3178 efficient archive list from manifest
a lot of speedup for:
"list <repo>", "delete <repo>" list, "prune" - esp. for slow connections to remote repositories.

the previous method used metadata from the archive itself, which is (in total) rather large.
so if you had many archives and a slow (remote) connection, it was very slow.

but there is a lot easier way: just use the archives list from the repository manifest - we already
have it anyway and it also has name, id and timestamp for all archives - and that's all we need.

I defined a ArchiveInfo namedtuple that has same element names as seen as attribute names
of the Archive object, so as long as name, id, ts is enough, it can be used in its place.
2015-05-26 02:04:41 +02:00
Thomas Waldmann
5e98400a5a fix all references to package name
use relative imports if possible
reorder imports (1. stdlib 2. dependencies 3. borg 4. borg.testsuite)
2015-05-22 19:21:41 +02:00
Thomas Waldmann
78bfc58b47 rename package directory to borg 2015-05-22 17:48:54 +02:00