Include group wikis in Geo replication [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Merged Francisco Javier López requested to merge 208147-fj-add-geo-replication-group-wikis into master

What does this MR do?

This MR adds the functionality to sync group wiki repositories in Geo.

Queries

Migration output

Migrate up
== 20210223111722 CreateGroupWikiRepositoryRegistry: migrating ================
-- create_table(:group_wiki_repository_registry, {:id=>:bigserial, :force=>:cascade})
   -> 0.0196s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE group_wiki_repository_registry\nADD CONSTRAINT check_983ee0d9c3\nCHECK ( char_length(last_sync_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0012s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE group_wiki_repository_registry VALIDATE CONSTRAINT check_983ee0d9c3;")
   -> 0.0013s
== 20210223111722 CreateGroupWikiRepositoryRegistry: migrated (0.0394s) =======
Migrat down
== 20210223111722 CreateGroupWikiRepositoryRegistry: reverting ================
-- drop_table(:group_wiki_repository_registry)
   -> 0.0076s
== 20210223111722 CreateGroupWikiRepositoryRegistry: reverted (0.0076s) =======

Query 1

The query plan for this query is in https://explain.depesz.com/s/VmUX

def self.group_wiki_repositories_for_selected_namespaces
  self.joins(:group).where(group_id: ::Gitlab::Geo.current_node.namespaces_for_group_owned_replicables.select(:id))
end
SELECT group_wiki_repositories.*
FROM group_wiki_repositories
INNER JOIN namespaces ON namespaces.id = group_wiki_repositories.group_id
AND namespaces.type = 
Group
WHERE group_wiki_repositories.group_id IN (1, 2, 3)

Query times with warm cached:

Time: 0.788 ms
  - planning: 0.679 ms
  - execution: 0.109 ms
    - I/O read: N/A
    - I/O write: N/A

Shared buffers:
  - hits: 9 (~72.00 KiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

Query 2

The query plan for this query is in https://explain.depesz.com/s/rG7p

def self.group_wiki_repositories_for_selected_shards
  self.for_repository_storage(::Gitlab::Geo.current_node.selective_sync_shards)
end
SELECT "group_wiki_repositories".*
FROM "group_wiki_repositories"
INNER JOIN "shards" ON "shards"."id" = "group_wiki_repositories"."shard_id"
WHERE "shards"."name" = 'default'

Query times with warm caches:

Time: 0.290 ms
  - planning: 0.220 ms
  - execution: 0.070 ms
    - I/O read: N/A
    - I/O write: N/A

Shared buffers:
  - hits: 7 (~56.00 KiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

Does this MR meet the acceptance criteria?

Conformity

Related to #208147 (closed)

Edited by Francisco Javier López