diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-20 09:46:33 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-20 09:50:21 +0300 |
commit | 7d616177e79cd6a08f9369969eee667450697e82 (patch) | |
tree | 635489a0f47b3622cd792496ca3aa60ac79bbdac | |
parent | 41ca8534e12ffdf358ff19eab2bac47d8bb20ae1 (diff) |
praefect: Remove logic to handle maintenance-style replication eventspks-praefect-remove-maintenance-replication-job-handling
Remove the fallback logic that is handling maintenance-style replication
events. We don't generate any such events since v15.0 anymore, and we do
have a migration in place that ensures that any stale events are removed
from the replication queue. Meaning that we now shouldn't ever see any
such event in the wild anymore.
-rw-r--r-- | internal/praefect/datastore/datastore.go | 18 | ||||
-rw-r--r-- | internal/praefect/reconciler/reconciler_test.go | 5 | ||||
-rw-r--r-- | internal/praefect/replicator.go | 9 |
3 files changed, 0 insertions, 32 deletions
diff --git a/internal/praefect/datastore/datastore.go b/internal/praefect/datastore/datastore.go index 2e7497e54..48e9df648 100644 --- a/internal/praefect/datastore/datastore.go +++ b/internal/praefect/datastore/datastore.go @@ -47,24 +47,6 @@ const ( DeleteReplica = ChangeType("delete_replica") // RenameRepo is when a replication renames repo RenameRepo = ChangeType("rename") - // GarbageCollect is when replication runs gc - GarbageCollect = ChangeType("gc") - // RepackFull is when replication runs a full repack - RepackFull = ChangeType("repack_full") - // RepackIncremental is when replication runs an incremental repack - RepackIncremental = ChangeType("repack_incremental") - // Cleanup is when replication runs a repo cleanup - Cleanup = ChangeType("cleanup") - // PackRefs is when replication optimizes references in a repo - PackRefs = ChangeType("pack_refs") - // WriteCommitGraph is when replication writes a commit graph - WriteCommitGraph = ChangeType("write_commit_graph") - // MidxRepack is when replication does a multi-pack-index repack - MidxRepack = ChangeType("midx_repack") - // OptimizeRepository is when replication optimizes a repository - OptimizeRepository = ChangeType("optimize_repository") - // PruneUnreachableObjects is when replication prunes unreachable objects in a repository - PruneUnreachableObjects = ChangeType("prune_unreachable_objects") ) func (ct ChangeType) String() string { diff --git a/internal/praefect/reconciler/reconciler_test.go b/internal/praefect/reconciler/reconciler_test.go index 6390c9478..001d0c22d 100644 --- a/internal/praefect/reconciler/reconciler_test.go +++ b/internal/praefect/reconciler/reconciler_test.go @@ -386,11 +386,6 @@ func TestReconciler(t *testing.T) { []datastore.ChangeType{ datastore.DeleteRepo, datastore.RenameRepo, - datastore.GarbageCollect, - datastore.RepackFull, - datastore.RepackIncremental, - datastore.Cleanup, - datastore.PackRefs, }, datastore.ReplicationJob{ VirtualStorage: "virtual-storage-1", diff --git a/internal/praefect/replicator.go b/internal/praefect/replicator.go index 1471ecef3..08b722d05 100644 --- a/internal/praefect/replicator.go +++ b/internal/praefect/replicator.go @@ -639,15 +639,6 @@ func (r ReplMgr) processReplicationEvent(ctx context.Context, event datastore.Re err = r.replicator.Destroy(ctx, event, targetCC) case datastore.RenameRepo: err = r.replicator.Rename(ctx, event, targetCC) - case datastore.GarbageCollect, datastore.RepackFull, datastore.RepackIncremental, datastore.Cleanup, datastore.PackRefs, datastore.WriteCommitGraph, datastore.MidxRepack, datastore.OptimizeRepository, datastore.PruneUnreachableObjects: - // Even though we don't generate any replication events for maintenance-style RPCs - // anymore, we still need to handle them here in order to drain the queue. It's safe - // to just do nothing though: the new strategy is best-effort anyway and just - // ignores out-of-date nodes, so by ignoring the events here we roughly do the same. - // - // This fallback code can be removed with v15.1 along with an SQL migration which - // prunes any remaining maintenance-style replication jobs. - r.log.Infof("ignoring maintenance event of type %v", event.Job.Change) default: err = fmt.Errorf("unknown replication change type encountered: %q", event.Job.Change) } |