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

Populate flagsmith_environments_v2 from flagsmith_identities #3106

Closed
matthewelwell opened this issue Dec 6, 2023 · 4 comments · Fixed by #3127 or #3138
Closed

Populate flagsmith_environments_v2 from flagsmith_identities #3106

matthewelwell opened this issue Dec 6, 2023 · 4 comments · Fixed by #3127 or #3138
Assignees

Comments

@matthewelwell
Copy link
Contributor

matthewelwell commented Dec 6, 2023

We need a way to migrate the data in the identity_features attribute on each identity in an environment into the new flagsmith_overrides table.

This should be a one off migration process which we can create a Task in the task processor for.

@khvn26
Copy link
Member

khvn26 commented Dec 6, 2023

  1. Have a DDB CDC stream consumer that filters identity documents by given environments, maps them to overrides and writes them to a new table.
  2. When migration prompted, add an ephemeral "_migrate_requested": timestamp() attribute to all of the project's identity documents (how do we get those?). This will produce the update events in the stream.
  3. Flip the switch in the project settings so the subsequent identity overrides are written to the new table. (make sure that deletions are imdepotent there).
  4. Run the consumer for all the affected environments until it starves out (what would be the criteria here?)

@khvn26 khvn26 changed the title Add migration process for current identity overrides to new flagsmith_overrides table Populate flagsmith_environments_v2 from flagsmith_identities with DDB stream consumer Dec 7, 2023
@khvn26
Copy link
Member

khvn26 commented Dec 7, 2023

This is now going to be a permanent worker process that:

@khvn26 khvn26 self-assigned this Dec 9, 2023
@khvn26
Copy link
Member

khvn26 commented Dec 9, 2023

This is solved as a task processor task in the Core API that's triggered on EdgeIdentity.save.

@khvn26 khvn26 changed the title Populate flagsmith_environments_v2 from flagsmith_identities with DDB stream consumer Populate flagsmith_environments_v2 from flagsmith_identities Dec 10, 2023
@khvn26 khvn26 reopened this Dec 10, 2023
@khvn26
Copy link
Member

khvn26 commented Dec 10, 2023

The task processor code is merged.

For the backfill/migration part, we need to call the task with the changeset that updates all the identity overrides in the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants