Introduce Ci::PartitioningAnalyzer
Ref: #372598 (closed)
What does this MR do and why?
This MR introduces Ci::PartitioningAnalyzer
class.
This analyzer will be used to detect queries not going through a partitioning routing table. This will help us to identify queries needed to be changed once we start using partitioning tables.
Once we will enable it, it will start raising error as below
Failure/Error: raise RoutingTableNotUsedError, "Detected non-partitioned table use #{detected.inspect}: #{parsed.sql}"
Gitlab::Database::QueryAnalyzers::Ci::PartitioningAnalyzer::RoutingTableNotUsedError:
Detected non-partitioned table use ["ci_pipelines"]: SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."project_id" = $1 AND "ci_pipelines"."id" = $2 LIMIT $3 /*application:test,correlation_id:6c4800d8-3e85-491d-867b-74c3bcf33e70,endpoint_id:GET /api/:version/projects/:id/pipelines/:pipeline_id,db_config_name:ci,line:/lib/api/ci/pipelines.rb:259:in `block in pipeline'*/
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Max Orefice