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

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-09-21 16:18:45 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-09-29 13:31:19 +0300
commit99199b0887c09d93166d77cf01caea93f07c9c5b (patch)
tree7de887590971ee4ce1401ca1e4426fc7129ae029 /internal
parent2bbec66c9d738b0df435f3aab801747408929ed0 (diff)
Backfill replica_path in 'repositories' records
Praefect now generates a repository id that can be used to join the database records of a repository across the tables. As such, the virtual_storage and relative_path columns will not be needed in other tables than the 'repositories' table as the joining will happen via the repository_id column. As Praefect will begin generating unique relative paths for the replicas to avoid stale disk state of deleted repositories affecting recreation of said repositories, the replica_path column was added to the 'repositories' table to store the actual disk path of the replicas. Right now, every newly created 'repositories' record has the replica_path set to the relative_path. To begin using the new column, we also need the historical records to have the column correctly filled. This commit adds a migration that fills the replica_path of existing records. As each repository is currently stored in the path sent by the client, we'll just fill the column using that. Changelog: other
Diffstat (limited to 'internal')
-rw-r--r--internal/praefect/datastore/migrations/20210921131816_backfill_replica_path.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/praefect/datastore/migrations/20210921131816_backfill_replica_path.go b/internal/praefect/datastore/migrations/20210921131816_backfill_replica_path.go
new file mode 100644
index 000000000..e18ea3d4c
--- /dev/null
+++ b/internal/praefect/datastore/migrations/20210921131816_backfill_replica_path.go
@@ -0,0 +1,13 @@
+package migrations
+
+import migrate "github.com/rubenv/sql-migrate"
+
+func init() {
+ m := &migrate.Migration{
+ Id: "20210921131816_backfill_replica_path",
+ Up: []string{"UPDATE repositories SET replica_path = relative_path"},
+ Down: []string{},
+ }
+
+ allMigrations = append(allMigrations, m)
+}