Skip to content

Geo: Verify GitLab Pages Deployments [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Nick Nguyen requested to merge 339836-geo-verify-gitlab-pages-deployments into master

What does this MR do and why?

This MR adds verification for Geo replicated Pages deployments.

Closes #339836 (closed)

Screenshots or screen recordings

Checksum progress Pages_checksum_progress
Verification status Pages_sync_status

Database Review Information

`rake db:migrate`
== 20211119154221 CreatePagesDeploymentStates: migrating ======================
-- table_exists?(:pages_deployment_states)
   -> 0.0012s
-- transaction_open?()
   -> 0.0000s
-- create_table(:pages_deployment_states, {:id=>false})
   -> 0.0248s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE pages_deployment_states\nADD CONSTRAINT check_15217e8c3a\nCHECK ( char_length(verification_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0009s
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0006s
-- execute("ALTER TABLE pages_deployment_states VALIDATE CONSTRAINT check_15217e8c3a;")
   -> 0.0013s
-- execute("RESET statement_timeout")
   -> 0.0009s
== 20211119154221 CreatePagesDeploymentStates: migrated (0.0604s) =============
`rake db:rollback`
== 20211119154221 CreatePagesDeploymentStates: reverting ======================
-- drop_table(:pages_deployment_states)
   -> 0.0068s
== 20211119154221 CreatePagesDeploymentStates: reverted (0.0069s) =============
`rake geo:db:migrate`
== 20211119152539 AddVerificationToPagesDeploymentRegistry: migrating =========
-- add_column(:pages_deployment_registry, :verification_started_at, :datetime_with_timezone)
   -> 0.0009s
-- add_column(:pages_deployment_registry, :verified_at, :datetime_with_timezone)
   -> 0.0009s
-- add_column(:pages_deployment_registry, :verification_retry_at, :datetime_with_timezone)
   -> 0.0009s
-- add_column(:pages_deployment_registry, :verification_retry_count, :integer, {:default=>0, :limit=>2, :null=>false})
   -> 0.0012s
-- add_column(:pages_deployment_registry, :verification_state, :integer, {:limit=>2, :default=>0, :null=>false})
   -> 0.0011s
-- add_column(:pages_deployment_registry, :checksum_mismatch, :boolean, {:default=>false, :null=>false})
   -> 0.0012s
-- add_column(:pages_deployment_registry, :verification_checksum, :binary)
   -> 0.0009s
-- add_column(:pages_deployment_registry, :verification_checksum_mismatched, :binary)
   -> 0.0008s
-- add_column(:pages_deployment_registry, :verification_failure, :text)
   -> 0.0008s
== 20211119152539 AddVerificationToPagesDeploymentRegistry: migrated (0.0091s)

== 20211207162157 AddIndexesToPagesDeploymentRegistry: migrating ==============
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:pages_deployment_registry, :pages_deployment_id, {:name=>"index_pages_deployment_registry_on_pages_deployment_id", :unique=>true, :algorithm=>:concurrently})
   -> 0.0015s
-- add_index(:pages_deployment_registry, :pages_deployment_id, {:name=>"index_pages_deployment_registry_on_pages_deployment_id", :unique=>true, :algorithm=>:concurrently})
   -> 0.0020s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:pages_deployment_registry, :verification_retry_at, {:name=>"pages_deployment_registry_failed_verification", :order=>"NULLS FIRST", :where=>"((state = 2) AND (verification_state = 3))", :algorithm=>:concurrently})
   -> 0.0023s
-- add_index(:pages_deployment_registry, :verification_retry_at, {:name=>"pages_deployment_registry_failed_verification", :order=>"NULLS FIRST", :where=>"((state = 2) AND (verification_state = 3))", :algorithm=>:concurrently})
   -> 0.0028s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:pages_deployment_registry, :verification_state, {:name=>"pages_deployment_registry_needs_verification", :where=>"((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))", :algorithm=>:concurrently})
   -> 0.0022s
-- add_index(:pages_deployment_registry, :verification_state, {:name=>"pages_deployment_registry_needs_verification", :where=>"((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))", :algorithm=>:concurrently})
   -> 0.0029s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:pages_deployment_registry, :verified_at, {:name=>"pages_deployment_registry_pending_verification", :order=>"NULLS FIRST", :where=>"((state = 2) AND (verification_state = 0))", :algorithm=>:concurrently})
   -> 0.0025s
-- add_index(:pages_deployment_registry, :verified_at, {:name=>"pages_deployment_registry_pending_verification", :order=>"NULLS FIRST", :where=>"((state = 2) AND (verification_state = 0))", :algorithm=>:concurrently})
   -> 0.0021s
== 20211207162157 AddIndexesToPagesDeploymentRegistry: migrated (0.0233s) =====

== 20211207175940 AddTextLimitToPagesDeploymentRegistryVerificationFailure: migrating
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE pages_deployment_registry\nADD CONSTRAINT check_7eb0430eff\nCHECK ( char_length(verification_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0008s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE pages_deployment_registry VALIDATE CONSTRAINT check_7eb0430eff;")
   -> 0.0009s
== 20211207175940 AddTextLimitToPagesDeploymentRegistryVerificationFailure: migrated (0.0083s)
`rake geo:db:rollback`
== 20211207175940 AddTextLimitToPagesDeploymentRegistryVerificationFailure: reverting
-- transaction_open?()
   -> 0.0000s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE pages_deployment_registry\nDROP CONSTRAINT IF EXISTS check_7eb0430eff\n")
   -> 0.0021s
== 20211207175940 AddTextLimitToPagesDeploymentRegistryVerificationFailure: reverted (0.0273s)

== 20211207162157 AddIndexesToPagesDeploymentRegistry: reverting ==============
-- transaction_open?()
   -> 0.0000s
-- indexes(:pages_deployment_registry)
   -> 0.0093s
-- remove_index(:pages_deployment_registry, {:algorithm=>:concurrently, :name=>"index_pages_deployment_registry_on_pages_deployment_id"})
   -> 0.0048s
-- transaction_open?()
   -> 0.0000s
-- indexes(:pages_deployment_registry)
   -> 0.0036s
-- remove_index(:pages_deployment_registry, {:algorithm=>:concurrently, :name=>"pages_deployment_registry_failed_verification"})
   -> 0.0024s
-- transaction_open?()
   -> 0.0000s
-- indexes(:pages_deployment_registry)
   -> 0.0033s
-- remove_index(:pages_deployment_registry, {:algorithm=>:concurrently, :name=>"pages_deployment_registry_needs_verification"})
   -> 0.0034s
-- transaction_open?()
   -> 0.0000s
-- indexes(:pages_deployment_registry)
   -> 0.0027s
-- remove_index(:pages_deployment_registry, {:algorithm=>:concurrently, :name=>"pages_deployment_registry_pending_verification"})
   -> 0.0025s
== 20211207162157 AddIndexesToPagesDeploymentRegistry: reverted (0.0421s) =====

== 20211119152539 AddVerificationToPagesDeploymentRegistry: reverting =========
-- remove_column(:pages_deployment_registry, :verification_failure, :text)
   -> 0.0018s
-- remove_column(:pages_deployment_registry, :verification_checksum_mismatched, :binary)
   -> 0.0010s
-- remove_column(:pages_deployment_registry, :verification_checksum, :binary)
   -> 0.0009s
-- remove_column(:pages_deployment_registry, :checksum_mismatch, :boolean, {:default=>false, :null=>false})
   -> 0.0012s
-- remove_column(:pages_deployment_registry, :verification_state, :integer, {:limit=>2, :default=>0, :null=>false})
   -> 0.0010s
-- remove_column(:pages_deployment_registry, :verification_retry_count, :integer, {:default=>0, :limit=>2, :null=>false})
   -> 0.0009s
-- remove_column(:pages_deployment_registry, :verification_retry_at, :datetime_with_timezone)
   -> 0.0009s
-- remove_column(:pages_deployment_registry, :verified_at, :datetime_with_timezone)
   -> 0.0010s
-- remove_column(:pages_deployment_registry, :verification_started_at, :datetime_with_timezone)
   -> 0.0010s
== 20211119152539 AddVerificationToPagesDeploymentRegistry: reverted (0.0123s)

How to set up and validate locally

  1. Set up GDK with Runner and Pages enabled and configured.
  2. Set up a second GDK Geo instance
  3. Enable feature flag with Feature.enable(:geo_pages_deployment_verification) in Rails console
  4. Create a GitLab Pages project and deploy a Pages site.
  5. Visit the Geo Sites Dashboard and validate that the Pages deployment was replicated, checksummed, and verified on the secondary.

MR acceptance checklist

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

Related to #339836 (closed)

Edited by Nick Nguyen

Merge request reports