Skip to content

Geo - Support filtering snippet repositories by keyword via GraphQL

What does this MR do and why?

Currently, for self-service replicables, we are unable to do any filtering on the Geo Replicable views.

This MR supports filtering snippet repositories registries by keyword (fuzzy_search) via GraphQL:

Registry Searchable attributes
Snippet Repositories Disk path

Database

Raw SQL and query plans

Using:

SnippetRepository.search('@snippets/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b')

Then:

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/15094/commands/52485

SELECT
    snippet_repositories.*
FROM
    snippet_repositories
WHERE
    snippet_repositories.disk_path ILIKE '%@snippets/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b%';

Query plan:

 Gather  (cost=1000.00..34603.54 rows=47 width=189) (actual time=3208.672..3208.774 rows=0 loops=1)
   Workers Planned: 2
   Workers Launched: 2
   Buffers: shared read=7793 dirtied=267
   I/O Timings: read=7686.748 write=0.000
   ->  Parallel Seq Scan on public.snippet_repositories  (cost=0.00..33598.84 rows=20 width=189) (actual time=3186.417..3186.418 rows=0 loops=3)
         Filter: ((snippet_repositories.disk_path)::text ~~* '%@snippets/f5/ca/f5ca38f748a1d6eaf726b8a42fb575c3c71f1864a8143301782de13da2d9202b%'::text)
         Rows Removed by Filter: 154483
         Buffers: shared read=7793 dirtied=267
         I/O Timings: read=7686.748 write=0.000

Statistics:

Time: 3.213 s  
  - planning: 3.914 ms  
  - execution: 3.209 s  
    - I/O read: 7.687 s  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 0 from the buffer pool  
  - reads: 7793 (~60.90 MiB) from the OS file cache, including disk I/O  
  - dirtied: 267 (~2.10 MiB)  
  - writes: 0  

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #364722 (closed) and #411770

Edited by Javiera Tapia

Merge request reports