-
Notifications
You must be signed in to change notification settings - Fork 116
CUMULUS-3959: Add documentation to resolve failing db migrations #3896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9362dc7
First commit
Nnaga1 96cbd81
Merge branch 'master' into CUMULUS-3959-docs
Nnaga1 056b89e
Merge branch 'CUMULUS-3959-docs' of https://github.com/nasa/cumulus i…
Nnaga1 a0d5bd0
PR feedback P1
Nnaga1 44f6f0d
Merge branch 'master' into CUMULUS-3959-docs
Nnaga1 3c6efdb
Merge branch 'CUMULUS-3959-docs' of https://github.com/nasa/cumulus i…
Nnaga1 76482e1
PR feedback fix
Nnaga1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...rsioned_docs/version-v18.5.0/troubleshooting/troubleshoot_database_migration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
id: troubleshooting-database-migrations | ||
title: Troubleshooting Database Migrations | ||
hide_title: false | ||
--- | ||
|
||
This document provides guidance on how to troubleshoot database migration when upgrading to v18.5.1. | ||
|
||
:::info | ||
|
||
This document is specifically intended to provide a potential resolution for issues with the database migration to v18.5.1+. | ||
The advice in this document may be used for migrations to other versions, but please be mindful they may not provide the same resolution. | ||
::: | ||
|
||
## Failing Database Migrations | ||
|
||
When trying to deploy the v18.5.1 of Cumulus, specifically the `data-persistence-tf` module, there is a chance the terraform deployment task times out. The timeout usually occurs when the `<prefix>-postgres-db-migration` lambda is invoked. It will attempt to run the migrations, which may take longer than the Lambda's timeout allows. This occurs when the lambda is trying to run a new migration that has not already been applied (e.g. is NOT in the PostgreSQL `Migrations Table`). | ||
|
||
### Discerning Failing Migrations | ||
|
||
The issue can be resolved by simply skipping the offending migration. To see which migration that is; you can query the PostgreSQL `knex_migrations` table and compare them to the ones you should have in your release (in this case 18.5.1). If one or more migrations is missing, that migration is potentially taking too long for the Lambda and causing issues. | ||
|
||
### Next Steps | ||
|
||
When you discover which migration(s) are missing from the `Migrations Table`. These steps can be taken to resolve: | ||
- Manually apply the migration (ex. `update_executions_deletion_constraint`) using SQL applied directly to your database. The SQL commands can be found in the `db` package of the Cumulus codebase | ||
- Manually add the entry into the `knex_migrations` table. Subsequent runs of the `<prefix>-postgres-db-migration` Lambda will check this table and skip any migrations listed. This means that your manual SQL updates will be respected and the Lambda will not try to process the same migration. | ||
- Re-deploy `data-persistence-tf` after verifying the above successfully completed | ||
|
||
### Other potential issues | ||
|
||
Migration Lambda timeouts (or other related timeouts) may be caused by `VACUUM` statements in the migration. If you find your deployment not completing despite the migration table and the migrations being consistent, this may be the issue. In v18.5.2, some `VACUUM` statements have been removed to tailor for this issue. If you find yourself struggling with v18.5.1 despite completing the above steps, please upgrade to v18.5.2 and try deployment again. The removal of potentially long-running migrations may resolve the issue. | ||
|
||
### Miscellaneous | ||
|
||
If the instructions in this document are not helping you with your issues(s) reagarding troubleshooting database migration, please contact the Cumulus Team for support. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.