Commit Graph

76 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 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
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
Thomas Waldmann 3653acd259 PR #279 - Merge branch 'fadvise' into merge 2015-04-11 02:51:33 +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 4be5f312d7 Merge branch 'fix_atime' into merge 2015-04-05 18:11:16 +02: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 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
Thomas Waldmann 8fba904b16 fix noatime mode, fixes #243
added "nonlocal euid" - without this, euid just gets redefined in inner scope instead of assigned to outer scope
added check for euid 0 - if we run as root, we always have permissions (not just if we are file owner)

note: due to caching and OS behaviour on linux, the bug was a bit tricky to reproduce
and also the fix was a bit tricky to test.

one needs strictatime mount option to enfore traditional atime updating.

for repeated tests, always change file contents (e.g. from /dev/urandom) or attic's caching
will prevent that the file gets read ("accessed") again.

check atimes with ls -lu

i could reproduce code was broken and is fixed with this changeset. and root now doesn't touch any atimes.
2015-03-20 01:40:51 +01:00
Thomas Waldmann c4f3068c55 PR #241 - Merge branch 'patch-1' of https://github.com/adept/attic into merge 2015-03-18 15:30:53 +01:00
Dmitry Astapov 6be2734b7e Do not create items_buffer and chunker unless we are creating new archive
Listing repositories with lots of archives on low-memory systems would cause attic to run out of memory due to items_buffer and chunker being created for each visited archive.

See https://github.com/jborg/attic/issues/163
2015-03-18 12:42:28 +00:00
Thomas Waldmann b7cefacb69 Merge branch 'python_cleanup' into merge
Conflicts:
	attic/archiver.py
	attic/remote.py
2015-03-18 00:23:41 +01:00
Thomas Waldmann 4ef6125f45 cleanup pep8 issues found by pycharm 2015-03-17 23:47:21 +01:00
Thomas Waldmann a21da5d2e0 no bare except 2015-03-17 23:16:12 +01:00
Thomas Waldmann 60ac104a8f PR #231 - Merge branch 'check_last_N' of https://github.com/ThomasWaldmann/attic into merge 2015-03-11 03:12:37 +01:00
Thomas Waldmann 90c50e3171 implement check --last N
Note: of course it can only check for orphaned objects, if it has processed all archives in the repo.
Thus this check is skipped as soon as you give --last N option.

The numbers shown in progress indicator are (N,T).
N is the number of the currently checked archive (starts at T as it first checks latest archive).
T is the total number of archives.
2015-03-11 03:04:12 +01:00
Thomas Waldmann 97b5154fc5 check: sort archives in reverse time order 2015-03-10 01:11:18 +01:00
Thomas Waldmann 9841af5542 better attic create -v output
Added a indicator character to the left for (A)dded, (M)odified, (U)nchanged status
of regular files. Lowercase indicators are for special files.

You may or may not want to use grep to filter out U and d.
2015-03-08 19:18:21 +01:00
Thomas Waldmann aab900b169 extract: if --stdout is given, write all extracted binary data to stdout 2015-03-01 05:07:29 +01:00
Thomas Waldmann a3f335e0ff create: if "-" is given as path, read binary from stdin 2015-03-01 04:29:44 +01:00
Jonas Borgström b5a9085717 Fix Python 3.2 compatibility issue with noatime open().
Closes #164.
2015-01-03 23:12:47 +01:00
Carlo Teubner f4804c07ca open files with O_NOATIME if possible 2014-09-12 22:22:08 +01:00
Jonas Borgström 9f64e39d9f Reuse chunker buffer between files. 2014-08-03 15:04:41 +02:00
Jonas Borgström 8f4e0f7506 acl: Added workaround for old Linux systems
Really old Linux systems do not have extended_file_no_follow()
2014-08-01 15:50:18 +02:00
Jonas Borgström 1b0e21b95a Fixed typo 2014-07-10 15:44:29 +02:00
Jonas Borgström 2f72b9f960 HashIndex: Switch to a non-mmap based implementation
This eliminates unnecessary IO on low memory systems
2014-07-10 15:32:29 +02:00
Jonas Borgström 4b2dae29d4 Fix incorrect detect of follow_symlinks support
This only affects system with Python 3.3+ and a really old libc
2014-07-01 21:28:07 +02:00
Jonas Borgström 3ab53b776d Fix crash on extreme mtime timestamps (year 2400+)
Closes #81
2014-05-18 18:28:26 +02:00
Jonas Borgström 0ad5253d84 Experimental Linux ACL support (#66) 2014-04-13 20:26:46 +02:00
Jonas Borgström 8bf3bb1ca3 Added support for backup and restore of bsdflags (OS X and FreeBSD)
This improves our Backup-Bouncer score (#56)
2014-04-08 21:52:26 +02:00
Jonas Borgström 4bbde41466 Fix bug where xattrs on symlinks were not correctly restored 2014-04-08 21:22:57 +02:00
Jonas Borgström af262482de mount: Use RepositoryCache
This makes a full repository mount a bit faster but it's still
too slow and memory hungry.
2014-03-26 22:42:20 +01:00
Jonas Borgström 8a1ebe0112 Added '--stats' option to attic prune and attic delete 2014-03-19 22:32:07 +01:00
Jonas Borgström 839dd94a59 prune: Delete all archives in a single transaction
This will improve performance and make the whole operation atomic
2014-03-19 21:58:25 +01:00
Jonas Borgström c3ca45315b cache: Speed up cache rebuild by caching archive metadata requests 2014-03-13 22:29:47 +01:00