Skip to content
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

Make updating perms on init optional #625

Merged
merged 1 commit into from
Oct 29, 2017

Conversation

mistercrunch
Copy link
Collaborator

@mistercrunch mistercrunch commented Oct 11, 2017

Whenever we re-deploy Superset at Airbnb, we restart 5 web servers which
all have a set of many Gunicorn workers.

Each one of these workers is a process and inits the FAB app, resulting
in a fair amount of database contention around perms tables, and sometimes ultimately
leading to bad database state as I suspect that the perms merge
operations aren't well transaction-insulated. We've added unique
constraints on the DB preventing that, but that's not a great solution.

This PR adds a flag to AppBuilder allowing to turn off perm updates on
init.

The default behavior stays unchanged though.

Note that I decided to add the condition inside _add_menu_permissions and _add_permissions as opposed to adding them in the calling methods since they _add_permissions is called multiple times and could be called in more places in the future. Adding the flag where perms are applied seemed less brittle. Happy to change it though if needed.

Whenever we re-deploy Superset at Airbnb, we restart 5 web servers which
all have a set of many Gunicorn workers.

Each one of these workers is a process and inits the FAB app, resulting
in a fair amount of database contention, and sometimes ultimately
leading to bad database state as I suspect that the perms merge
operations aren't well transaction insulated. We've added unique
constraints on the DB preventing that, but that's not a great solution.

This PR adds a flag to AppBuilder allowing to turn off perm updates on
init.

The default behavior stays unchanged though.
@coveralls
Copy link

coveralls commented Oct 11, 2017

Coverage Status

Coverage increased (+0.01%) to 70.081% when pulling 210c0a0 on mistercrunch:optional_perms into aa4fe74 on dpgaspar:master.

@dpgaspar
Copy link
Owner

Sorry for the delay, merge and release it ASAP

@dpgaspar dpgaspar merged commit 9f6cf8c into dpgaspar:master Oct 29, 2017
@mistercrunch mistercrunch deleted the optional_perms branch October 30, 2017 21:30
@dpgaspar
Copy link
Owner

dpgaspar commented Dec 2, 2017

This is out with v1.9.5

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.

None yet

3 participants