You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mistercrunch (via GitHub)" <gi...@apache.org> on 2024/07/10 17:06:24 UTC

[I] [DRAFT][SIP-XX] Improving Database Migration Management [superset]

mistercrunch opened a new issue, #29546:
URL: https://github.com/apache/superset/issues/29546

   [STILL A DRAFT - MORE THINKING REQUIRED]
   
   ## Motivation
   
   Managing database migrations in Superset currently poses challenges such as deadlocks and downtime during DDL changes. We aim to improve the process to ensure smooth blue/green deployments, reduce downtime, and handle complex migrations effectively.
   
   ## Proposed Change
   
   1. **Impose Blue/Green-Safe Migrations as part of minor releases**:
      - Implement migrations that support both pre- and post-PR versions of the app.
      - Use feature flags to control migration-dependent features. Operators can run migrations while keeping flags off, then flip them post-migration. Ensure migrations aren't needed when the feature flag is false.
      - Each blue/green safe migration should add a release not in `UPDATING.md` as to the migration and related feature flag. Release managers would take note to flip a certain number of flags post-migration.
   
   1. **Accumulated Cleanup Migrations**: Defer non-critical cleanup migrations (e.g., column deletions) to major version upgrades, in a file (`superset/migration/future.py`) imposing a certain structure that's compatible with alembic-based approach. 
   
   1. **Complex Migrations During Release Windows**: Hold back complex, non-blue/green-safe migrations for specific release windows to minimize risks and ensure resource availability.
   
   1. **Major release migration bundling**: On major version releases, the "future" migrations are bundle into a chain of alembic migrations, and it's well understood that these migration require downtime. PRs that were held up for migrations that require downtime are also merged. Major version also flip the default feature flags to true and/or removes related codepaths
   
   1. **Enforce** through a new `CODEOWNERS` policy specific to migration. Have a few committers familiar with this SIP enforce as code owners where migrations are concerned.
   
   ## Examples
   Say for a simple migration where I'd add a `is_published` flag to dashboards, I'd need to:
   - set up a feature flag referencing the migration, `IS_PUBLISHED_PR2387` where 2387 represents the PR id that contains the related migration
   - 
   
   
   ## New or Changed Public Interfaces
   
   - Introduce new feature flags for migration-dependent features.
   - Update CLI tools to support deferred and bundled migrations.
   
   ## New Dependencies
   
   - None.
   
   ## Migration Plan and Compatibility
   
   - Detailed documentation on using feature flags for migrations.
   - Establish a tracking system for deferred migrations to ensure they are bundled and tested before major releases.
   
   ## Rejected Alternatives
   
   - Immediate application of all migrations, which increases the risk of downtime and deadlocks.
   - Manual handling of complex migrations without specific release windows, leading to unpredictable deployment issues.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2860612541

   Fine by me, I think the real outcome here was CODEOWNERS for migration and general guidelines/caution around those. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2417340595

   Well, it's a SIP right now. If we're not going to vote, we should find some form of consensus around parts of it to move forward.
   
   I don't think the CODEOWNERS change needs a SIP... that's just something we do (and might already be done?).
   
   The rest of it, if we're setting up a best practice, would be to retract this as a SIP, convert it to a Discussion thread (of the Ideas variety) and then submit the Discussion thread to the Dev list for lazy consensus, seeking to publish the ideas as a best practice on the Superset Wiki.
   
   Examples:
   https://github.com/apache/superset/discussions/27769
   https://github.com/apache/superset/discussions/21914
   https://github.com/apache/superset/discussions/19304
   
   Holler if you want help converting it to a discussion and opening the Lazy Consensus thread.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2859173450

   @mistercrunch should we close this as "abandoned" for now and reopen it when there's more bandwidth? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2855513169

   Leaving a comment to keep this thread from showing up in stale reports... but we can also close this for now and reopen later (when bandwidth allows) if that makes sense.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [DRAFT][SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2265807184

   @michael-s-molina I added the section "Considerations for large environments:". I'm removing the DRAFT tag and will open a PR setting us up as CODEOWNERS


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2265816516

   Oh I just found prior art here https://github.com/apache/superset/issues/13351
   
   > PRs introducing database migrations must include runtime estimates and downtime expectations.
   
   That one can be pretty tricky for, though I think specialists might have a pretty decent sense for it and be able to craft a decent message for `UPDATING.md`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2374564425

   @mistercrunch what's the next step on this one? Think it's ready for discussion?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [DRAFT][SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2265793204

   Relevant: https://github.com/apache/superset/issues/29801#issuecomment-2263052989 - posting this here and editing the SIP to tackle this type of issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2265853714

   > PRs introducing database migrations must include runtime estimates and downtime expectations.
   
   @mistercrunch that's what I'm currently doing while testing 4.1. If you correctly code the migrations, you generally do them in batches, so we can easily estimate the necessary time by computing row much time a batch takes and extrapolate it to the number of affected rows.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2265812261

   > @michael-s-molina I added the section "Considerations for large environments:". I'm removing the DRAFT tag and will open a PR setting us up as CODEOWNERS
   
   There's also a "risk:db-migrations" label or one like it. I think this is automatically added by supersetbot, but we could make it effectively block PRs, if that's helpful.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2375518188

   Do we need to vote? Can we just assume consensus and move on?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch closed issue #29546: [SIP-142] Improving Database Migration Management
URL: https://github.com/apache/superset/issues/29546


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2375517670

   I think it's simply to have the newly setup `CODEOWNERS` apply the rules/guidelines stated here


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] [SIP-142] Improving Database Migration Management [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29546:
URL: https://github.com/apache/superset/issues/29546#issuecomment-2593532731

   We still plan to do this, but we'll just keep it parked while we work on other priorities.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org