zitadel/internal/integration
Tim Möhlmann 669ac6bda2
perf(import): do not check for existing grant ID (#8164)
# Which Problems Are Solved

Improve the performance of the `admin/v1/import` API endpoint.
Specifaclly the import of large amount of project grants.

# How the Problems Are Solved

`AddProjectGrantWithID` and `AddProjectGrantMember` methods of
`Commands` used to get the current state of the Writemodel to check if
the current GrantID or the combination of GrantID & UserID wasn't
already used. However, the Added events already have protection against
duplication by the `UniqueConstaint` methods.

The queries become very slow when there is a great amount of project
grants. Because all the events are pushed to the aggregate ID of the
project, we had to obtain all related project events, including events
of grantIDs we do not care about. This O(n) duration for bached import
jobs adding many organization granted to a single project.

This change removes the unnecesary state query to improve performance.

# Additional Changes

- Add integration tests for import

# Additional Context

- reported internally
2024-06-20 13:31:58 +00:00
..
config test(e2e): fix events flakiness (#7829) 2024-04-23 09:20:11 +02:00
assert_test.go feat: impersonation roles (#7442) 2024-02-28 10:21:11 +00:00
assert.go perf(import): do not check for existing grant ID (#8164) 2024-06-20 13:31:58 +00:00
client.go feat: password age policy (#8132) 2024-06-18 11:27:44 +00:00
integration_test.go AddHumanUser tests 2023-04-28 14:39:53 +03:00
integration.go feat: query side for executions and targets for actions v2 (#7524) 2024-03-14 09:56:23 +00:00
oidc.go fix: consider oidc session events for authN milestones (#8089) 2024-06-12 06:49:14 +02:00
rand.go feat: restrict languages (#6931) 2023-12-05 11:12:01 +00:00
user.go feat(oidc): token exchange impersonation (#7516) 2024-03-20 10:18:46 +00:00
usertype_string.go feat(api): add organisation service (#6340) 2023-08-11 14:19:14 +00:00