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-02-24WIP: implement trace2 tracingqmnguyen0711/export-pack-objects-metricsQuang-Minh Nguyen
2023-02-24Implement Git trace2 events parserQuang-Minh Nguyen
Git v2.20 introduces new Trace2 API. This API provides kinda hook to extract the internal telemetry information of a Git process. It writes the data to stderr or a file. The events are structured as a flat list of consecutive events. When GIT_TRACE2_BRIEF variable is set, timing information is omitted. That makes this format particularly hard to use later. In the foreseeable future, we use trace2 in two places: generating equivalent distributed spans and expose pack object metrics. In the future, we are looking forward to utilizing Trace2 more. As a result, we should create an internal representation serving our purposes. Naturally, the data can be presented as a tree. This commit creates a parser that transform flat events to a tree data structure. For more information: https://git-scm.com/docs/api-trace2
2023-02-24Implement a linter to validate error wrapping without %wQuang-Minh Nguyen
Use %w when wrapping errors with context. Using %w has plenty of benefits and allows unwrapping underlying error later. After this feature was introduced, we favor error wrapping to string interpolation. This commit implements a linter catching such offenses. For more information https://gitlab.com/gitlab-org/gitaly/-/blob/master/STYLE.md#use-w-when-wrapping-errors
2023-02-24Implement string interpolation quote linterQuang-Minh Nguyen
This commit implement a linter checking for the usage of '%s' and "%s". Using manual quoting and bare string interpolation is not safe. We have a style guide for it here: https://gitlab.com/gitlab-org/gitaly/-/blob/master/STYLE.md#use-q-when-interpolating-strings
2023-02-24Add golangci-lint custom linter infrastructureQuang-Minh Nguyen
This commit adds the infrastructure to support custom linters. Unfortunately, golangci-lint doesn't support dynamic linter. It means that we need to compile each linter with `-buildmode=plugin` flag. The compiled artifacts are then configured in `.golangci.yml` file. New linter implementation follows the guide in this lint: https://golangci-lint.run/contributing/new-linters/ Implementing this linter requires the following steps: * Add analyzers implemting the checks to tools/gitaly-linters package * Add the new checks to `lint.go` file * Re-compile via `make gitaly-linters` or `make lint`
2023-02-24Merge branch 'qmnguyen0711/fix-git-cat-file-traces' into 'master'Justin Tobler
Fix quirky problems with tracing See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5406 Merged-by: Justin Tobler <jtobler@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Reviewed-by: Will Chandler <wchandler@gitlab.com> Co-authored-by: Quang-Minh Nguyen <qmnguyen@gitlab.com>
2023-02-24Update changelog for 15.9.1GitLab Release Tools Bot
[ci skip]
2023-02-22tracing: Detach git catfile cache's spanQuang-Minh Nguyen
Git Catfile cache is an optimization. It re-uses git-cat-file process if it's already open by other goroutines. As a result, the process's life span may be stretched outside the request starting the process. At present, that span is attributed to the first request. That makes the timing visualization of the whole trace looks weird. This commit detaches that span from the starting request.
2023-02-22tracing: Replace opentracing calls by new tracing.StartSpan* helpersQuang-Minh Nguyen
In the prior commit, some new utility methods were implemented to wrap around tracing libraries. This commit replaces the existing calls to opentracing library by new methods. Some some advanced usage still holds references to opentracing, though.
2023-02-22tracing: Implement some tracing ultility methods for GitalyQuang-Minh Nguyen
Tracing is now powered by opentracing and labkit. They work fine, but lack of some functionality, such as discarding all spans of path. In addition, in the future, we may need to switch the tracing library. It makes sense to implement a thin wrapper providing minimal interfaces. This commit implements some foundation methods for this purpose.
2023-02-22Merge branch 'renovate/go.uber.org-goleak-1.x' into 'master'James Fargher
go: Update module go.uber.org/goleak to v1.2.1 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5409 Merged-by: James Fargher <proglottis@gmail.com> Approved-by: Will Chandler <wchandler@gitlab.com> Approved-by: James Fargher <proglottis@gmail.com> Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
2023-02-21Merge branch 'renovate/github.com-golang-jwt-jwt-v4-4.x' into 'master'Will Chandler
go: Update module github.com/golang-jwt/jwt/v4 to v4.5.0 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5405 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
2023-02-21Merge branch 'renovate/github.com-protonmail-go-crypto-digest' into 'master'Will Chandler
go: Update github.com/ProtonMail/go-crypto digest to 7d5c6f0 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5404 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
2023-02-21Update changelog for 15.9.0GitLab Release Tools Bot
[ci skip]
2023-02-21Merge branch '4735-prune-write-ahead-log-entries-after-application' into ↵Will Chandler
'master' gitaly: Delete log entry after being applied Closes #4735 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5341 Merged-by: Will Chandler <wchandler@gitlab.com> Approved-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: Will Chandler <wchandler@gitlab.com> Reviewed-by: Will Chandler <wchandler@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-02-21Merge branch 'jt-lfs-pointer-test-fix' into 'master'Patrick Steinhardt
blob: Generate repository with LFS test data See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5402 Merged-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-02-20go: Update module go.uber.org/goleak to v1.2.1GitLab Renovate Bot
2023-02-20blob: Remove seeded repositories for LFS testsJustin Tobler
Now with the ability to generate test repositories with LFS pointers on the fly, update the LFS tests to stop using seed repositories.
2023-02-20blob: Generate repository with LFS test dataJustin Tobler
Currently tests in `lfs_pointers_test.go` rely on seeded repositories for test data. This caused an issue when a seeded repository was updated resulting in `TestListAllLFSPointers` consistently failing. This change adds `setupWithLFS()` which configures a git repository with LFS pointers for test data.
2023-02-20Merge branch 'update-support-template' into 'master'John Cai
Add John Cai to support template See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5407 Merged-by: John Cai <jcai@gitlab.com> Approved-by: John Cai <jcai@gitlab.com> Co-authored-by: Mark Wood <mwood@gitlab.com>
2023-02-20Merge branch ↵karthik nayak
'4698-featureflag-enable-use-of-quarantined-repository-in-fetchsourcebranch' into 'master' featureflag: Remove `FetchSourceBranchQuarantined` Closes #4698 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5262 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
2023-02-20Add John Cai to support templateMark Wood
2023-02-20featureflag: Remove `FetchSourceBranchQuarantined`Karthik Nayak
The flag `FetchSourceBranchQuarantined` is rolled out, now we can delete the flag and modify the code/tests to remove the previous logic.
2023-02-19go: Update module github.com/golang-jwt/jwt/v4 to v4.5.0GitLab Renovate Bot
2023-02-17go: Update github.com/ProtonMail/go-crypto digest to 7d5c6f0GitLab Renovate Bot
2023-02-17Merge branch 'renovate/github.com-protonmail-go-crypto-digest' into 'master'qmnguyen0711/add-gitaly-agentPavlo Strokov
go: Update github.com/ProtonMail/go-crypto digest to 81033d7 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5394 Merged-by: Pavlo Strokov <pstrokov@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Approved-by: Pavlo Strokov <pstrokov@gitlab.com> Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
2023-02-17Merge branch 'change_debug_method_lookup' into 'master'Toon Claes
middleware: Change method lookup warning log to debug See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5395 Merged-by: Toon Claes <toon@gitlab.com> Approved-by: Toon Claes <toon@gitlab.com> Approved-by: Sami Hiltunen <shiltunen@gitlab.com> Co-authored-by: James Fargher <jfargher@gitlab.com>
2023-02-17Merge branch 'jt-sync-custom-hooks' into 'master'Patrick Steinhardt
hooks: Implement custom hooks replication See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5248 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-02-17repository: Replicate custom hooksJustin Tobler
Currently the `ReplicateRepository` RPC does not include the replication of custom hooks for a repository. This change updates the RPC to include replication of repository hooks stored in the `custom_hooks` directory when the `gitaly_replicate_repository_hooks` feature flag is enabled. The hooks replication is handled by `setCustomHooksTransaction()` from the `SetCustomHooks` RPC which enables atomicity and transactionality.
2023-02-17repository: Generalize setting custom hooksJustin Tobler
Currently the `SetCustomHooks` RPC is set up in such a way that requires a tar archive to be provided as input. In a future commit the `ReplicateRepository` RPC will be updated to replicate hooks and leverage the logic from `SetCustomHooks` to set hooks for the repository. Since some repositories may not contain any custom hooks, the logic needs to be updated to support this additional use case. This change updates `extractHooks()` to be able to support receiving an empty `io.Reader` as input without producing an error. Since the version of tar used at runtime is system dependent, the code is generalized to support both GNU and BSD tar.
2023-02-17repository: Refactor custom hooks archivingJustin Tobler
Currently tests for the `SetCustomHooks` RPC rely on pregenerated tar archives present in the `testdata/` directory. These archives can instead be generated on the fly by reusing the tar archiving logic from the `GetCustomHooks` RPC. This change factors out this logic into `archive.Write()` which gets used by `GetCustomHooks` and several tests to generate tar archives.
2023-02-17gitaly: Prune log entry after being appliedKarthik Nayak
In `TransactionManager`, we don't Prune a log entry after it is applied. This means the key lies in the database forever while providing no additional value. Let's start pruning entries in the log after being applied, we do this in `TransactionManager.applyLogEntry` wherein after the transaction is applied we go ahead and delete the entry. Since the entries are deleted, some of the tests need modification to check the state of the database before deletion, modify all such tests.
2023-02-17gitaly: Add more information to `hookContext`Karthik Nayak
The `hookContext` structure is provided to the handler of every synchronization points. When we introduce the deletion of entries in the write-ahead log, we want to check the state of the database and pass/fail the test. To do this, we need the {database, test} structs. Let's add them to the `hookContext`. We override the default `testing.TB` object with our custom `testingHook` struct, which overrides calls to `FailNow()` with calls to `Fail()`, since the former can only be run in the main goroutine. This allows us to now not worry about using `FailNow()` (this is the function called by the `require` library).
2023-02-17gitaly: Apply hooks on each stepKarthik Nayak
The `TestTransactionManager` only adds hooks when it first creates the manager. This means if the manager was created in step X, the hooks from step X+1 won't be added unless the manages is stopped/started. To avoid this issue, we create a new `applyHooks` function and call this at the beginning of each step.
2023-02-17go: Update github.com/ProtonMail/go-crypto digest to 81033d7GitLab Renovate Bot
2023-02-17Merge branch 'renovate/github.com-jackc-pgx-v4-4.x' into 'master'Sami Hiltunen
go: Update module github.com/jackc/pgx/v4 to v4.18.0 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5390 Merged-by: Sami Hiltunen <shiltunen@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Sami Hiltunen <shiltunen@gitlab.com> Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
2023-02-17Merge branch 'pks-remote-support-sha256-object-format' into 'master'Pavlo Strokov
remote: Support for SHA256 object format See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5368 Merged-by: Pavlo Strokov <pstrokov@gitlab.com> Approved-by: Pavlo Strokov <pstrokov@gitlab.com> Reviewed-by: Patrick Steinhardt <psteinhardt@gitlab.com> Reviewed-by: Pavlo Strokov <pstrokov@gitlab.com> Co-authored-by: Patrick Steinhardt <psteinhardt@gitlab.com>
2023-02-17Merge branch 'wc/tracker-error-race' into 'master'Quang-Minh Nguyen
tracker: Fix racey error insertion in test Closes #4796 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5391 Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Reviewed-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Co-authored-by: Will Chandler <wchandler@gitlab.com>
2023-02-17Merge branch 'smh-disable-verifier-in-tests' into 'master'Quang-Minh Nguyen
Disable background verifier in tests Closes #4773 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5399 Merged-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Approved-by: Quang-Minh Nguyen <qmnguyen@gitlab.com> Co-authored-by: Sami Hiltunen <shiltunen@gitlab.com>
2023-02-17Merge branch 'pks-git-stats-fix-racy-clone-test' into 'master'Justin Tobler
git/stats: Fix race when verifying clone timings See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5401 Merged-by: Justin Tobler <jtobler@gitlab.com> Approved-by: Justin Tobler <jtobler@gitlab.com> Co-authored-by: Patrick Steinhardt <psteinhardt@gitlab.com>
2023-02-16tracker: Fix racey error insertion in testWill Chandler
`TestErrorTracker_ClearErrors` would occasionally flake when the insertion time of the second write error exactly matched `now`, causing all write errors to be cleared. Use the new `incr{Read,Write}ErrTime()` methods to ensure that the errors times fall before or after our cutoff time.
2023-02-16tracker: Add method for injecting error timeWill Chandler
The `Incr{Read,Write}ErrTime()` methods on `errorTracker` will use `time.Now()` as the time of error. For production use this is a good default and we should keep it, but when testing the `clear()` method having a way to deterministicly set the time of error is useful. We have experienced flakes when errors are inserted at _exactly_ the same time as the cutoff. Add internal methods `incr{Read,Write}ErrTime` that allow the caller to specify the time of error. The public methods wrap around this with `time.Now()` for convience.
2023-02-16Revert "repository: Quarantine replicate repository test"Sami Hiltunen
This reverts commit ae63665f49c5acaf65bf847932843b583b485c4f.
2023-02-16Disable background verifier in testsSami Hiltunen
Praefect's background verifier was recently changed to delete invalid metadata by default. This can cause test flakes as some test cases purposefully create such states. Given it would be surprising to have the background verifier issue RPCs and delete state during a test, disable it in the tests.
2023-02-16git/stats: Fix race when verifying clone timingsPatrick Steinhardt
One of the things that the git/stats package does is to record timings for various different steps in a fetch. As we cannot tell how long it takes for each of these steps to complete the best we can do in the test is to verify that timings are in the expected order. The check we have for this is flaky though as it may happen that two packets are observed in the same instant, but we test for times being in strictly-increasing order: === FAIL: internal/git/stats TestClone (0.50s) http_clone_test.go:73: Error Trace: /builds/gitlab-org/gitaly/internal/git/stats/http_clone_test.go:73 Error: Should be true Test: TestClone Messages: post: expect time to receive first progress message (134.178921ms) to be greater than previous value 134.178921ms Fix this flake by also allowing for the same time stamp.
2023-02-16Merge branch 'pks-housekeeping-enable-writing-midx' into 'master'karthik nayak
housekeeping: Enable writing MIDX by default See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5397 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Co-authored-by: Patrick Steinhardt <psteinhardt@gitlab.com>
2023-02-16Merge branch 'jc/fix-merge-tree-merge' into 'master'karthik nayak
localrepo: Allow unrelated histories in merge tree See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5385 Merged-by: karthik nayak <knayak@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Reviewed-by: karthik nayak <knayak@gitlab.com> Co-authored-by: John Cai <jcai@gitlab.com>
2023-02-16housekeeping: Enable writing MIDX by defaultPatrick Steinhardt
We have recently introduced the logic to write multi-pack indices during repository maintenance. This new data structure allows Git to look up objects more efficiently when there are many packfiles in a repository by providing an index that spans across all the packfiles. The code has been rolled out to production systems without any observed issues. As this is a significant new data structure though we're playing it safe and release the feature with its flag default enabled. Changelog: changed
2023-02-16remote: Test with SHA256 object formatPatrick Steinhardt
All RPCs of the remote service now support the SHA256 object format. Adapt our tests to test with it.
2023-02-16remote: Have FindRemoteRepository detect repos using SHA256Patrick Steinhardt
The FindRemoteRepository RPC can be used to detect whether a repository exists at the given URI. This is done by asking git-ls-remote(1) to enumerate the remote's HEAD and then checking that we recognize it as a valid reference. This check breaks with the introduction of the SHA256 object format as we explicitly verify that HEAD points to an object ID that is 40 hex characters long. So when seeing a 64 hex characters long SHA256 hash then we will wrongfully return that the repository does not exist. Now this whole check feels kind of weird, and specifically verifying specific object hash lengths isn't a great way to figure out whether a repository exists or not. But for the time being we don't really have a better way to figure this out, so our hands are kinda tied. Refactor the RPC to recognize both SHA1 and SHA256 object hashes. While this doesn't make the underlying issue any better, it at least continues to work the sahe with repositories that use the SHA256 object format. Changelog: added