Skip to content
Snippets Groups Projects
This project is mirrored from https://gitlab.com/gitlab-org/gitaly.git. Pull mirroring updated . This branch has diverged from upstream.
  1. Apr 12, 2022
  2. Apr 11, 2022
    • John Cai's avatar
      README: Add link to backpressure video · 521593b4
      John Cai authored
      Add a link in the presentations section of the README to a video
      explaining the different ways to configure request limits (or
      backpressure) in Gitaly.
      521593b4
  3. Apr 08, 2022
  4. Apr 07, 2022
  5. Apr 06, 2022
  6. Apr 05, 2022
    • John Cai's avatar
      commit: Add CheckObjectsExist RPC · 50b1bcba
      John Cai authored
      When pushing commits to a repository, access checks are run. In order to
      use the quarantine directory, we need a way to filter out revisions that
      a repository already has in the case that a packfile sends over objects
      that already exists on the server. In this case, we don't need to check
      the access.
      
      Add an RPC that when given a list of revisions, returns the ones that
      already exist in the repository, and the ones that do not exist in the
      repository.
      
      Changelog: added
      50b1bcba
    • James Fargher's avatar
      Merge branch 'add-git-blame-range' into 'master' · 25b61b56
      James Fargher authored
      Allow Commit.RawBlame to take a Range parameter
      
      See merge request gitlab-org/gitaly!4433
      25b61b56
    • John Cai's avatar
      limithandler: Change metric name for concurrency limiting · add9d6e1
      John Cai authored
      Before, concurrency limiting was the only limiting middleware. The name
      of the metric had gitaly_rate_limiting in it, which was a bit of a
      misnomer since rate was never part of the equation. Now that we are
      actually adding a rate limiter to Gitaly, the concurrency metrics will
      be mistaken for rate limiting metrics.
      
      Change the name of these by replacing rate_limiting with
      concurrency_limiting.
      
      Changelog: changed
      add9d6e1
    • John Cai's avatar
      limithandler: Pave the way for a second limiter type · 31259d9d
      John Cai authored
      A future commit will add a new middleware that will limit based on the
      rate rather than concurrent calls. There is a good amount of logic
      currently used by the concurrency limiter that can be reused since a
      rate limiter is also operating on incoming requests based on RPC name.
      
      To make easier to add this new limiter type in the future, refactor the
      code by adding some abstractions easier to add another type of limiter.
      31259d9d
    • John Cai's avatar
      config: Add RateLimiting configuration · aad545f6
      John Cai authored
      To prepare for a rate limiting middleware, add a struct to support
      configuring a rate limiter. Behind the scenes, we are using
      golang.org/x/time/rate package, which implements rate limiting with a
      concept of a token bucket. There are two relevant values. Burst refers
      to the maximum size of the token bucket. For a request to be handled, a
      token is retrieved from the token bucket. Once the bucket is empty, no
      more requests can be handled.
      
      The token bucket will be refilled to capacity as defined by "Burst"
      according to what is set by "Interval".
      
      Changelog: added
      aad545f6
    • Igor Wiedler's avatar
      Expose command stats (rusage) metrics via prometheus · a088c9b3
      Igor Wiedler authored
      We currently track rusage metrics in logs on a per-RPC basis. This
      allows us to get a very fine-grained view into resource attribution.
      
      However, logs often do not lend themselves to corse-grained and long-
      term analysis. For this reason it is useful to expose metrics via
      prometheus.
      
      By aggregating that data as metrics, we aim to partially close an
      observability gap that exists for short-lived processes. The existing
      `process-exporter` metrics are severely under-reporting the utilization
      of short-lived processes, which gitaly spawns many of.
      
      See also:
      
      - https://gitlab.com/gitlab-com/gl-infra/scalability#1655
      
      This patch introduces a set of `gitaly_command_*` metrics which
      provide aggregated resource attribution along the following
      dimensions:
      
      - `cmd` - the basename of the command being executed.
      - `subcmd` - an optional subcommand, e.g. `archive` for `git archive`
      - `grpc_service` - the grpc service caller
      - `grpc_method` - the grpc method caller
      
      The newly introduced metrics are:
      
      - `gitaly_command_cpu_seconds_total` Sum of CPU time spent
      - `gitaly_command_real_seconds_total` Sum of real time spent
      - `gitaly_command_minor_page_faults_total` Sum of minor page faults
      - `gitaly_command_major_page_faults_total` Sum of major page faults
      - `gitaly_command_signals_received_total` Sum of signals received
      - `gitaly_command_context_switches_total` Sum of context switches
      
      This feature is being introduced behind a feature flag. However,
      since metrics are sticky, once the metric has been defined, it
      will be returned by the process until the next restart.
      
      The cardinality of the metrics should be relatively well-bounded
      in any case.
      a088c9b3
    • Nick Thomas's avatar
      Allow Commit.RawBlame to take a Range parameter · 2778fb7a
      Nick Thomas authored
      Git supports a wide array of range options for this option, but for now
      we restrict the formats we support to the very simplest, which is of
      the form "1,100".
      
      We can use this to implement limits on how many lines of the blame we
      retrieve GitLab-side, which should help to reduce the resource usage
      of this particular RPC.
      
      Changelog: added
      2778fb7a
    • Nick Thomas's avatar
      bfe8d574
  7. Apr 04, 2022
    • John Cai's avatar
      Merge branch 'jc-accurate-calculation-of-repo-size' into 'master' · a8ca1e26
      John Cai authored
      Use rev-list --all --objects --disk-usage to calculate repository usage
      
      See merge request gitlab-org/gitaly!4430
      a8ca1e26
    • John Cai's avatar
      repository: Use Size() to calculate repo size behind feature flag · 0d28358d
      John Cai authored
      In the previous commit, we added a Size() method in localrepo that calls
      git rev-list --all --objects --disk-usage to calculate the size of the
      repository.
      
      Add a feature flag that, when toggled on, will cause RepositorySize to
      use this new way of calculating repository size.
      
      Changelog: added
      0d28358d
    • John Cai's avatar
      localrepo: Add Size() for repo · a35d007c
      John Cai authored
      Add a Size() method for repo that calculates disk usage of objects. The
      way we currently calculate repository size is to use du(1), which is a
      quick and dirty way to get the total storage of a repository. However,
      this ends up varying depending on the __how__ the objects are stored by
      Git, which is affected by repository maintenance strategies and can vary.
      
      A more consistent way to calculate storage is to get a total of number
      of reachable objects with git rev-list --all --objects --disk-usage
      a35d007c
    • Toon Claes's avatar
      Merge branch 'toon-fix-prerecv-noise' into 'master' · c83fc8eb
      Toon Claes authored
      ssh: Clean up output when pre-receive hook fails
      
      See merge request gitlab-org/gitaly!4318
      c83fc8eb
    • Toon Claes's avatar
      ssh: Clean up output when pre-receive hook fails · 853be966
      Toon Claes authored
      When the pre-receive hook failed, git-receive-pack(1) exits with code 0.
      It's arguable whether this is the expected behavior, but anyhow it means
      cmd.Wait() did not error out. On the other hand, the gitaly-hooks
      command did stop the transaction upon failure. So this final vote fails.
      
      To avoid this error being presented to the end user, ignore it when the
      transaction was stopped.
      
      Issue: https://gitlab.com/gitlab-org/gitaly/-/issues/3636
      Changelog: fixed
      853be966
    • Toon Claes's avatar
      ssh: Add test with custom pre-receive hook · 024b77a8
      Toon Claes authored
      Add test to check if the error message from a failing custom pre-receive
      hook is presented to the user.
      024b77a8
    • Toon Claes's avatar
      ssh: Split out the push command in test · cc452e83
      Toon Claes authored
      In a future commit we'd like to process the stdout and stderr output
      from the ssh push command separately. With this commit the setting up of
      the command is extracted into a function so in the future it's possible
      to specify where to write stdout/stderr to.
      cc452e83
    • Sami Hiltunen's avatar
      Don't disable Praefect in RemoveRepository tests · f6d98935
      Sami Hiltunen authored
      Praefect is currently disabled in RemoveRepository tests which allows
      for Praefect's RemoveRepository behavior to deviate from the Gitaly's.
      This commit enables Praefect for these tests so we can be sure we catch
      behavior deviations between the two handlers.
      f6d98935
    • Sami Hiltunen's avatar
      Share common code between DeleteObjectPool and RemoveRepository · 27fe4f2f
      Sami Hiltunen authored
      Praefect contains two special handlers for handling repository
      removals. Both of these handlers do largely the same thing. This
      commit shares the common code between the two handlers.
      27fe4f2f
    • Sami Hiltunen's avatar
      Handle DeleteObjectPool calls in Praefect · b79eeebc
      Sami Hiltunen authored
      Praefect currently proxies DeleteObjectPool calls to Gitalys like
      any other mutating RPC. This has the same problem as RemoveRepository
      previously had; a pool can be deleted from the disk and it's metadata
      record still left in the database. This can then cause problems as
      Praefect believes a pool replica still exists where one doesn't exist.
      
      Praefect doesn't even treat DeleteObjectPool as a repository removing
      RPC. This means the deletions have never been replicated to the
      secondaries and the pool metadata records have been left in place. This
      then causes the reconciler to repeatedly attempt to reconcile from a
      non-existing primary pool replica to the secondaries.
      
      This commit fixes both issues by handling pool deletions in Praefect.
      Similarly to RemoveRepository, the metadata record of the pool is first
      deleted and only then the pool is attempted to remove from the Gitalys
      that have it. This ensures atomicity of the removals when Praefect is
      rewriting the replica paths.
      
      With the behavior fixed, the Praefect specific test asserations can be
      removed as the behavior now matches what how a plain Gitaly would
      behave.
      
      The handler in Praefect is tested via the same tests that test the
      handler in Gitaly. Adding separate tests doesn't make sense as external
      behavior of the the handlers should match and the handler shouldn't
      exists in Praefect if it is removed from Gitaly.
      
      Changelog: fixed
      b79eeebc
    • Sami Hiltunen's avatar
      Add test case for missing pool in DeleteObjectPool · 1ad960e9
      Sami Hiltunen authored
      DeleteObjectPool's tests do not currently test what happens if the
      request is missing the pool repository. This commit adds the missing
      test case. While at it, it exports the functionality to extract a pool
      from the request so Praefect's DeleteObjectPool handler can reuse it
      later and pass the same test.
      1ad960e9
    • Sami Hiltunen's avatar
      Verify object pool existence after deletion in tests · 5e161b1e
      Sami Hiltunen authored
      TestDelete does not verify whether the object pool exists or not
      after the call to DeleteObjectPool. This is somewhat of an imporant
      assertion to make to ensure the deletion logic is working correctly.
      This commit adds that missing assertion.
      5e161b1e