Skip to content

Apply Forks Cost Factor to Git Push and LFS Push Sizes

Jason Goodman requested to merge apply-forks-cost-factor-to-git-push-size into master

What does this MR do and why?

When a git push or an LFS push is made to a project repository, we check the size of the push against storage limits to see if the push would cause the repository to exceed the size limits. We reject the push if it would cause the limits to be exceeded. We do this for both the existing excess repository storage size limits and the upcoming namespace storage size limits.

For namespace storage size limits, we will apply a cost factor to forks of projects. For example, a fork of a project that takes up 10 GB of storage will have a cost factor applied so that it will count as consuming less storage, perhaps only 1 GB or even less.

We need to apply the same cost factor to any git push or LFS push that is made to the repository of a fork in a namespace with namespace storage limits. Otherwise, when we check if the push would cause the repository to exceed the size limit, we may reject a push that we should accept.

For example, a namespace might have a total namespace storage size limit of 10 GB and currently consume 9.9 GB of storage. Suppose a git push is made to push a 200 MB file to a fork of a project. Ordinarily, we would reject this push. However, the push is made to a fork, so it would consume less storage - for illustrative purposes, suppose it will consume only 2 MB. So this push should be accepted. This MR applies the cost factor to pushes to handle this scenario.

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/393586

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jason Goodman

Merge request reports