Skip to content

HA Backend Data Model

Refer to the HA Design document for language and current design.

This issue discusses the data model needed to satisfy the HA requirements. Specifically, these requirements are:

  • Assign backend nodes to a project
  • Identify which backend nodes are degraded for a given project
  • Map backend nodes to a storage location

Relational Tables

The existing SQL data model has a projects table which contains a relevant repository_storage field. Currently, repository_storage points to the Gitaly storage location for a project.

The future design intends to map the repository_storage location to a number of backend nodes. This way, a request routed to a specific storage location will transparently be routed to a number of backend storage locations.

The current design is to introduce two new tables:

  • projectStorages - junction table that ties together a project and the backend storage nodes. Allows us to track when a backend node becomes degraded (inconsistent) for a given project. This can occur when a write operation fails on a project on a given backend node.
  • storages - the actual backend node storage locations and the associated service instance currently operating on it.
╔══════════════════════════════════════════════════════╗   
║                Gitaly HA - Data Model                ║   
║                                                      ║   
║                                                      ║   
║                                                      ║   
║   ┌───────────────────────────────┐                  ║   
║   │projects                       │                  ║   
║   │ - repository_storage (string) │ (already exists) ║   
║   │                               │                  ║   
║   └───────────────────────────────┘                  ║   
║                   │                                  ║   
║                   │                                  ║   
║                   ○                                  ║   
║                  ╱│╲                                 ║   
║   ┌───────────────────────────────┐                  ║   
║   │projectStorages                │                  ║   
║   │ - consistent (bool)           │                  ║   
║   │                               │                  ║   
║   └───────────────────────────────┘                  ║   
║                  ╲│╱                                 ║   
║                   ○                                  ║   
║                   │                                  ║   
║                   │                                  ║   
║   ┌───────────────────────────────┐                  ║   
║   │storages                       │                  ║   
║   │ - PK: backend_storage (string)│                  ║   
║   │ - Instance UUID (string)      │                  ║   
║   └───────────────────────────────┘                  ║   
║                                                      ║   
╚══════════════════════════════════════════════════════╝   
Edited by Paul Okstad (ex-GitLab)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information