Commit graph

76 commits

Author SHA1 Message Date
Thomas Waldmann
eab9f5a07b implement files cache mode control, fixes #911
You can now control the files cache mode using this option:

--files-cache={ctime,mtime,size,inode,rechunk,disabled}*

(only some combinations are supported)

Previously, only these modes were supported:
- mtime,size,inode (default of borg < 1.1.0rc4)
- mtime,size (by using --ignore-inode)
- disabled (by using --no-files-cache)

Now, you additionally get:
- ctime alternatively to mtime (more safe), e.g.:
  ctime,size,inode (this is the new default of borg >= 1.1.0rc4)
- rechunk (consider all files as changed, rechunk them)

Deprecated:
- --ignore-inodes (use modes without "inode")
- --no-files-cache (use "disabled" mode)

The tests needed some changes:
- previously, we use os.utime() to set a files mtime (atime) to specific
  values, but that does not work for ctime.
- now use time.sleep() to create the "latest file" that usually does
  not end up in the files cache (see FAQ)

(cherry picked from commit 5e2de8ba67)
2017-10-01 01:27:18 +02:00
Thomas Waldmann
4eadb59c10 ignore corrupt files cache, fixes #2939
ignore the files cache when corrupt and emit a warning message
so the users notices that there is a problem.

(cherry picked from commit 5beaa5bd02)
2017-08-19 01:09:26 +02:00
Marian Beermann
2623e330a4 cache: write_archive_index: truncate_and_unlink on error 2017-07-24 10:45:57 +02:00
Thomas Waldmann
2edbcd7703 chunk_incref: compute "_size or size" only once 2017-07-23 13:53:48 +02:00
Thomas Waldmann
fc3498ac53 chunk_incref: use "size" for public api 2017-07-23 13:53:48 +02:00
Thomas Waldmann
663d3c544a chunk_incref size assertion: fail early 2017-07-23 13:53:48 +02:00
Thomas Waldmann
186123cb68 give known chunk size to chunk_incref, fixes #2853
chunk_incref was called when dealing with part files without giving the
known chunk size in the size_ parameter.

adjusted LocalCache.chunk_incref to have same signature.
2017-07-23 13:53:47 +02:00
Marian Beermann
55e1a54385 AdHocCache: avoid divison by zero
0.01 ~ "one tick or less". ymmv.
2017-06-18 13:32:12 +02:00
Marian Beermann
4689fd0c22 cache: explain fetch_missing_csize cost 2017-06-18 02:04:31 +02:00
Marian Beermann
2cbff48fd3 AdHocCache: explicate chunk_incref assertion 2017-06-18 02:01:27 +02:00
Marian Beermann
5eeca3493b TestAdHocCache 2017-06-18 02:01:27 +02:00
Marian Beermann
3c8257432a cache sync: fetch_missing_csize don't check ids against empty idx
This is always the case if self.do_cache is False.
2017-06-18 02:01:27 +02:00
Marian Beermann
fc7c560345 AdHocCache: fix size not propagating to incref 2017-06-18 02:01:27 +02:00
Marian Beermann
8aa745ddbd create: --no-cache-sync 2017-06-18 02:01:26 +02:00
Marian Beermann
c9c227f2ca cache sync: check Operation.READ compatibility with manifest 2017-06-12 23:46:49 +02:00
textshell
86363dcd4b Merge pull request #2648 from textshell/feature/mandatory-features-master
Add minimal version of in repository mandatory feature flags. (master)
2017-06-10 17:50:28 +02:00
Martin Hostettler
b8ad8b84da Cache: Wipe cache if compatibility is not sure
Add detection of possibly incompatible combinations
of the borg versions maintaining the cache and the featues used.
2017-06-10 11:42:48 +02:00
Marian Beermann
92a01f9d6c cache sync: fix incorrect .integrity location for .compact 2017-06-09 12:23:27 +02:00
Marian Beermann
3789459a41 cache sync: extract read_archive_index function 2017-06-09 12:23:26 +02:00
Marian Beermann
09a9d892cf cache sync: convert existing archive chunks idx to compact 2017-06-09 12:23:26 +02:00
Marian Beermann
6e011b9354 cache: compact hashindex before writing to chunks.archive.d 2017-06-09 12:23:26 +02:00
Marian Beermann
67b97f2223 cache sync: cleanup progress handling, unused parameters 2017-06-02 17:43:15 +02:00
Marian Beermann
835b0e5ee0 cache sync/remote: compressed, decrypted cache 2017-06-02 17:43:15 +02:00
Marian Beermann
c786a5941e CacheSynchronizer: redo as quasi FSM on top of unpack.h
This is a (relatively) simple state machine running in the
data callbacks invoked by the msgpack unpacking stack machine
(the same machine is used in msgpack-c and msgpack-python,
changes are minor and cosmetic, e.g. removal of msgpack_unpack_object,
removal of the C++ template thus porting to C and so on).

Compared to the previous solution this has multiple advantages
- msgpack-c dependency is removed
- this approach is faster and requires fewer and smaller
  memory allocations

Testability of the two solutions does not differ in my
professional opinion(tm).

Two other changes were rolled up; _hashindex.c can be compiled
without Python.h again (handy for fuzzing and testing);
a "small" bug in the cache sync was fixed which allocated too
large archive indices, leading to excessive archive.chunks.d
disk usage (that actually gave me an idea).
2017-06-02 17:43:15 +02:00
Marian Beermann
167875b753 cache sync: fix n^2 behaviour in lookup_name 2017-06-02 17:43:14 +02:00
Marian Beermann
9f8b967a6f cache sync: initialize master index to known capacity 2017-06-02 17:43:14 +02:00
Marian Beermann
740898d83b CacheSynchronizer 2017-06-02 17:43:14 +02:00
Marian Beermann
9032aa062b testsuite: simplify ArchiverCorruptionTestCase 2017-05-31 18:08:20 +02:00
Marian Beermann
0a5d9b6f7c cache sync: close archive chunks file before renaming 2017-05-31 18:06:28 +02:00
Marian Beermann
d35d388d9c cache integrity: handle interference from old versions 2017-05-25 17:44:01 +02:00
Marian Beermann
50ac9d914d testsuite: add ArchiverCorruptionTestCase 2017-05-25 17:44:01 +02:00
Marian Beermann
f59affe585 cache: fix possible printf issue with archive names in sync 2017-05-25 17:44:01 +02:00
Marian Beermann
addd7addfe cache: chunks.archive.d: autofix corruption 2017-05-25 17:44:01 +02:00
Marian Beermann
1dfe693003 cache: integrity checking in archive.chunks.d 2017-05-25 16:28:46 +02:00
Marian Beermann
2b518b7188 cache: add integrity checking of chunks and files caches 2017-05-25 16:28:46 +02:00
Marian Beermann
c23e1e28c6 use assert_secure for all commands that use the manifest
This already excludes the debug commands that we wouldn't want this on.
2017-05-20 14:58:17 +02:00
Marian Beermann
482b65eaea cache: extract CacheConfig class 2017-05-20 14:58:17 +02:00
Marian Beermann
848df38d08 Rename Key.passphrase_protected -> logically_encrypted & document 2017-05-12 20:36:23 +02:00
Marian Beermann
d964101eb5 consider repokey w/o passphrase == unencrypted 2017-05-07 22:13:49 +02:00
Marian Beermann
a976e11a63 create crypto package with key, keymanager, low_level 2017-05-02 20:49:27 +02:00
enkore
9a1c1e90c1 Merge pull request #2375 from enkore/buhdf
BORG_HOSTNAME_IS_UNIQUE=yes by default.
2017-04-05 14:09:58 +02:00
Marian Beermann
2ff75d58f2 remove Chunk() 2017-04-04 00:16:15 +02:00
Marian Beermann
bb6b4fde93 BORG_HOSTNAME_IS_UNIQUE=yes by default. 2017-04-01 21:28:41 +02:00
Thomas Waldmann
945880af47 implement async_response, add wait=True for add_chunk/chunk_decref
Before this changeset, async responses were:
- if not an error: ignored
- if an error: raised as response to the arbitrary/unrelated next command

Now, after sending async commands,  the async_response command must be used
to process outstanding responses / exceptions.

We are avoiding to pile up lots of stuff in cases of high latency, because we do NOT
first wait until ALL responses have arrived, but we just can begin to process responses.
Calls with wait=False will just return what we already have received.
Repeated calls with wait=True until None is returned will fetch all responses.

Async commands now actually could have non-exception non-None results, but
this is not used yet. None responses are still dropped.

The motivation for this is to have a clear separation between a request
blowing up because it (itself) failed and failures unrelated to that request /
to that line in the sourcecode.

also: fix processing for async repo obj deletes

exception_ignored is a special object used that is "not None" (as None is used to signal
"finished with processing async results") but also not a potential async response result value.

Also:

added wait=True to chunk_decref() and add_chunk()

this makes async processing explicit - the default is synchronous and you only
need to be careful and do extra steps for async processing if you explicitly
request async by calling with wait=False (usually for speed reasons).

to process async results, use async_response, see above.
2017-03-26 17:33:19 +02:00
Thomas Waldmann
f708183743 Revert "don't do "bigint" conversion for nanosecond mtime"
This reverts commit 8b2e7ec680.

We still need the bigint stuff for borg 1.0 compatibility.

# Conflicts:
#	src/borg/cache.py
2017-03-21 02:21:32 +01:00
Thomas Waldmann
b7a17a6db7 clamp (nano)second values to unproblematic range, fixes #2304
filesystem -> clamp -> archive (create)
2017-03-16 20:31:05 +01:00
Marian Beermann
d5515b6952 add msgid to progress output 2017-02-28 01:19:20 +01:00
enkore
7c9c4b61d7 Merge pull request #2157 from ThomasWaldmann/add-filesize
archived file items: add size metadata
2017-02-27 18:05:43 +01:00
Thomas Waldmann
0721cb1ede files cache: update inode number, fixes #2226 2017-02-27 15:30:55 +01:00
Thomas Waldmann
97bb1b7d9a deduplicate / refactor item (c)size code 2017-02-23 21:27:05 +01:00