Skip to content

Preload saml_provider unconditionally to fix N+1 queries

Abdul Wadood requested to merge 435797-saml-provider-n-plus-1 into master

What does this MR do and why?

Preloading saml_providers is required for EE when resolving groups as saml_provider is used in GroupPolicy to prevent/enable reading the group.

ForkTargetsResolver now directly uses LooksAhead instead of using it through ResolvesGroups as we don't want to preload saml_providers for ForkTargetsResolver because it returns user namespaces in addition to groups. This results in spec failures because saml_provider is not present for user namespaces but only for groups.

How to set up and validate locally

On master and on this branch, run this GraphQL query on https://gdk.test:3000/-/graphql-explorer and notice the difference in the count of queries to the saml_providers table:

{
  groups(first: 10) {
    nodes {
      id
    }
  }
}

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #435797 (closed)

Edited by Abdul Wadood

Merge request reports

Loading