Age | Commit message (Collapse) | Author |
|
It's currently not possible to use our git DSL in the testhelper package
because of an import cycle between the testhelper and git package. To
fix this import cycle, we thus move test-related git helpers into the
gittest package.
This commit moves the repository helpers. As we're already touching all
sites which use these helpers anyway, it also aligns functions to have
more consistent naming.
|
|
It's currently not possible to use our git DSL in the testhelper package
because of an import cycle between the testhelper and git package. To
fix this import cycle, we thus move test-related git helpers into the
gittest package.
This commit moves the commit helpers.
|
|
CreateCommitInAlternateObjectDirectory is not dependent on the global
config.Config variable anymore.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
|
|
During a test of the Gitaly background maintenance worker, we observed
high resource usage and a dramatic drop in IO while request latency
increased:
https://gitlab.com/gitlab-com/gl-infra/production/-/issues/3208#note_468729372
One possible reason this may have occurred is due to a large
repositories being fully repacked and hogging all cores on the server.
One way to mitigate this is to restrict the pack-files process to using
fewer threads. See a similar strategy used in Omnibus:
https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/417
This will increase the time to optimize large
repositories, but that is okay since this is a background process that
runs for long periods of time.
|
|
Function 'command.GitPath()' depends on the global 'config.Config' variable
and uses internal call to change the state of it in case it is not
yet initialized properly. To break this dependency we remove the function
and replaces it with direct access to the configured value.
It could be set from the config.toml file or from env using GITALY_TESTING_GIT_BINARY.
If none used the value will be resolved from the system.
In the tests the value is set on the configuration stage and point to the temporary
directory.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
|
|
We're about to move the test storage into the global temporary test
directory, which will make use of `testhelper.TestRepository()` not work
anymore. This commit thus refactors `internal/gitaly/service/repository`
to use `testhelper.NewTestRepo()` instead.
|
|
In order to break dependency on the shared global config.Config
variable the Locator interface is injected into the service.
Calls that eventually lead to global config.Config var were
removed.
Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
|
|
Package path should be used to manipulate
abstract slash-delimited paths only,
not real file paths.
|
|
Since the introduction of Praefect, our code layout started to become
confusing: while Praefect code lives in `internal/praefect`,
Gitaly-specific code is all over the place and not neatly singled out.
This makes it hard at times to tell apart Praefect- and Gitaly-specific
from generic code.
To improve the situation, this commit thus moves most of the server
specific code into a new `internal/gitaly` package. Currently, this is
the `internal/config`, `internal/server`, `internal/service` and
`internal/rubyserver` packages, which are all main components of Gitaly.
The move was realized with the following script:
#!/bin/sh
mkdir -p internal/gitaly
git mv internal/{config,server,service,rubyserver} internal/gitaly/
find . -name '*.go' -exec sed -i \
-e 's|gitlab-org/gitaly/internal/rubyserver|gitlab-org/gitaly/internal/gitaly/rubyserver|' \
-e 's|gitlab-org/gitaly/internal/server|gitlab-org/gitaly/internal/gitaly/server|' \
-e 's|gitlab-org/gitaly/internal/service|gitlab-org/gitaly/internal/gitaly/service|' \
-e 's|gitlab-org/gitaly/internal/config|gitlab-org/gitaly/internal/gitaly/config|' {} \;
In addition to that, some minor adjustments were needed for tests which
used relative paths.
|