Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-04-12Change registration of the gitaly services on the gRPC serverPavlo Strokov
Current project structure sometimes causes us a circular dependency issues. The main reason of it is RegisterAll function in the internal/gitaly/service package. It is a package on a higher level that imports packages from the deeper levels, like internal/gitaly/service/blob, etc. It is not an issue for the production code, but it causes troubles in the tests. The solution used so far was to use a separate package '<package>_test' for the tests. Other than that the old server setup doesn't use production code for the initialization. With RunGitalyServer helper we re-use production code for gRPC server setup and can register only required services on it. The dependencies services relies on could be overwritten with the optional parameters. All dependencies assembled into a single struct Dependencies for that purpose as well as to reduce amount of parameters to pass into the function call. The access to the dependencies is done via a GetXXX methods, so it is easy to replace it with interface and whatever implementation afterwards.
2021-04-07inject backchannel ClientHandshaker from mainSami Hiltunen
This commit injects the multiplexing handshaker from Praefect's main to the dialing locations. This allows us to later plug in a backchannel server easily. This commit has no changes to the functionality itself.
2021-04-01Support variable replication factor in RepositoryReplicasSami Hiltunen
This commit changes RepositoryReplicas to support variable replication factor and repository specific primaries. RepositoryReplicas is an RPC that returns the checksums of the repository's replicas and which one is the primary. Currently the RPC only supports virtual storage scoped primaries due to use of GetShard. This commit plugs in PrimaryGetter so the RPC can use repository specific primary if they are enabled. Note that the RPC fails if one of the secondaries does not actually contain the repository. Due to this behavior, the assignments store is also injected to only get the checksum from the assigned host storages of the repository. This is done to avoid failures as the repository is not necessarily present on every storage with variable replication factor. With that in mind, some unassigned nodes may actually contain the repository but we do not return their checksums.
2021-03-01testhelper: Move repository helpers into `gittest`Patrick Steinhardt
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.
2021-03-01testhelper: Move commit helpers into `gittest`Patrick Steinhardt
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.
2021-02-16Removal of git.NewCommandPavlo Strokov
After long rounds of refactoring we finally can remove git.NewCommand function. The change also includes removal of the TODO left because of the NewCommand usage with the global config.Config variable. And as a final step the doc is updated and now mentions usage of the git.CommandFactory interface instead of git.NewCommand(). Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
2021-02-10Refactoring of the test dependent on runPraefectServerWithGitalyPavlo Strokov
Helper function runPraefectServerWithGitaly is hard to change and configure. It changes the state of the passed arguments internally which is not obvious and requires developers to spend a lot more time to work with it. We can't use a new config builder as there are still dependencies on the global config.Config variable in the implementation those tests verify. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
2020-12-16Removal of helper.GetPathPavlo Strokov
helper.GetPath is not used anymore in the production code so we remove it and refactor all usages of it. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
2020-11-20Unbound initialization and validation funcs from global ConfigPavlo Strokov
In order to remove dependency on the global config.Config var we need to break dependencies between Config and it's initialization and validation functions. Most of them now represented as a methods on the config.Cfg type. It allows us to setup required Cfg struct for the tests to run without need to sync changes done on the shared global Config var. The tests that were heavily dependent on the Config var now depend on the struct initialized inside the test instead. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699 Blocks: https://gitlab.com/gitlab-org/gitaly/-/issues/3166
2020-09-07gitaly: Move Gitaly-specific code into `internal/gitaly`Patrick Steinhardt
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.
2020-08-06Feature flags enabling for tests.Pavlo Strokov
It is decided to go with all features enabled by default behaviour for tests. This should help us identify potential problems with feature flag combinations enabled in production. To verify implementation without feature flag enabled it should be disabled explicitly in the test. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2702
2020-07-22Remove Praefect primary from configPaul Okstad
2020-06-29Use of 'locator' instead of func dependent on global configPavlo Strokov
Migration of 'repository' service to use 'locator' injected dependency to resolve repo path/location. Fix of race condition https://gitlab.com/gitlab-org/gitaly/-/jobs/613399879 in the tests. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
2020-05-29Praefect: move of models packagePavlo Strokov
After removal of Datastore struct it make sense to move entities of the models package into config package. As it is has only a configuration purpose. As well 'node' configuration removed from Config as it is not used anymore. Closes: https://gitlab.com/gitlab-org/gitaly/-/issues/2613
2020-04-14Remove test data after test completionPavlo Strokov
Fix tests that doesn't clean up after run. Unused code removed: `satisfyConfigValidation`,`cwd`. Global Config changed to generate `BinDir` instead of `ConfigureGitalyHooksBinary` and `ConfigureGitalySSH`. Deferred cleanup will report about errors. `testhelper.TempDir` simplified as there is no much sense in `prefix` parameter.
2020-03-02Change ListRepositories RPC to RepositoryReplicasJohn Cai
Instead of having an RPC return all repositories and their checksums, have an RPC that takes a repository as its argument and returns checksums of the primary and replicas.