You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/04/30 21:53:50 UTC

[GitHub] [incubator-superset] jdbertron opened a new pull request #7417: Fix migration metadata lock on ab_view_menu

jdbertron opened a new pull request #7417: Fix migration metadata lock on ab_view_menu
URL: https://github.com/apache/incubator-superset/pull/7417
 
 
   This fix is to make sure the scoped session created by the superset
   init code (that creates a bunch of roles and permissions) will
   be released and potentially committed when the superset/__init__.py
   goes out of scope. 
   
   	modified:   superset/__init__.py
   
   ### CATEGORY
   
   Choose one
   
   - [ X] Bug Fix
   - [ ] Enhancement (new features, refinement)
   - [ ] Refactor
   - [ ] Add tests
   - [ ] Build / Development Environment
   - [ ] Documentation
   
   ### SUMMARY
   Without running in a context, the code leaves the session open with a lock on ab_view_menu
   metadata, which prevents migration cefabc8f7d38_increase_size_of_name_column_in_ab_view
   from running an ALTER on that table. 
   Another contributor suggested explicitly closing the session or trying to use the same session inside the migration code. This requires more engineering and the sm.session.close() would have to be explicit. Any new interaction with the database would cause the problem to happen again.
   See here: https://github.com/apache/incubator-superset/issues/1260#issuecomment-334115725
   I found using an app context to work better to encapsulate the superset init code, in case people add more logic there, the session close will happen automatically as the context goes out of scope.
   
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TEST PLAN
   Run migrations using mysql to version   3e1b21cd94a4 
   Run migrations to cefabc8f7d38
   Without the fix, it should hang on the ALTER ab_view_menu, and with the fix it will complete.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] Requires DB Migration.
   - [ ] Confirm DB Migration upgrade and downgrade tested.
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   ### REVIEWERS
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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