Skip to content

Geo - Support filtering terraform state versions 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 terraform state version registries by keyword (fuzzy_search) via GraphQL:

Registries Searchable attributes
Terraform State Versions File

Database

Raw SQL and query plans

Using:

Terraform::StateVersion.search('GitLab')

Then:

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/15149/commands/52610

SELECT
    terraform_state_versions.*
FROM
    terraform_state_versions
WHERE
    terraform_state_versions.file = '14.tfstate'
LIMIT 1000;

Query plan:

 Limit  (cost=0.00..6687.47 rows=1000 width=157) (actual time=0.012..20.867 rows=1000 loops=1)
   Buffers: shared hit=1356
   I/O Timings: read=0.000 write=0.000
   ->  Seq Scan on public.terraform_state_versions  (cost=0.00..152113.29 rows=22746 width=157) (actual time=0.010..20.763 rows=1000 loops=1)
         Filter: (terraform_state_versions.file = '14.tfstate'::text)
         Rows Removed by Filter: 104365
         Buffers: shared hit=1356
         I/O Timings: read=0.000 write=0.000

Statistics:

Time: 22.142 ms  
  - planning: 1.170 ms  
  - execution: 20.972 ms  
    - I/O read: 0.000 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 1356 (~10.60 MiB) from the buffer pool  
  - reads: 0 from the OS file cache, including disk I/O  
  - dirtied: 0  
  - 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

Loading