[go: up one dir, main page]

Skip to content

Migration framework state reset when there is a disabled task

The migration manager uses a map migrationStates to mark the state of a repo's migration run. The core logic is here: A doneCh is assigned to that repo's state and other transactions on that repo have to be blocked until migrations are all done.

An edge case occurs when a migration is registered but disabled. The corresponding state is initialized with a closed doneCh, and a closed channel will not block. As a result, the migration framework incorrectly considers the task as already completed, even though it was never actually executed.

A temporary workaround is to restart Gitaly, which refreshes the internal state map and allows the migration to run.

This MR adds a few enhancements:

  • If there is any disabled task, the repo's entry is removed from the state map, so that the migration framework will keep tracking the repo. In case the task is enabled, it will be executed.
  • Before starting a transaction, we check if there are any new migrations that need to be run to prevent wasting resources.

Closes #6861 (closed)

Edited by Eric Ju

Merge request reports

Loading