borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.24k stars 744 forks source link

cache coherency issues leading to a slowdown #8503

Closed ThomasWaldmann closed 1 week ago

ThomasWaldmann commented 3 weeks ago

From https://github.com/borgbackup/borg/discussions/8451#discussioncomment-11066110 :

borg 2.0.0b12

There's an issue with the ChunkIndex cache if a connection breaks down:

ThomasWaldmann commented 2 weeks ago

There can be similar issues if multiple borg create run in parallel: the last one updating the cache wins and knowledge about existing chunks (which were added by the other borg create runs) might go away, leading to a future slowdown.

It never leads to corruption though, because only borg compact removes chunks (and it uses an exclusive lock while working).

Without the cache, that all would be way simpler. Pity that listing all repo objects takes so long that we need a cache.

ThomasWaldmann commented 2 weeks ago

Some ideas about how to solve this:

ThomasWaldmann commented 2 weeks ago

Even easier, compared to previous post:

ThomasWaldmann commented 1 week ago

8531 solves the mentioned issues when running multiple borg create in parallel.

ThomasWaldmann commented 1 week ago

8541 saves the new stuff from the chunk index every 10 minutes to repo/cache/chunks.*, so progress won't be lost if connection breaks down or borg is ctrl-c'ed.

note: this refers only to the chunk index, so borg will "know" what chunks are in the repo.

the files cache is currently only saved at the end, so that can still be a problem.