Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '.gitlab/issue_templates/Geo Replicate a new Git repository type.md')
-rw-r--r--.gitlab/issue_templates/Geo Replicate a new Git repository type.md62
1 files changed, 38 insertions, 24 deletions
diff --git a/.gitlab/issue_templates/Geo Replicate a new Git repository type.md b/.gitlab/issue_templates/Geo Replicate a new Git repository type.md
index 7ef5287aba8..6c9b8bb6d78 100644
--- a/.gitlab/issue_templates/Geo Replicate a new Git repository type.md
+++ b/.gitlab/issue_templates/Geo Replicate a new Git repository type.md
@@ -51,20 +51,16 @@ Geo secondary sites have a [Geo tracking database](https://gitlab.com/gitlab-org
bin/rails generate migration CreateCoolWidgetRegistry --database geo
```
-Geo should continue using `Gitlab::Database::Migration[1.0]` until the `gitlab_geo` schema is supported, and is for the time being exempt from being validated by `Gitlab::Database::Migration[2.0]`. This requires a developer to manually amend the migration file to change from `[2.0]` to `[1.0]` due to the migration defaults being 2.0.
-
-For more information, see the [Enable Geo migrations to use Migration[2.0]](https://gitlab.com/gitlab-org/gitlab/-/issues/363491) issue.
-
- [ ] Replace the contents of the migration file with the following. Note that we cannot add a foreign key constraint on `cool_widget_id` because the `cool_widgets` table is in a different database. The application code must handle logic such as propagating deletions.
```ruby
# frozen_string_literal: true
- class CreateCoolWidgetRegistry < Gitlab::Database::Migration[1.0]
+ class CreateCoolWidgetRegistry < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
def up
- ApplicationRecord.transaction do
+ Geo::TrackingBase.transaction do
create_table :cool_widget_registry, id: :bigserial, force: :cascade do |t|
t.bigint :cool_widget_id, null: false
t.datetime_with_timezone :created_at, null: false
@@ -105,6 +101,13 @@ For more information, see the [Enable Geo migrations to use Migration[2.0]](http
```
- [ ] If deviating from the above example, then be sure to order columns according to [our guidelines](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/ordering_table_columns.md).
+
+- [ ] Add the new table to the GitLab Schema defined in [`ee/lib/ee/gitlab/database/gitlab_schemas.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/ee/gitlab/database/gitlab_schemas.yml).
+
+ ```yaml
+ cool_widget_registry: :gitlab_geo
+ ```
+
- [ ] Run Geo tracking database migrations:
```shell
@@ -141,7 +144,7 @@ The Geo primary site needs to checksum every replicable so secondaries can verif
t.datetime_with_timezone :verification_started_at
t.datetime_with_timezone :verification_retry_at
t.datetime_with_timezone :verified_at
- t.references :cool_widget, primary_key: true, null: false, foreign_key: { on_delete: :cascade }
+ t.references :cool_widget, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade }
t.integer :verification_state, default: 0, limit: 2, null: false
t.integer :verification_retry_count, limit: 2
t.binary :verification_checksum, using: 'verification_checksum::bytea'
@@ -162,6 +165,12 @@ The Geo primary site needs to checksum every replicable so secondaries can verif
- [ ] If deviating from the above example, then be sure to order columns according to [our guidelines](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/ordering_table_columns.md).
+- [ ] Add the new table to the GitLab Schema defined in [`lib/gitlab/database/gitlab_schemas.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/database/gitlab_schemas.yml) with the databases they need to be added to.
+
+ ```yaml
+ cool_widget_states: :gitlab_main
+ ```
+
- [ ] Run database migrations:
```shell
@@ -260,7 +269,6 @@ That's all of the required database changes.
def pool_repository
nil
end
- ...
def cool_widget_state
super || build_cool_widget_state
@@ -380,14 +388,16 @@ That's all of the required database changes.
```ruby
# frozen_string_literal: true
- class Geo::CoolWidgetRegistry < Geo::BaseRegistry
- include ::Geo::ReplicableRegistry
- include ::Geo::VerifiableRegistry
+ module Geo
+ class CoolWidgetRegistry < Geo::BaseRegistry
+ include ::Geo::ReplicableRegistry
+ include ::Geo::VerifiableRegistry
- MODEL_CLASS = ::CoolWidget
- MODEL_FOREIGN_KEY = :cool_widget_id
+ MODEL_CLASS = ::CoolWidget
+ MODEL_FOREIGN_KEY = :cool_widget_id
- belongs_to :cool_widget, class_name: 'CoolWidget'
+ belongs_to :cool_widget, class_name: 'CoolWidget'
+ end
end
```
@@ -454,13 +464,13 @@ That's all of the required database changes.
- [ ] Add the following to `spec/factories/cool_widgets.rb`:
```ruby
- trait(:verification_succeeded) do
+ trait :verification_succeeded do
with_file
verification_checksum { 'abc' }
verification_state { CoolWidget.verification_state_value(:verification_succeeded) }
end
- trait(:verification_failed) do
+ trait :verification_failed do
with_file
verification_failure { 'Could not calculate the checksum' }
verification_state { CoolWidget.verification_state_value(:verification_failed) }
@@ -498,11 +508,11 @@ That's all of the required database changes.
factory :geo_cool_widget_state, class: 'Geo::CoolWidgetState' do
cool_widget
- trait(:checksummed) do
+ trait :checksummed do
verification_checksum { 'abc' }
end
- trait(:checksum_failure) do
+ trait :checksum_failure do
verification_failure { 'Could not calculate the checksum' }
end
end
@@ -552,8 +562,9 @@ The GraphQL API is used by `Admin > Geo > Replication Details` views, and is dir
field :cool_widget_registries, ::Types::Geo::CoolWidgetRegistryType.connection_type,
null: true,
resolver: ::Resolvers::Geo::CoolWidgetRegistriesResolver,
- description: 'Find Cool Widget registries on this Geo node',
- feature_flag: :geo_cool_widget_replication
+ description: 'Find Cool Widget registries on this Geo node. '\
+ 'Ignored if `geo_cool_widget_replication` feature flag is disabled.',
+ alpha: { milestone: '15.5' } # Update the milestone
```
- [ ] Add the new `cool_widget_registries` field name to the `expected_fields` array in `ee/spec/graphql/types/geo/geo_node_type_spec.rb`.
@@ -618,13 +629,15 @@ The GraphQL API is used by `Admin > Geo > Replication Details` views, and is dir
module Geo
# rubocop:disable Graphql/AuthorizeTypes because it is included
class CoolWidgetRegistryType < BaseObject
+ graphql_name 'CoolWidgetRegistry'
+
include ::Types::Geo::RegistryType
- graphql_name 'CoolWidgetRegistry'
description 'Represents the Geo replication and verification state of a cool_widget'
field :cool_widget_id, GraphQL::Types::ID, null: false, description: 'ID of the Cool Widget.'
end
+ # rubocop:enable Graphql/AuthorizeTypes
end
end
```
@@ -708,14 +721,15 @@ As illustrated by the above two examples, batch destroy logic cannot be handled
- [ ] Add a step to `Test replication and verification of Cool Widgets on a non-GDK-deployment. For example, using GitLab Environment Toolkit`.
- [ ] Add a step to `Ping the Geo PM and EM to coordinate testing`. For example, you might add steps to generate Cool Widgets, and then a Geo engineer may take it from there.
- [ ] In `ee/config/feature_flags/development/geo_cool_widget_replication.yml`, set `default_enabled: true`
-- [ ] In `ee/app/graphql/types/geo/geo_node_type.rb`, remove the `feature_flag` option for the released type:
+- [ ] In `ee/app/graphql/types/geo/geo_node_type.rb`, remove the `alpha` option for the released type:
```ruby
field :cool_widget_registries, ::Types::Geo::CoolWidgetRegistryType.connection_type,
null: true,
resolver: ::Resolvers::Geo::CoolWidgetRegistriesResolver,
- description: 'Find Cool Widget registries on this Geo node',
- feature_flag: :geo_cool_widget_replication # REMOVE THIS LINE
+ description: 'Find Cool Widget registries on this Geo node. '\
+ 'Ignored if `geo_cool_widget_replication` feature flag is disabled.',
+ alpha: { milestone: '15.5' } # Update the milestone
```
- [ ] Run `bundle exec rake gitlab:graphql:compile_docs` after the step above to regenerate the GraphQL docs.