Skip to content

Geo: Implement GraphQL endpoint for MR diffs

Toon Claes requested to merge tc-geo-mr-diffs-graphql into master

What does this MR do?

Implement the GraphQL endpoint as documented at: https://docs.gitlab.com/ee/development/geo/framework.html#graphql-api

Closes #215138 (closed)

Does this MR meet the acceptance criteria?

Database

We don't have data on this in production or staging yet, so I'm testing it locally.

Query:

SELECT "merge_request_diff_registry".*
FROM "merge_request_diff_registry"
WHERE "merge_request_diff_registry"."id" IN (6, 4)
ORDER BY "merge_request_diff_registry"."id" ASC

I've populated my database with some records:

DO $$
DECLARE
  i record;
BEGIN
  FOR i IN 1..100000 LOOP
    INSERT INTO "merge_request_diff_registry" ("created_at", "merge_request_diff_id") VALUES (now(), i);
  END LOOP;
END $$;

Plan:

                                                                              QUERY PLAN                                                      
                         
----------------------------------------------------------------------------------------------------------------------------------------------
-------------------------
 Index Scan using merge_request_diff_registry_pkey on public.merge_request_diff_registry  (cost=0.42..17.31 rows=3 width=76) (actual time=0.04
2..0.070 rows=3 loops=1)
   Output: id, created_at, retry_at, last_synced_at, merge_request_diff_id, state, retry_count, last_sync_failure
   Index Cond: (merge_request_diff_registry.id = ANY ('{100449,148934,182901}'::bigint[]))
   Buffers: shared hit=12
 Planning Time: 0.232 ms
 Execution Time: 0.109 ms
(6 rows)

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Toon Claes

Merge request reports

Loading