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
2023-11-22log: Remove message producerbase_ej-5661_grpc-middleware-to-v2-messageproducerEric Ju
1. add reporter, option, decider 2. change interceptor interface 3. fixing tests.
2023-11-22Merge branch 'wc/prune-noblock' into 'master'Sami Hiltunen
gitaly: Don't cleanup cgroups on exit See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6532 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: Sami Hiltunen <shiltunen@gitlab.com> Co-authored-by: Will Chandler <wchandler@gitlab.com>
2023-11-22Merge branch 'jt-clone-from-url-error' into 'master'karthik nayak
repository: Add resolved address to `CreateRepositoryFromURL` error See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6542 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: James Fargher <jfargher@gitlab.com> Co-authored-by: Justin Tobler <jtobler@gitlab.com>
2023-11-22repository: Add resolved address to `CreateRepositoryFromURL` errorJustin Tobler
The `CreateRepositoryFromURL` RPC may have a resolved address set in its request to mitigate DNS rebinding. In the event the underlying `git-clone(1)` process returns an error, append the resolved address as structured error metadata for debugging.
2023-11-21Merge branch 'jc/add-link-to-gitaly-training-videos' into 'master'Andras Horvath
Add links to Gitaly Training youtube channel See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6538 Merged-by: Andras Horvath <ahorvath@gitlab.com> Approved-by: Andras Horvath <ahorvath@gitlab.com> Co-authored-by: John Cai <jcai@gitlab.com>
2023-11-21Merge branch 'jt-docs-remote-proto' into 'master'Justin Tobler
proto: Add documentation for `RemoteService` See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6536 Merged-by: Justin Tobler <jtobler@gitlab.com> Approved-by: Evan Read <eread@gitlab.com> Reviewed-by: Justin Tobler <jtobler@gitlab.com>
2023-11-21gitaly: Move asynchronous tasks to end of startupWill Chandler
We have several background tasks spawned as part Gitaly's startup process. Currently we start many of these towards the beginning of startup, but on systems with limited available parallelism these may slow the progression of the main goroutine. Move these to the end of startup so that critical tasks can complete as quickly as possible. On a 2-core host this improves startup time by roughly 15%: Benchmark 1: ./async-prune serve config.toml Time (mean ± σ): 535.3 ms ± 106.7 ms [User: 462.0 ms, System: 228.5 ms] Range (min … max): 436.9 ms … 727.9 ms 10 runs Benchmark 2: ./tasks-end serve config.toml Time (mean ± σ): 468.0 ms ± 23.5 ms [User: 438.6 ms, System: 220.6 ms] Range (min … max): 430.8 ms … 517.3 ms 10 runs Summary ./tasks-end serve config.toml ran 1.14 ± 0.24 times faster than ./async-prune serve config.toml Changelog: performance
2023-11-21gitaly: Prune old cgroups in backgroundWill Chandler
Currently we block on startup while pruning cgroups from old Gitaly processes. However, stale cgroups have no impact on Gitaly's other startup tasks as we namespace them by pid. We can safely make this a background task so that critical startup tasks can move ahead unimpeded. On a host with 1000 repo cgroups and teardown is ~1ms per cgroup, this improves startup time by roughly 15%. On our hosts where cgroup teardown is closer to 20ms this will have a much larger impact. Benchmark 1: ./gitaly-5b092369 serve config.toml Time (mean ± σ): 632.7 ms ± 150.7 ms [User: 473.7 ms, System: 226.7 ms] Range (min … max): 461.9 ms … 868.1 ms 10 runs Benchmark 2: ./async-prune serve config.toml Time (mean ± σ): 549.3 ms ± 127.9 ms [User: 464.6 ms, System: 223.4 ms] Range (min … max): 427.1 ms … 754.6 ms 10 runs Summary ./async-prune serve config.toml ran 1.15 ± 0.38 times faster than ./gitaly-5b092369 serve config.toml
2023-11-21gitaly: Don't cleanup cgroups on exitWill Chandler
To mitigate the impact of removing `tableflip` we need both startup and shutdown of Gitaly processes to be as fast as possible. With 105f6dd816 (cgroups: Create repository cgroups on-demand, 2023-10-26) we improved startup times by creating cgroups individually when needed, rather than as a blocking task during startup. We currently block shutdown while removing our existing cgroups. This is as slow as cgroup creation, taking up to 20 seconds to remove 1000 cgroups on hosts with large number cgroups. `Cleanup` is equivalent to an eager `PruneOldCgroups` scoped to the current processes's cgroups. However, there is no urgent need to remove cgroups immediately, so long as we ensure they don't build up excessively. We can rely on the eventual cleanup from `PruneOldCgroups` run by the next Gitaly process, which allows us to avoid delaying shutdown. Stop using `Cleanup` and remove it from the `cgroup.Manager` interface.
2023-11-21Merge branch 'toon-poc-bundle-uri' into 'master'James Fargher
ssh & smarthttp: Advertise server-side backups as bundle-URI See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6472 Merged-by: James Fargher <jfargher@gitlab.com> Approved-by: James Fargher <jfargher@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Reviewed-by: James Fargher <jfargher@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Toon Claes <toon@gitlab.com>
2023-11-21Merge branch 'smh-record-refx-tx-ordering' into 'master'Sami Hiltunen
Record reference transaction ordering in Transaction See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6524 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com>
2023-11-20Merge branch 'smh-remove-namespace-service' into 'master'Quang-Minh Nguyen
Remove NamespaceService Closes #3803 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6292 Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Sami Hiltunen <shiltunen@gitlab.com>
2023-11-20Team Member Onboarding: Add a link to the Gitaly Training playlistJohn Cai
The Gitaly Training and resources playlist will house all of our Gitaly videos. Replace the current bullet point with a link to the playlist.
2023-11-20README: Add a link to the Gitaly Training channelJohn Cai
Now that we have more Gitaly training videos, we've conslidated these all into one youtube unfiltered playlist. Let's replace the existing block of text with a link to the playlist so that we don't have to keep updating this README when we do more training videos.
2023-11-20proto: Add documentation for `RemoteService`Justin Tobler
Some of the RPC definitions and protobuf message types in the `RemoteService` lack documentation. Add the missing documentation.
2023-11-20Merge branch 'smh-snapshot-multiple-repos' into 'master'Will Chandler
Allow snapshotting multiple repositories See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6522 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Co-authored-by: Sami Hiltunen <shiltunen@gitlab.com>
2023-11-20Merge branch 'qmnguyen0711/fix-inactive-file' into 'master'Will Chandler
limiter: Ignore `total_inactive_file` instead of `inactive_file` See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6529 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Quang-Minh Nguyen <qmnguyen@gitlab.com>
2023-11-20Merge branch 'sec-release-template-updates' into 'master'John Cai
Link security tracking issue in the security issue template See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6535 Merged-by: John Cai <jcai@gitlab.com> Co-authored-by: Steve Abrams <sabrams@gitlab.com>
2023-11-20ssh: Advertise server-side backups as bundle-URIToon Claes
In previous commits, we've added server-side backups for bundle-URI in the smarthttp server. Now we can do the same in the ssh server and advertise server-side bundles to be used for bundle-URI. Inject all the git configuration into the git-upload-pack(1) command to advertise these when possible. Label: feature::addition
2023-11-20smarthttp: Advertise server-side backups as bundle-URIToon Claes
Now all is set up to make it possible to advertise server-side bundles to be used for bundle-URI. Inject all the git configuration into the git-upload-pack(1) command to advertise these when possible. Label: feature::addition
2023-11-20backup: Add SignedURL to SinkToon Claes
Expose the SignedURL function of the bucket through the Sink interface. Some blob backends will support this. It's hard to test signed URLs with actual servers, so for now we can only test some backends return a "not implemented" error.
2023-11-20smarthttp: Pass on the backup.Locator & Sink dependenciesToon Claes
To use server-side backups for bundle-URI we'll need the backup.Locator & backup.Sink in the smarthttp server. Extract these from the dependencies.
2023-11-20smarthttp: Advertise bundle-uri capabilityToon Claes
The first step toward using bundle-URI is making the server advertise it supports this capability. Insert uploadpack.advertiseBundleURIs in the git config so the info/refs response contains the bundle-uri capability. With this we also introduce the feature flag that allows us to toggle the use of bundle-URIs.
2023-11-20backup: Make NewStorageServiceSink non-publicToon Claes
We're about to make some changes to this function and callers should not be aware of it's implementation details. That's why we're making this function non-public and make ResolveSink() the only entry point to initialize a backup.Sink.
2023-11-20Merge branch 'sh-fix-issue-5694' into 'master'Patrick Steinhardt
requestinfohandler: Restore missing log fields in SSHReceivePack See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6534 Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Stan Hu <stanhu@gmail.com>
2023-11-20Merge branch 'jt-docs-ref-proto' into 'master'Patrick Steinhardt
proto: Add documentation for `RefService` See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6527 Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com> Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com> Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com> Reviewed-by: Justin Tobler <jtobler@gitlab.com> Co-authored-by: Justin Tobler <jtobler@gitlab.com>
2023-11-17Link security tracking issue in the security issue templateSteve Abrams
2023-11-17limiter: Ignore `total_inactive_file` instead of `inactive_file`Quang-Minh Nguyen
In https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6508, we implemented a fix to ignore highly evictable Page Caches from cgroup memory threshold. The used metric was parent cgroup's `inactive_file`. Unfortunately, that metric reflects the inactive Page Caches of direct processes inside the parent cgroup. It doesn't account for the indirect processes in children repository cgroups. We don't spawn any process in the parent cgroup. So, the fix was useless. In Cgroup V1, `memory.stat` has `total_inactive_file`. It's exactly what we are looking for. In Cgroup V2, `inactive_file` includes all of its substree consumptions. So, we can keep using that field.
2023-11-17Merge branch 'wc/cgroup-unify-tests' into 'master'Quang-Minh Nguyen
cgroups: Unify v1 and v2 tests See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6519 Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: James Liu <jliu@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Co-authored-by: Will Chandler <wchandler@gitlab.com>
2023-11-17requestinfohandler: Restore missing log fields in SSHReceivePackStan Hu
a497cfc8 replaced the v1 grpc-go-middleware `Tags` with the v2 `logging.Fields`, but this caused fields such as `correlation_id` and `user_id` to be dropped for calls such as `SSHReceivePack`. This occurred because the logger still uses the v1 `StreamServerInterceptor` and `UnaryServerInterceptor`, which extracts logging fields from a different context key than the one used by v2 interceptors. To restore these logging fields until the v2 middlewares are used, restore the v1 `Tags`. This means we have a bit of redundancy since the fields are stored for both v1 and v2 formats. However, once https://gitlab.com/gitlab-org/gitaly/-/work_items/5661 is complete, the v1 middleware and `Tags` can be dropped. Changelog: fixed
2023-11-16proto: Add documentation for `RefService`Justin Tobler
Some of the RPC definitions and protobuf message types in the `RefService` lack documentation. Add the missing documentation.
2023-11-16Merge branch 'jt-praefect-pool-sync' into 'master'Sami Hiltunen
praefect: Reconcile non-matching object pools during replication See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6526 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Co-authored-by: Justin Tobler <jtobler@gitlab.com>
2023-11-16Merge branch 'wc/make-test-wal' into 'master'Sami Hiltunen
Makefile: Update test-wal to call test-go See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6530 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: Sami Hiltunen <shiltunen@gitlab.com> Co-authored-by: Will Chandler <wchandler@gitlab.com>
2023-11-15Makefile: Update test-wal to call test-goWill Chandler
Currently the `test-wal` Makefile target will call the `test` target internally. This will run both Gitaly's Go tests and our linter tests. If overriding `TEST_PACKAGES` this may result in a spurious failure on the linter tests: make test-wal TEST_PACKAGES=./internal/gitaly/storage/storagemgr ✓ internal/gitaly/storage/storagemgr (39.673s) DONE 237 tests in 42.262s stat /Users/wchandler/devel/gdk/gitaly/tools/golangci-lint/gitaly/internal/gitaly/storage/storagemgr: directory not found === Errors stat /Users/wchandler/devel/gdk/gitaly/tools/golangci-lint/gitaly/internal/gitaly/storage/storagemgr: directory not found DONE 0 tests, 1 error in 0.008s make: *** [test-gitaly-linters] Error 1 Switch `test-wal` to use the `test-go` target which will skip the linter.
2023-11-15Merge branch 'jt-ff-remove-transactional-link' into 'master'Will Chandler
featureflag: Remove `TransactionalLinkRepository` See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6528 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Co-authored-by: Justin Tobler <jtobler@gitlab.com>
2023-11-15Merge branch ↵karthik nayak
'5559-task5653-update-module-github-com-grpc-ecosystem-go-grpc-middleware-to-v2' into 'master' package: Upgrade to go-grpc-middleware/v2 (requestinfohandler, sentryhandler) Closes #5653 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6495 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com> Reviewed-by: Eric Ju <eju@gitlab.com> Co-authored-by: Eric Ju <eju@gitlab.com>
2023-11-15Merge branch '4277-deprecate-the-renamerepository-rpc' into 'master'Sami Hiltunen
repository: Remove RenameRepository RPC Closes #4277 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6506 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: Sami Hiltunen <shiltunen@gitlab.com> Reviewed-by: Sami Hiltunen <shiltunen@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Karthik Nayak <knayak@gitlab.com>
2023-11-15Update changelog for 16.6.0GitLab Release Tools Bot
[ci skip]
2023-11-15featureflag: Remove `TransactionalLinkRepository`Justin Tobler
The `TransactionalLinkRepository` feature flag, when enabled, makes the `LinkRepositoryToObjectPool` RPC transactional. Remove the feature flag so that the RPC is always transactional for clients.
2023-11-15proto: Remove unused request and response messagesJustin Tobler
The `CreateBranch` and `DeleteBranch` RPCs no longer exist but still have their request and response protobuf messages defined. Remove these definitions as they are no longer needed.
2023-11-15praefect: Update `CreateBranchRequest` and `CreateBranchResponse` usageJustin Tobler
The `CreateBranch` RPC has been removed and there is no longer a need for its associated request and response messages. Update call sites to now use `UserCreateBranch` messages.
2023-11-14praefect: Reconcile non-matching object pools during replicationJustin Tobler
When a Praefect replica becomes out-of-date with the primary repository, a replication job is scheduled to sync repository state. If the primary and secondary replica are linked to non-matching object pools, the replication job will always fail. In this scenario, to reconcile the different object pools the target repository should first disconnect from its object pool and then be linked to the matching source repository object pool. Update Praefect replication jobs to support synchronizing repositories with non-matching object pools.
2023-11-14Update changelog for 16.5.2GitLab Release Tools Bot
[ci skip]
2023-11-14pakcage: Upgrade sentryhandler to use go-grpc-middleware/v2Eric Ju
This commit upgrades sentryhandler to use "github.com/grpc-ecosystem/go-grpc-middleware/v2"
2023-11-14package: Replace v1 Tags struct with v2 logging.FieldsEric Ju
This commit is part of the process of upgrading to github.com/grpc-ecosystem/go-grpc-middleware v2. Since Tags struct is removed in v2, this commit uses logging.Fields to replace the old Tags struct. Each tag will become a feild, injected by `logging.InjectLogField`, extracted by `logging.ExtractFields`. This commit also let the LogrusLogger has the capbility to print entry with v2's logging.Fields.
2023-11-14Record reference transaction ordering in TransactionSami Hiltunen
Transaction is currently recording all reference updates in a single map, and verifying all reference updates in a single reference transaction. This is fine for most operations but some RPC handlers, mainly fetches, may stage updates that would lead to a directory-file conflict by for example staging: 1. delete 'refs/heads/parent' 2. create 'refs/heads/parent/child' To accommodate for such transactions, this commit changes the Transaction to record the individual reference transactions made. This retains the ordering knowledge between the reference updates performed and allows for saying which of the conflicting reference should exist at the end of the transaction. Most of the logic around references stays the same. The notable differences are in reference verification and logging: 1. References are now verified by applying the reference transactions against a snapshot of the target repository. This ensures the verification process takes into account the correct ordering of the reference transactions, and that the directory-file inducing 'refs/heads/parent' is deleted before the child reference is verified. 2. The log entries now record reference transactions, and they are applied in order to the repository when the log entry is being applied. With the above changes, it's now possible to perform updates in a transaction which would have before resulted a directory-file conflict.
2023-11-14Verify references against a snapshotSami Hiltunen
TransactionManager is currently verifying references against the main repository. The verification process prepares a reference transaction and considers the verification successful if no errors come up. Preparing a reference transaction in the repository may leave locks if there is a crash while the locks are held. As the verification happens prior to logging the write, there's no record of the fact that locks may have been left in the repository. As it is, such locks would be left in the repository, and never cleaned up. This commit runs verifies the references against a snapshot of the target repository. This has few benefits: 1. The locks target the snapshot. If there is a crash while the locks are held, they'll be removed along with the snapshot when Gitaly restarts. 2. As the verification process no longer modifies the repository, transactions can take their snapshots concurrently with the reference verification running. 3. This paves the way for verifying more complex transactions by using multiple reference transactions. This is useful for example when a transaction resolves a directory-file conflict. Such updates can't be done in a single reference transaction. In future we can also verify transactions and apply log to the repository concurrently as the verification process no longer writes the locks to the repository. This will especially improve throughput with Raft as log entries don't have to be committed one by one anymore.
2023-11-14Decouple snapshotting logic from TransactionSami Hiltunen
The snapshotting logic is currently tied to the Transaction. This was fine until now as we always created a single snapshot in context of a transaction. We're soon about to verify transactions against a snapshot of the target repository. In order to reuse the code to do so, this commit extracts out the snapshotting logic into a separate type. The logic remains the same but we no longer access fields directly from TransactionManager nor Transaction, and the snapshot type helps with rewriting the relative paths to point to the snapshot.
2023-11-14Allow snapshotting multiple repositoriesSami Hiltunen
Transactions currently snapshot the target repository and the alternate repository if it has one. This allows transactions to operate on repositories that already have an alternate but doesn't yet make it possible add new alternate links. To do so, we'd need to be able to start a transaction covering both the target repository, and the alternate repository it is about to be linked to. This commit makes it possible to start a transaction covering multiple repositories. The transaction has a single target repository where changes are recorded. In addition, multiple other repositories can be included in the snapshot. Changes into these repositories are not recorded or committed as we don't have a need to do so yet. With the pool and the new member in the snapshot, the RPC handler managing alternate links can create the link and verify it in its own snapshot, and stage the change for committing. This will be implemented later.
2023-11-13cgroups: Move remaining test functions to handlerWill Chandler
Now that all version-specific tests have been converted to unified tests in `handler_linux_test.go`, move the remaining helper functions into that file as well. Remove the version-specific test files as they are now empty.