Commit 830ea119 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'zj-remove-object-pools-feature-flag' into 'master'

Remove the object pools feature flag

See merge request gitlab-org/gitlab-ce!32204
parents 8839a08d a844a958
...@@ -2175,8 +2175,7 @@ class Project < ApplicationRecord ...@@ -2175,8 +2175,7 @@ class Project < ApplicationRecord
hashed_storage?(:repository) && hashed_storage?(:repository) &&
public? && public? &&
repository_exists? && repository_exists? &&
Gitlab::CurrentSettings.hashed_storage_enabled && Gitlab::CurrentSettings.hashed_storage_enabled
Feature.enabled?(:object_pools, self, default_enabled: true)
end end
def leave_pool_repository def leave_pool_repository
......
...@@ -82,19 +82,17 @@ by another folder with the next 2 characters. They are both stored in a special ...@@ -82,19 +82,17 @@ by another folder with the next 2 characters. They are both stored in a special
> [Introduced](https://gitlab.com/gitlab-org/gitaly/issues/1606) in GitLab 12.1. > [Introduced](https://gitlab.com/gitlab-org/gitaly/issues/1606) in GitLab 12.1.
Forks of public projects are deduplicated by creating a third repository, the object pool, containing the objects from the source project. Using `objects/info/alternates`, the source project and forks use the object pool for shared objects. Objects are moved from the source project to the object pool when housekeeping is run on the source project. Forks of public projects are deduplicated by creating a third repository, the
object pool, containing the objects from the source project. Using
`objects/info/alternates`, the source project and forks use the object pool for
shared objects. Objects are moved from the source project to the object pool
when housekeeping is run on the source project.
```ruby ```ruby
# object pool paths # object pool paths
"@pools/#{hash[0..1]}/#{hash[2..3]}/#{hash}.git" "@pools/#{hash[0..1]}/#{hash[2..3]}/#{hash}.git"
``` ```
Object pools can be disabled using the `object_pools` feature flag, and can be
disabled for individual projects by executing
`Feature.disable(:object_pools, Project.find(<id>))`. Disabling object pools
will not change existing deduplicated forks, but will prevent new forks from
being deduplicated.
DANGER: **Danger:** DANGER: **Danger:**
Do not run `git prune` or `git gc` in pool repositories! This can Do not run `git prune` or `git gc` in pool repositories! This can
cause data loss in "real" repositories that depend on the pool in cause data loss in "real" repositories that depend on the pool in
......
...@@ -8,30 +8,6 @@ storage disk use. To counteract this problem, we are adding Git object ...@@ -8,30 +8,6 @@ storage disk use. To counteract this problem, we are adding Git object
deduplication for forks to GitLab. In this document, we will describe how deduplication for forks to GitLab. In this document, we will describe how
GitLab implements Git object deduplication. GitLab implements Git object deduplication.
## Enabling Git object deduplication via feature flags
As of GitLab 12.0, Git object deduplication in GitLab is still behind a
feature flag. In this document, you can read about the effects of
enabling the feature. Also, note that Git object deduplication is
limited to forks of public projects on hashed repository storage.
You can enable deduplication globally by setting the `object_pools`
feature flag to `true`:
``` {.ruby}
Feature.enable(:object_pools)
```
Or just for forks of a specific project:
``` {.ruby}
fork_parent = Project.find(MY_PROJECT_ID)
Feature.enable(:object_pools, fork_parent)
```
To check if a project uses Git object deduplication, look in a Rails
console if `project.pool_repository` is present.
## Pool repositories ## Pool repositories
### Understanding Git alternates ### Understanding Git alternates
......
...@@ -4877,35 +4877,22 @@ describe Project do ...@@ -4877,35 +4877,22 @@ describe Project do
describe '#git_objects_poolable?' do describe '#git_objects_poolable?' do
subject { project } subject { project }
context 'when not using hashed storage' do
context 'when the feature flag is turned off' do let(:project) { create(:project, :legacy_storage, :public, :repository) }
before do
stub_feature_flags(object_pools: false)
end
let(:project) { create(:project, :repository, :public) }
it { is_expected.not_to be_git_objects_poolable } it { is_expected.not_to be_git_objects_poolable }
end end
context 'when the feature flag is enabled' do context 'when the project is not public' do
context 'when not using hashed storage' do let(:project) { create(:project, :private) }
let(:project) { create(:project, :legacy_storage, :public, :repository) }
it { is_expected.not_to be_git_objects_poolable }
end
context 'when the project is not public' do it { is_expected.not_to be_git_objects_poolable }
let(:project) { create(:project, :private) } end
it { is_expected.not_to be_git_objects_poolable }
end
context 'when objects are poolable' do context 'when objects are poolable' do
let(:project) { create(:project, :repository, :public) } let(:project) { create(:project, :repository, :public) }
it { is_expected.to be_git_objects_poolable } it { is_expected.to be_git_objects_poolable }
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment