Add graphql support for tf version replication
What does this MR do?
Adds graphql endpoints for the terraform state version geo replicable.
This code puts it behind a feature flag automatically as a part of the self service framework, so no Changelog is included. There will be a changelog as a part of the final merge request that also enables the feature, also there was a database changelog for this work in a prior merge request.
Database
Since terraform_state_version_registry
doesn't exist on the primary (it's in the geo secondary tracking database), so you won't be able to run an explain on this in #database-lab
At any rate, here's the added query:
SELECT "terraform_state_version_registry".* FROM "terraform_state_version_registry" ORDER BY "terraform_state_version_registry"."id" ASC
And here's an explain plan I ran locally:
Index Scan using terraform_state_version_registry_pkey on terraform_state_version_registry (cost=0.15..55.85 rows=780 width=76)
And if :ids
are provided in params
(example was 10, 100, and 1000 because I'm lazy):
SELECT "terraform_state_version_registry".* FROM "terraform_state_version_registry" WHERE "terraform_state_version_registry"."id" IN (10, 100, 1000) ORDER BY "terraform_state_version_registry"."id" ASC
And I guess this is the explain for that (also local):
Sort (cost=11.61..11.62 rows=3 width=76)
Sort Key: id
-> Bitmap Heap Scan on terraform_state_version_registry (cost=4.47..11.58 rows=3 width=76)
Recheck Cond: (id = ANY ('{10,100,1000}'::bigint[]))
-> Bitmap Index Scan on terraform_state_version_registry_pkey (cost=0.00..4.47 rows=3 width=0)
Index Cond: (id = ANY ('{10,100,1000}'::bigint[]))
This query is additionally constrained through the connection type, so no need to worry about unlimited power here! For a discussion on this, take a look here - !40317 (comment 404821071)
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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
Fixes #237928 (closed)