* restic: add BlobBuffer pool types
Based on the buffer type used by the archiver. The main change is that
`Get()` now always returns a slice with length zero.
* repository: add BlobBufferPool to BlobSaverAsync
* repository: change SaveBlobAsync to take a BlobBuffer
Ownership of the buffer transfers to SaveBlobAsync. Callers can now take
a buffer from the buffer pool.
Internally saveAndEncrypt now reuses pooled buffers.
* archiver: switch fileSaver to repository BlobBufferPool
Ownership of the buffer transfers to SaveBlobAsync. Callers can now take
a buffer from the buffer pool.
Internally saveAndEncrypt now reuses pooled buffers.
restic init generated and uploaded the key file first and only saved the
config afterwards. If two clients ran init against the same empty
repository location at nearly the same time, the backend could end up
with two key files but only one config file, since backends that reject
overwrites let only one of the two config writes succeed. The losing
client's key file stayed in the repository without ever belonging to a
valid config, so clients picking that key later would fail with a
"config or key ... is damaged" error instead of a clear diagnostic.
Reorder Repository.init so the config is saved before the key file is
uploaded. To make that possible, AddKey no longer generates a random
master key internally; callers now supply the master key to encrypt and
store. The two other callers of AddKey (key add, key passwd) already had
an existing key available and pass that through unchanged.
Current benchmarks all work with a single archiver, and are not suitable
for testing changes which might affect contention.
Add a benchmark with multiple small files and multiple concurrent
archivers.
The macOS failure in #22146 reaches the two-second readiness deadline. Give the test server ten seconds to start while retaining immediate readiness and context cancellation handling.
Unit tests fail on ppc64le due to a bug in golang.org/x/sys
Upstream fix[^1] is included in the v0.50.0 release.
Came across packaging for Alpine, which defaults to building PIE
binaries, when ppc64le build was segfaulting[^2] in the unit tests.
e.g.
```
--- FAIL: TestBackup (0.01s)
testing.go:30: using low-security KDF parameters for test
config.go:59: disabling check of the chunker polynomial
testing.go:30: using low-security KDF parameters for test
config.go:59: disabling check of the chunker polynomial
lock_file.go:93: setting lock timeout to 0s
panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10a1daf38]
```
[^1]: https://github.com/golang/go/issues/82324
[^2]: https://gitlab.alpinelinux.org/bdd/aports/-/jobs/2617025
In UpgradeRepo, if upgradeRepository fails, the error handler attempts
contingency rollback by re-uploading the original config file.
However, the contingency path unconditionally executed repo.be.Remove(ctx, h)
before calling repo.be.Save. On backends supporting atomic replacement (such
as local filesystems), a failed upgrade (e.g. out-of-disk-space or permissions
error while writing the temporary file) leaves the original, valid version 1
configuration file completely intact on disk.
Unconditionally removing the config file during rollback actively deletes
the working configuration. If the subsequent Save call also fails, the
repository is left permanently corrupted without a config file.
Condition the pre-removal on !repo.be.Properties().HasAtomicReplace, matching
the forward upgrade path in upgradeRepository. Add a unit test asserting that
aborted upgrades on atomic backends preserve the intact original configuration.
---------
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
When loading or iterating a directory tree failed, traverseTreeInner
returned a nil file list together with the error. If the error handler
ignored the error, the caller still called leaveDir with that nil list,
and restore --delete removed every existing entry of the directory in
the target, even though the expected content was simply unknown.
Force disable deletion in that case, the same way it is already done
for invalid node names.
Signed-off-by: Dean Chen <862469039@qq.com>
* Small typos and clarification in contributing guide
* cross-link contributing guide and issue/pr template
* drop GOPATH mention
* don't include merge commits in PRs
* make high review delays explicit
* explicitly ask for link to current PR in changelog template
* clarify docs changes
* use bug template as authoritative place'
* consolidate development information in 090_participating
Also move issue / PR creation relevant information into contributing.md.
* clarify meaning of assigning to a pull request
* link to minimum go version
* minor typos
* golanci-lint is always applied in full
* add micro summary
* more typo fixes
* always run golangci-lint
* Simplify issue/pr template
* Fix IRC webchat link
* Move security policy to SECURITY.md
* address review comments