Commit Graph

10 Commits

Author SHA1 Message Date
Julio Lopez
8098f49c90 chore(ci): remove exclusion for unused ctx parameters (#4530)
Remove unused-parameter exclusion for `ctx` in revive linter.

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-26 23:11:36 -07:00
Julio López
2a22281271 fix(server): ensure server uploads "repodiag" blobs (#4358)
The kopia server was not uploading any logs to the repository,
because "repodiag" blob uploads would always fail.

The cause was the following: when the (log) repodiag blob
PUT operation was initiated, the `Context` used for this
operation was already canceled.

The context used for blob uploads is passed to
`repodiag.NewLogManager` when opening the repository.
In the case of the kopia server, the repository is asynchronously
opened in `server.Server.InitReposotoryAsync`. The context
passed to `repo.Open` is canceled after the "open repository"
server task completes.

This issue was introduced in #1691

Change:
Use `context.WithoutCancel()` instead of the context passed
when the repo diagnoser is created.

New tests are included to reproduce this failure and verify
the fix.
- test: ensure server logs are uploaded to the repo
- test: honor cancellation in map storage
- test: repodiag context cancellation

Ref:
- #1691
2025-01-22 20:13:39 -08:00
Julio López
961a39039b refactor(general): use errors.New where appropriate (#4160)
Replaces 'errors.Errorf\("([^"]+)"\)' => 'errors.New("\1")'
2024-10-05 19:05:00 -07:00
Julio López
3a9bafa366 refactor(general): rename repodiag.logWriteSyncer (#4109)
* refactor(general): clarify comments

* refactor(general): rename `repodiag.logWriteSyncer`

This name reflects:
- the function of the struct; and
- the interface it implements (`zapcore.WriteSyncer`)
2024-09-15 09:34:23 -07:00
Julio López
c936075ab0 refactor(general): rename repodiag.BlobWriter (#4110)
This name reflects the function of the struct / type.

The previous name (`Writer`) conveyed that this type
implemented the `Writer` interface / `Write` function,
which it does not.
2024-09-15 09:33:58 -07:00
Julio López
948162dce5 refactor(general): minor miscellaneous cleanups (#4074)
Cleanups:

- use non-format variants of Log/Print with no additional args;
- fold in Fprintf call with no args into the following one;
- add missing arg placeholder in format strings;
- use require.Positive instead of Greater(..., 0);
- rename function to fillWithZeros to avoid collision with builtin clear;
- define type for context key to avoid collisions.
2024-08-25 22:10:46 -07:00
Julio López
1f9f9a1846 chore(general): use non-formatting log variants when there is no formatting (#3931)
Use non-formatting logging functions for message without formatting.
For example, `log.Info("message")` instead of `log.Infof("message")`

Configure linter for printf-like functions
2024-06-18 23:13:17 -07:00
Jarek Kowalski
09415e0c7d chore(ci): upgraded to go 1.22 (#3746)
Upgrades go to 1.22 and switches to new-style for loops

---------

Co-authored-by: Julio López <1953782+julio-lopez@users.noreply.github.com>
2024-04-08 09:52:47 -07:00
Jarek Kowalski
a8e4d50600 build(deps): upgraded linter to v1.55.2, fixed warnings (#3611)
* build(deps): upgraded linter to v1.55.2, fixed warnings

* removed unsafe hacks with better equivalents

* test fixes
2024-02-02 23:34:34 -08:00
Jarek Kowalski
c478141bbf refactor(repository): refactor internal/repolog package to support writing metrics in the future (#3610)
* renamed internal/repolog to internal/repodiag

* refactored initialization

* additional tests

* linter fixes
2024-02-02 22:19:24 -08:00