Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gitaly gitaly
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 656
    • Issues 656
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 35
    • Merge requests 35
  • Requirements
    • Requirements
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • gitalygitaly
  • Merge requests
  • !2749

Merged
Created Nov 04, 2020 by Sami Hiltunen@samihiltunenMaintainer

Create database records for repositories missing them

  • Overview 37
  • Commits 2
  • Pipelines 9
  • Changes 8

In the past, Praefect did not create a database records for hosted repositories. Nowadays Praefect tracks repositories and the storage's hosting copies of them in the repositories and the storage_repositorie tables. Various components in Praefect, including the automatic reconciler, operate only based on these database records. As such, repositories which have received no mutators after the introduction of the tables are ignored.

There are two work in progress features in the pipeline that also depend on the database records.

  1. Repository specific primaries need to know which repositories exist in order to elect a primary for them.
  2. Variable replication factor needs to know which storage locations contain the repository in order to route the requests to correct nodes.

This commit adds support for creating database records for repositories which are still missing them. The importer walks the primary storage of each virtual storage and creates a record for each repository existing on the primary. The created records can then be picked up by the automatic reconciler which will replicate the repositories to the secondaries and create their records.

Repositories on secondaries are ignored by the importer. This matches how Praefect would behave in general. If a repository is missing database records and it receives a write, Praefect follows it's previous behavior and simply accepts the write and overwrites the copies on the secondaries.

Once the migration has been successfully completed, a flag in the database is set to prevent the migration from running again unnecessarily. If the importer does not run to completion, it is safe to rerun. Running the importer concurrently is also safe as only missing records are added and existing ones are unmodified.

The import runs on each Praefect node on start up and retries on every restart until it has successfully completed.

Closes #3033 (closed)

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: smh-migration-tool

Enable Gitpod?

To use Gitpod you must first enable the feature in the integrations section of your user preferences.

Cancel Enable Gitpod