Skip to content

Stop migrations when the migration lock is lost - #333

Draft
niemyjski wants to merge 1 commit into
mainfrom
fix/migration-lock-renewal
Draft

niemyjski wants to merge 1 commit into
mainfrom
fix/migration-lock-renewal

Conversation

@niemyjski

Copy link
Copy Markdown
Member

MigrationManager renews its migration lock with RenewAsync. Foundatio#580 makes that throw LockException when the lock is lost (it used to silently succeed), so migrations need to handle it instead of retrying or carrying on.

Changes

  • During a migration: a lost lock fails the migration immediately. The resilience policy no longer retries it, since a lost lock can't be won back.
  • Between migrations: if the lock is lost after a migration completes, it logs the error and returns Failed so the next migration doesn't start.
  • Bug fix: a cancelled non-versioned migration used to be marked complete. It now returns Cancelled.
  • Test projects move to the xunit v3 Parallelization attribute, which 4.0.1 requires.

Tests

Two new migration tests cover lock loss during and between migrations. Repositories.Tests (152) pass. Elasticsearch tests mostly passed (684 of 689), and the 5 failures passed when rerun individually.

Draft until #580 is released.

- Keep LockException from RenewAsync out of the resilience policy so a lost lock fails immediately
- Return Failed between migrations when the renewal after a completed migration loses the lock
- Return Cancelled for cancelled non-versioned migrations instead of marking them complete
- Add regression tests and move test assemblies to xunit v3 Parallelization attribute

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant