Remove the object pools feature flag

The flag defaulted to true, so there's no change unless users turned it
off. Given there's a lack of issues regarding object pools, this should
be OK.
This commit is contained in:
Zeger-Jan van de Weg 2019-08-26 12:31:25 +02:00
parent f5fa604c3e
commit a844a958ea
No known key found for this signature in database
GPG Key ID: 65F6A8D64A88ABAC
4 changed files with 15 additions and 55 deletions

View File

@ -2175,8 +2175,7 @@ class Project < ApplicationRecord
hashed_storage?(:repository) &&
public? &&
repository_exists? &&
Gitlab::CurrentSettings.hashed_storage_enabled &&
Feature.enabled?(:object_pools, self, default_enabled: true)
Gitlab::CurrentSettings.hashed_storage_enabled
end
def leave_pool_repository

View File

@ -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.
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
# object pool paths
"@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:**
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

View File

@ -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
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
### Understanding Git alternates

View File

@ -4877,35 +4877,22 @@ describe Project do
describe '#git_objects_poolable?' do
subject { project }
context 'when the feature flag is turned off' do
before do
stub_feature_flags(object_pools: false)
end
let(:project) { create(:project, :repository, :public) }
context 'when not using hashed storage' do
let(:project) { create(:project, :legacy_storage, :public, :repository) }
it { is_expected.not_to be_git_objects_poolable }
end
context 'when the feature flag is enabled' do
context 'when not using hashed storage' do
let(:project) { create(:project, :legacy_storage, :public, :repository) }
context 'when the project is not public' do
let(:project) { create(:project, :private) }
it { is_expected.not_to be_git_objects_poolable }
end
it { is_expected.not_to be_git_objects_poolable }
end
context 'when the project is not public' do
let(:project) { create(:project, :private) }
context 'when objects are poolable' do
let(:project) { create(:project, :repository, :public) }
it { is_expected.not_to be_git_objects_poolable }
end
context 'when objects are poolable' do
let(:project) { create(:project, :repository, :public) }
it { is_expected.to be_git_objects_poolable }
end
it { is_expected.to be_git_objects_poolable }
end
end