StackStorm / StackStorm/st2

Update RBAC syncer code to re-use and update existing database objects instead of using "delete all and re-create" approach

Open
#3,310 4 comments 0 reactions 1 assignee View on GitHub

@Kami is already working on this.

Since Mar 27, 2017.

enhancement
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

Right now all the RBAC syncer code always creates latest state by deleting all the current assignments and (re)creating new ones based on the definitions on disk.

This was done intentionally for the sake of code simplicity and readability.

This works fine, but it creates a lot of unnecessary database object churn because objects are deleted from the database and new ones created even if nothing has changed (aka state before and after the run will be the same).

This could potentially cause performance related issues in scenarios where there are many users and assignments and st2-apply-rbac-definitions tool is ran many times in a short time frame.

So a small performance optimization would be to refactor the code to re-use existing database objects instead of always going with "delete all and re-create" approach. We have enough tests and everything else so we should feel confident in the refactor and the actual refactor should be quite straight forward.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.