Aimed_for_deletion added to groups gql api

What does this MR do and why?

this mr add aimed_for_deletion parameter to the Groups GQL API

Screenshots or screen recordings

screen record

How to set up and validate locally

  • pull branch locally
  • start gdk
  • open graphql explorer
  • use this query : query_file.txt

Database review

SQL query

SELECT
    "namespaces"."id",
    "namespaces"."name",
    "namespaces"."path",
    "namespaces"."owner_id",
    "namespaces"."created_at",
    "namespaces"."updated_at",
    "namespaces"."type",
    "namespaces"."avatar",
    "namespaces"."membership_lock",
    "namespaces"."share_with_group_lock",
    "namespaces"."visibility_level",
    "namespaces"."request_access_enabled",
    "namespaces"."ldap_sync_status",
    "namespaces"."ldap_sync_error",
    "namespaces"."ldap_sync_last_update_at",
    "namespaces"."ldap_sync_last_successful_update_at",
    "namespaces"."ldap_sync_last_sync_at",
    "namespaces"."lfs_enabled",
    "namespaces"."parent_id",
    "namespaces"."shared_runners_minutes_limit",
    "namespaces"."repository_size_limit",
    "namespaces"."require_two_factor_authentication",
    "namespaces"."two_factor_grace_period",
    "namespaces"."project_creation_level",
    "namespaces"."runners_token",
    "namespaces"."saml_discovery_token",
    "namespaces"."runners_token_encrypted",
    "namespaces"."auto_devops_enabled",
    "namespaces"."extra_shared_runners_minutes_limit",
    "namespaces"."last_ci_minutes_notification_at",
    "namespaces"."last_ci_minutes_usage_notification_level",
    "namespaces"."subgroup_creation_level",
    "namespaces"."max_pages_size",
    "namespaces"."max_artifacts_size",
    "namespaces"."mentions_disabled",
    "namespaces"."default_branch_protection",
    "namespaces"."max_personal_access_token_lifetime",
    "namespaces"."shared_runners_enabled",
    "namespaces"."allow_descendants_override_disabled_shared_runners",
    "namespaces"."traversal_ids",
    "namespaces"."organization_id",
    "namespaces"."state"
FROM
    "namespaces"
    INNER JOIN "members" ON "namespaces"."id" = "members"."source_id"
WHERE
    "members"."type" = 'GroupMember'
    AND "members"."source_type" = 'Namespace'
    AND "namespaces"."type" = 'Group'
    AND "members"."user_id" = 5413811
    AND "members"."requested_at" IS NULL
    AND (access_level >= 10)
    AND "members"."access_level" = 50
    AND EXISTS (
        SELECT
            1
        FROM
            "group_deletion_schedules"
        WHERE
            "group_deletion_schedules"."group_id" = ANY (namespaces.traversal_ids))
ORDER BY
    LOWER("namespaces"."name") ASC,
    "namespaces"."id" DESC
LIMIT 101

Query plan

https://postgres.ai/console/gitlab/gitlab-production-main/sessions/54078/commands/156477

Limit  (cost=35.74..35.74 rows=1 width=391) (actual time=173.100..173.104 rows=1 loops=1)
   Buffers: shared hit=126 read=101
   I/O Timings: read=140.388 write=0.000
   ->  Sort  (cost=35.74..35.74 rows=1 width=391) (actual time=173.099..173.101 rows=1 loops=1)
         Sort Key: (lower((namespaces.name)::text)), namespaces.id DESC
         Sort Method: quicksort  Memory: 25kB
         Buffers: shared hit=126 read=101
         I/O Timings: read=140.388 write=0.000
         ->  Nested Loop Semi Join  (cost=1.55..35.73 rows=1 width=391) (actual time=43.327..173.061 rows=1 loops=1)
               Buffers: shared hit=120 read=101
               I/O Timings: read=140.388 write=0.000
               ->  Nested Loop  (cost=1.14..35.19 rows=1 width=359) (actual time=10.572..131.226 rows=17 loops=1)
                     Buffers: shared hit=35 read=83
                     I/O Timings: read=130.407 write=0.000
                     ->  Index Scan Backward using idx_members_on_user_and_source_and_source_type_and_member_role on public.members  (cost=0.57..28.01 rows=2 width=4) (actual time=7.004..59.762 rows=17 loops=1)
                           Index Cond: ((members.user_id = 5413811) AND ((members.source_type)::text = 'Namespace'::text))
                           Filter: ((members.requested_at IS NULL) AND (members.access_level >= 10) AND ((members.type)::text = 'GroupMember'::text) AND (members.access_level = 50))
                           Rows Removed by Filter: 9
                           Buffers: shared hit=2 read=31
                           I/O Timings: read=59.483 write=0.000
                     ->  Index Scan using namespaces_pkey on public.namespaces  (cost=0.57..3.59 rows=1 width=359) (actual time=4.199..4.199 rows=1 loops=17)
                           Index Cond: (namespaces.id = members.source_id)
                           Filter: ((namespaces.type)::text = 'Group'::text)
                           Buffers: shared hit=33 read=52
                           I/O Timings: read=70.924 write=0.000
               ->  Index Only Scan using group_deletion_schedules_pkey on public.group_deletion_schedules  (cost=0.41..1.00 rows=10 width=8) (actual time=0.611..0.611 rows=0 loops=17)
                     Index Cond: (group_deletion_schedules.group_id = ANY (namespaces.traversal_ids))
                     Heap Fetches: 0
                     Buffers: shared hit=85 read=18
                     I/O Timings: read=9.981 write=0.000
Settings: effective_cache_size = '472585MB', jit = 'off', random_page_cost = '1.5', work_mem = '230MB', seq_page_cost = '4'
Query ID: 4225905067606856642
Time: 177.385 ms  
  - planning: 4.169 ms  
  - execution: 173.216 ms  
    - I/O read: 140.388 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 126 (~1008.00 KiB) from the buffer pool  
  - reads: 101 (~808.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0 

related issue:#526212

Edited by Peter Hegman

Merge request reports

Loading
Loading