Commit Graph

707 Commits

Author SHA1 Message Date
Thomas Waldmann 82681d6ecb PR #287 - Merge branch 'issue_183' into merge 2015-04-19 18:54:19 +02:00
Thomas Waldmann 212777d716 fix "attic info" all archives stats, fixes #183
the problem was that calc_stats() dirties cache.chunks by decrementing
the chunk reference counters (so it can compute the deduplicated size
of the archive correctly).

the fix is to create a local Cache instance inside calc_stats, so the dirty cache
instance can not be used elsewhere.

also:
fix internal consistency of calc_stats function: always use "cache" (not "self.cache").
minor cosmetic pep8 fixes
2015-04-19 18:50:10 +02:00
Thomas Waldmann 310f9b7412 PR #285 - Merge branch 'archive_timestamp' into merge 2015-04-18 21:43:47 +02:00
Thomas Waldmann 0ffee1f1ee implement --timestamp, iso8601-like utc timestamp string or reference file/dir
note: this needs bug #282 to be fixed first, because it will create timestamps with microseconds==0.
2015-04-18 21:36:10 +02:00
Thomas Waldmann 99d15157d2 PR #284 updated - Merge branch 'sparse_files' into merge 2015-04-18 01:16:26 +02:00
Thomas Waldmann ee80db4eb2 add commandline argument --sparse
default is to not create sparse files.

if you give --sparse, it will create a hole in the sparse output file when a all-zero chunk is extracted.
2015-04-17 22:28:40 +02:00
Thomas Waldmann fc97099924 Merge branch 'master' into merge 2015-04-15 23:04:34 +02:00
Jonas Borgström e815d6da8e acl/xattr: Be less strict about unknown platforms
Closes #239
2015-04-15 21:49:03 +02:00
Jonas Borgström 848666e7cb cache: Treat EOFError as a negative _confirm answer 2015-04-15 21:35:56 +02:00
Thomas Waldmann 118fb1a55c PR #226 - Merge branch 'delete_repo' into merge 2015-04-15 19:05:58 +02:00
Thomas Waldmann b6ed1c742b PR #284 - Merge branch 'sparse_files' into merge 2015-04-15 16:43:07 +02:00
Thomas Waldmann a2bf2aea22 simple sparse file support, made chunk buffer size flexible
Implemented sparse file support to remove this blocker for people backing up lots of
huge sparse files (like VM images). Attic could not support this use case yet as it would
have restored all files to their fully expanded size, possibly running out of disk space if
the total expanded size would be bigger than the available space.

Please note that this is a very simple implementation of sparse file support - at backup time,
it does not do anything special (it just reads all these zero bytes, chunks, compresses and
encrypts them as usual). At restore time, it detects chunks that are completely filled with zeros
and does a seek on the output file rather than a normal data write, so it creates a hole in
a sparse file. The chunk size for these all-zero chunks is currently 10MiB, so it'll create holes
of multiples of that size (depends also a bit on fs block size, alignment, previously written data).

Special cases like sparse files starting and/or ending with a hole are supported.

Please note that it will currently always create sparse files at restore time if it detects all-zero
chunks.

Also improved:
I needed a constant for the max. chunk size, so I introduced CHUNK_MAX (see also
existing CHUNK_MIN) for the maximum chunk size (which is the same as the chunk
buffer size).

Attic still always uses 10MiB chunk buffer size now, but it could be changed now more easily.
2015-04-15 16:29:18 +02:00
Thomas Waldmann 2f71b39866 PR #283 - Merge branch 'fix-missing-microseconds' of https://github.com/camh-/attic into merge 2015-04-15 03:06:50 +02:00
Thomas Waldmann 3a382e9b46 Merge branch 'master' into merge 2015-04-15 02:41:55 +02:00
Jonas Borgström bbc8886bfe Updated CHANGES
Closes #163.
2015-04-13 23:29:29 +02:00
Jonas Borgström 27012a50e5 Merge remote-tracking branch 'adept/patch-1' 2015-04-13 23:28:28 +02:00
Jonas Borgström 70af748363 Added Thomas Waldmann to AUTHORS and updated CHANGES 2015-04-13 23:12:30 +02:00
Jonas Borgström 8227e4788a Merge remote-tracking branch 'tw/fix_pipe' 2015-04-13 23:08:05 +02:00
Jonas Borgström 20026e58aa Fix incorrect behaviour with two character directory names.
Independetely found and fixed by both Thomas Waldemann and
Cam Hutchison. Closes #265 and #268.
2015-04-13 22:44:14 +02:00
Jonas Borgström 7198929bae cache: Warn user before accessing relocated repositories
This also closes #225
2015-04-13 22:42:32 +02:00
Cam Hutchison 9f99aa1abf archive: Fix parsing with missing microseconds.
Archive timestamps are stored as the output of datetime.isoformat().
This function omits microseconds in the string output if the
microseconds are zero (as documented and explained at
https://bugs.python.org/issue7342).

Parsing of timestamps assumes there are always microseconds present
after a decimal point. This is not always true. Handle this case where
it is not true by explicitly using '0' microseconds when not present.

This commit fixes #282
2015-04-13 18:00:46 +10:00
Cam Hutchison 0295ef8563 archive: Add testcases for microsecond handling.
datetime.isoformat() has different output depending on whether
microseconds are zero or not. Add test cases to ensure we handle both
cases correctly in an archive.
2015-04-13 18:00:46 +10:00
Thomas Waldmann a6f8d51b37 updated PR #279 - Merge branch 'fadvise' into merge 2015-04-11 17:08:17 +02:00
Thomas Waldmann 57071ce6fd repo writes: call posix_fadvise between fsync and close
less calls to posix_fadvise (which seem to force a write-cache sync-to-disk and
wait for that to complete) - if we call it after we synced anyway, we don't lose time.

also: fixed a bug in the os.fsync call, it needs the fileno.
2015-04-11 17:04:10 +02:00
Thomas Waldmann 3653acd259 PR #279 - Merge branch 'fadvise' into merge 2015-04-11 02:51:33 +02:00
Thomas Waldmann 874f5c491b use posix_fadvise for repo writes also 2015-04-11 02:40:22 +02:00
Thomas Waldmann c7d232c4ce use posix_fadvise to avoid spoiling the OS cache
note:
 - we call this frequently AFTER re-filling the chunker buffer,
so even big input files have little cache impact.
- there is still some cache impact due to output files caching,
if the repository is on a locally mounted filesystem.
2015-04-11 01:09:03 +02:00
Thomas Waldmann 7ad1093951 let chunker optionally work with os-level file descriptor
this safes some back-and-forth between C and Python code and also some memory
management overhead as we can always reuse the same read_buf instead of letting
Python allocate and free a up to 10MB big buffer for each buffer filling read.

we can't use os-level file descriptors all the time though, as chunkify gets also invoked
on objects like BytesIO that are not backed by a os-level file.

Note: this changeset is also a preparation for O_DIRECT support which can be
 implemented a lot easier on C level.
2015-04-08 18:43:53 +02:00
Thomas Waldmann 233d1f7272 Merge security fix from master. Merge branch 'master' into merge 2015-04-07 18:05:36 +02:00
Jonas Borgström 78f9ad1fab Require approval before accessing previously unknown unencrypted repositories
Closes #271
2015-04-06 23:07:10 +02:00
Thomas Waldmann 4be5f312d7 Merge branch 'fix_atime' into merge 2015-04-05 18:11:16 +02:00
Thomas Waldmann 1bf5e9ee29 Merge PR #265 - fixes bug #268 - Merge branch 'fix_safe_re' of https://github.com/lealanko/attic into merge 2015-04-04 11:05:52 +02:00
Lauri Alanko 89e9528d0b Escape ".." in path regexp properly. 2015-04-03 00:19:33 +03:00
Thomas Waldmann e706d1e2e0 PR #258 - Merge branch 'platform_linux_optimize' into merge 2015-04-01 02:13:26 +02:00
Thomas Waldmann 570b8f8231 linux: remove duplicate os.fsencode calls 2015-04-01 02:11:36 +02:00
Thomas Waldmann dc58cf9b35 PR #254 - Merge branch 'tests_32bit_platform' into merge 2015-03-26 01:36:43 +01:00
Thomas Waldmann 8b2b91fb0c Fix test setup for 32bit platforms, partial fix for #196 2015-03-26 01:23:25 +01:00
Thomas Waldmann d43cb4bac8 refactor _open_rb code a bit, so it is more consistent / regular 2015-03-24 22:08:06 +01:00
Thomas Waldmann 3d2a3d11af PR #251 - Merge branch 'rename_archive' into merge 2015-03-24 07:19:01 +01:00
Thomas Waldmann 9f6840dddb implement attic rename repo::oldname newname
I extracted the inner part of Archive.load into a new _load_meta method
that does not modify self and does not decode, so I could simply reuse it.
2015-03-24 07:11:00 +01:00
Thomas Waldmann 8a60f05736 PR #250 - Merge branch 'progress_indication' into merge 2015-03-24 04:30:13 +01:00
Thomas Waldmann 231721d133 implemented create --progress
shows original, compressed and deduped size plus path name.

output is 79 chars wide, so 80x24 terminal does not wrap/scroll.

long path names are shortened (in a rather simplistic way).

output happens when a new item is started, but not more often than 5/s
(thus, not every pathname is shown)

at the end, the output line is cleared but not scrolled, so it basically vanishes.
2015-03-24 04:24:54 +01:00
Thomas Waldmann 2c2dd21e0e PR #224 - Merge branch 'issue_55' into merge 2015-03-22 15:58:08 +01:00
Thomas Waldmann 6d67379c08 refactor indicator (status) and item processing
process_item was used only for dirs and fifo, replaced it by process_dir and process_fifo,
so the status can be generated there (as it is done for the other item types).
2015-03-22 15:52:43 +01:00
Thomas Waldmann 22ae80e1ac add condensed description of the changes in merge branch 2015-03-22 14:55:02 +01:00
Thomas Waldmann 57b1b3dbec PR #246 - Merge branch 'remote_exceptions' into merge 2015-03-21 02:22:51 +01:00
Thomas Waldmann c679f1a6f0 catch all Exceptions, transmit traceback back from remote
before this changesets, most informations about exceptions/tracebacks
on the remote side were lost. now they are transmitted and displayed,
together with the remote attic version.
2015-03-21 02:17:19 +01:00
Thomas Waldmann dd8ff50a5c PR #245 - Merge branch 'fix_exceptions' into merge
Conflicts:
	attic/archive.py
2015-03-20 02:34:10 +01:00
Thomas Waldmann 2da70c7d7a fix some exception handlers
don't catch "Exception" when OSError was meant (otherwise e.errno is not there anyway)
don't use bare "except:" if one can avoid (copied code fragment from similar handler)
2015-03-20 02:31:39 +01:00
Thomas Waldmann f31897bb1f PR #244 - Merge branch 'fix_atime' into merge 2015-03-20 01:43:04 +01:00