1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-10 14:15:43 +00:00
Commit graph

8780 commits

Author SHA1 Message Date
Thomas Waldmann
dc9fff9953
locking: ignore+delete locks of dead processes 2024-09-07 22:04:58 +02:00
Thomas Waldmann
86dc673649
compact: fix dsize computation if wanted chunks are present in repo 2024-09-07 22:04:56 +02:00
Thomas Waldmann
551834acfc
rcompress: not supported for legacy repos 2024-09-07 22:04:55 +02:00
Thomas Waldmann
e2aa9d56d0
build_chunkindex_from_repo: reduce code duplication 2024-09-07 22:04:53 +02:00
Thomas Waldmann
07ab6e02f4
hashindex types: remove some unused stuff 2024-09-07 22:04:52 +02:00
Thomas Waldmann
15c70397c1
ChunkIndex: remove unused .merge method
LocalCache used this to assemble a new overall chunks index from multiple
chunks.archive.d's single-archive chunks indexes.
2024-09-07 22:04:50 +02:00
Thomas Waldmann
ddf6812703
ChunkIndex: remove .incref method 2024-09-07 22:04:49 +02:00
Thomas Waldmann
ccc84c7a4e
cache: renamed .chunk_incref -> .reuse_chunk, boolean .seen_chunk
reuse_chunk is the complement of add_chunk for already existing chunks.

It doesn't do refcounting anymore.

.seen_chunk does not return the refcount anymore, but just whether the chunk exists.

If we add a new chunk, it immediately sets its refcount to MAX_VALUE, so
there is no difference anymore between previously existing chunks and new
chunks added. This makes the stats even more useless, but we have less complexity.
2024-09-07 22:04:47 +02:00
Thomas Waldmann
f9d2e6827b
ArchiveChecker: don't do precise refcounting here
That's the job of borg compact and not needed inside borg check.
check only needs to know if a chunk is present in the repo.
2024-09-07 22:04:46 +02:00
Thomas Waldmann
e9c42a7d6b
ArchiveChecker: .rebuild_refcounts -> .rebuild_archives 2024-09-07 22:04:44 +02:00
Thomas Waldmann
266e6caa80
ArchiveChecker: remove unused possibly_superseded code
We don't care about unused or superseded repo objects any more here,
borg compact will deal with them.
2024-09-07 22:04:43 +02:00
Thomas Waldmann
bafbf625e7
ArchiveChecker.verify_data: simplify / optimize
.init_chunks has just built self.chunks using repository.list(), so don't
call that again, but just iterate over self.chunks.

also some other changes, making the code much simpler.
2024-09-07 22:04:41 +02:00
Thomas Waldmann
ef47666627
cache/hashindex: remove decref method, don't try to remove chunks on exceptions
When the AdhocCache(WithFiles) queries chunk IDs from the repo to build the chunks
index, it won't know their refcount and thus all chunks in the index have their
refcount at the MAX_VALUE (representing "infinite") and that would never decrease
nor could that ever reach zero and get the chunk deleted from the repo.

Only completely new chunks first written in the current borg run have a valid
refcount.

In some exception handlers, borg tried to clean up chunks that won't be used
by an item by decref'ing them. That is either:
- pointless due to refcount being at MAX_VALUE
- inefficient, because the user might retry the backup and would need to
  transmit these chunks to the repo again.

We'll just rely on borg compact ONLY to clean up any unused/orphan chunks.
2024-09-07 22:04:40 +02:00
Thomas Waldmann
d27b7a7981
cache: remove transactions, load files/chunks cache on demand 2024-09-07 22:04:38 +02:00
Thomas Waldmann
57268909f8
upgrade black to 24.x 2024-09-07 22:04:36 +02:00
Thomas Waldmann
a40978ae1b
blacken the code 2024-09-07 22:04:35 +02:00
Thomas Waldmann
ec1d89f477
compact: better stats
- compression factor
- dedup factor
- repo size

All values are approx. values without considering overheads.
2024-09-07 22:04:34 +02:00
Thomas Waldmann
c67cf07522
Repository.list: return [(id, stored_size), ...]
Note: LegacyRepository still returns [id, ...] and so does RemoteRepository.list,
if the remote repo is a LegacyRepository.

also: use LIST_SCAN_LIMIT
2024-09-07 22:03:56 +02:00
Thomas Waldmann
a15cd1e493
repository: remove __len__ and __contains__ 2024-09-07 22:01:21 +02:00
Thomas Waldmann
1a382a8bcf
set repository._location only 2024-09-07 22:01:19 +02:00
Thomas Waldmann
3408e942de
add sftp: / borgstore to quickstart docs 2024-09-07 22:01:18 +02:00
Thomas Waldmann
22b68b0199
add sftp: to repository url format docs 2024-09-07 22:01:16 +02:00
Thomas Waldmann
ec8a127b01
BORG_REPO env var: behave the same when unset or when set to empty string 2024-09-07 22:01:14 +02:00
Thomas Waldmann
7714b6542a
support sftp: repositories via borgstore 2024-09-07 22:01:12 +02:00
Thomas Waldmann
05739aaa65
refactor: rename repository/locking classes/modules
Repository -> LegacyRepository
RemoteRepository -> LegacyRemoteRepository
borg.repository -> borg.legacyrepository
borg.remote -> borg.legacyremote

Repository3 -> Repository
RemoteRepository3 -> RemoteRepository
borg.repository3 -> borg.repository
borg.remote3 -> borg.remote

borg.locking -> borg.fslocking
borg.locking3 -> borg.storelocking
2024-09-07 22:01:11 +02:00
Thomas Waldmann
84bd2b20d5
rcreate: refer to borgstore rather than filesystem directory 2024-09-07 22:01:09 +02:00
Thomas Waldmann
15e759c506
rcompress: fix help and comments
no "on-disk order" anymore.
2024-09-07 22:01:08 +02:00
Thomas Waldmann
8455c95003
info: do not output deduplicated_size
No precise refcounting, can't compute that inexpensively.
2024-09-07 22:01:06 +02:00
Thomas Waldmann
0b85b1a8bd
parseformat: remove dsize and unique_chunks placeholder
We don't have precise refcounts, thus we can't compute these.
2024-09-07 22:01:04 +02:00
Thomas Waldmann
c5023da729
transfer: rather talk of presence than refcount 2024-09-07 22:01:02 +02:00
Thomas Waldmann
20c180c317
debug: remove refcount-obj command
borg doesn't do precise refcounting anymore, so this is pretty useless.
2024-09-07 22:01:01 +02:00
Thomas Waldmann
2be98c773b
check: update comment / help 2024-09-07 22:01:00 +02:00
Thomas Waldmann
d9f24def6a
remove unused remote.RepositoryServer 2024-09-07 22:00:59 +02:00
Thomas Waldmann
e23231b2c4
remove Repository3.commit
didn't do anything anyway in this implementation.
2024-09-07 22:00:56 +02:00
Thomas Waldmann
5e3f2c04d5
remove archive checkpointing
borg1 needed this due to its transactional / rollback behaviour:
if there was uncommitted stuff in the repo, next repo opening automatically
rolled back to last commit. thus we needed checkpoint archives to reference
chunks and commit the repo.

borg2 does not do that anymore, unused chunks are only removed when the
user invokes borg compact.

thus, if a borg create gets interrupted, the user can just run borg create
again and it will find some chunks are already in the repo, making progress
even if borg create gets frequently interrupted.
2024-09-07 22:00:54 +02:00
Thomas Waldmann
c2890efdd1
docs: update the repository filesystem docs
In the end, it will all depend on the borgstore backend that will be used,
so we better point to the borgstore project for details.
2024-09-07 22:00:52 +02:00
Thomas Waldmann
5c325e3254
repository3.list: more efficient implementation 2024-09-07 22:00:50 +02:00
Thomas Waldmann
68e64adb9f
cache: add log msg to _load_chunks_from_repo
For big repos, this might take a while, so at least have messages on debug level.
2024-09-07 22:00:49 +02:00
Thomas Waldmann
6605f588cf
remove the repository.flags call / feature
this heavily depended on having a repository index where the flags get stored.

we don't have that with borgstore.
2024-09-07 22:00:48 +02:00
Thomas Waldmann
60edc8255f
repository/repository3: remove .scan method
This was an implementation specific "in on-disk order" list method that made sense
with borg 1.x log-like segment files only.

But we now store objects separately, so there is no "in on-disk order" anymore.
2024-09-07 22:00:46 +02:00
Thomas Waldmann
1189fc3495
debug dump-repo-objs: remove --ghost
This was used for an implementation detail of the borg 1.x
repository code, dumping uncommitted objects. Not needed any more.

Also remove local repository method scan_low_level, it was only used by --ghost.
2024-09-07 22:00:45 +02:00
Thomas Waldmann
bfbf3ba7aa
repository3.check: implement --repair
Tests were a bit tricky as there is validation on 2 layers now:
- repository3 does an xxh64 check, finds most corruptions already
- on the archives level, borg also does an even stronger cryptographic check
2024-09-07 22:00:43 +02:00
Thomas Waldmann
cb9ff3b490
fuse/mount code and test fixes 2024-09-07 22:00:41 +02:00
Thomas Waldmann
3e7a4cd814
make ruff happy 2024-09-07 22:00:40 +02:00
Thomas Waldmann
1231c961fb
blacken the code 2024-09-07 22:00:39 +02:00
Thomas Waldmann
d59306f48b
rinfo: remove size stats related docs, not shown any more 2024-09-07 22:00:38 +02:00
Thomas Waldmann
dcde48490e
remove CacheStatsMixin 2024-09-07 22:00:36 +02:00
Thomas Waldmann
fc6d459875
cache: replace .stats() by a dummy
Dummy returns all-zero stats from that call.

Problem was that these values can't be computed from the chunks cache
anymore. No correct refcounts, often no size information.

Also removed hashindex.ChunkIndex.summarize (previously used by the above mentioned
.stats() call) and .stats_against (unused) for same reason.
2024-09-07 22:00:35 +02:00
Thomas Waldmann
0306ba9a63
get rid of the CacheSynchronizer
Lots of low-level code written back then to optimize runtime of some
functions.

We'll solve this differently by doing less stats, esp. if it is expensive to compute.
2024-09-07 22:00:33 +02:00
Thomas Waldmann
7a93890602
archive.calc_stats: remove unique size computation 2024-09-07 22:00:32 +02:00