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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-20 09:42:59 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-05-20 09:47:19 +0300
commit41ca8534e12ffdf358ff19eab2bac47d8bb20ae1 (patch)
treef720c54a2f3082951a33c6e4b3f95389a8fd5655
parent5c57bbfef4f37bcca64e3db2e147265450b86300 (diff)
praefect: Prune stale maintenance-style replication events
In release 15.0 we have stopped creating maintenance-style replication events in favor of using a best-effort strategy for handling repository maintenance. And while we still have the logic in place to dequeue these events, they're currently ignored by Praefect altogether. We're about to remove this fallback logic now, so let's make clear that the replication queue really doesn't have any maintenance-style events left by adding a migration that prunes any stale ones.
-rw-r--r--internal/praefect/datastore/migrations/20220520083313_remove_maintenance_replication_events.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/praefect/datastore/migrations/20220520083313_remove_maintenance_replication_events.go b/internal/praefect/datastore/migrations/20220520083313_remove_maintenance_replication_events.go
new file mode 100644
index 000000000..09330c942
--- /dev/null
+++ b/internal/praefect/datastore/migrations/20220520083313_remove_maintenance_replication_events.go
@@ -0,0 +1,27 @@
+package migrations
+
+import migrate "github.com/rubenv/sql-migrate"
+
+func init() {
+ m := &migrate.Migration{
+ Id: "20220520083313_remove_maintenance_replication_events",
+ Up: []string{
+ `DELETE FROM replication_queue WHERE job->>'change' IN (
+ 'gc',
+ 'repack_full',
+ 'repack_incremental',
+ 'cleanup',
+ 'pack_refs',
+ 'write_commit_graph',
+ 'midx_repack',
+ 'optimize_repository',
+ 'prune_unreachable_objects'
+ )`,
+ },
+ Down: []string{
+ // We cannot get this data back anymore.
+ },
+ }
+
+ allMigrations = append(allMigrations, m)
+}