Skip to content

Analyze partitioned tables without verbose

Marius Bobin requested to merge mb-analyze-partitioned-tables into master

What does this MR do and why?

I think this option is more distracting than useful and not all current commands use it. This will only increase with more partitioned tables.

Screenshots or screen recordings

Before

marius@rocket-sled ~/W/g/gitlab (master)> ./scripts/regenerate-schema
$ bin/rails db:drop RAILS_ENV=test
Dropped database 'gitlabhq_test'
Dropped database 'gitlabhq_test_ci'
$ git merge-base master HEAD
1916f512ab872a797029a68ad2b84d722b48499f

$ git checkout 1916f512ab872a797029a68ad2b84d722b48499f -- db/structure.sql

$ git reset -- db/structure.sql

$ git ls-files --others --exclude-standard -- db/schema_migrations/

$ git diff --name-only --diff-filter=A 1916f512ab872a797029a68ad2b84d722b48499f -- db/schema_migrations/

$ bin/spring stop
Spring is not running

$ bin/rails db:setup RAILS_ENV=test
Created database 'gitlabhq_test'
Created database 'gitlabhq_test_ci'
INFO:  analyzing "public.p_ci_runner_machine_builds" inheritance tree
INFO:  analyzing "gitlab_partitions_dynamic.ci_runner_machine_builds_100"
INFO:  "ci_runner_machine_builds_100": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_runner_machine_builds_101"
INFO:  "ci_runner_machine_builds_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_job_annotations" inheritance tree
INFO:  analyzing "gitlab_partitions_dynamic.ci_job_annotations_100"
INFO:  "ci_job_annotations_100": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_job_annotations_101"
INFO:  "ci_job_annotations_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_builds_metadata" inheritance tree
INFO:  analyzing "public.ci_builds_metadata"
INFO:  "ci_builds_metadata": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_builds_metadata_101"
INFO:  "ci_builds_metadata_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_pipeline_variables" inheritance tree
INFO:  analyzing "public.ci_pipeline_variables"
INFO:  "ci_pipeline_variables": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_builds" inheritance tree
INFO:  analyzing "public.ci_builds"
INFO:  "ci_builds": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_builds_101"
INFO:  "ci_builds_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_runner_machine_builds" inheritance tree
INFO:  analyzing "gitlab_partitions_dynamic.ci_runner_machine_builds_100"
INFO:  "ci_runner_machine_builds_100": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_runner_machine_builds_101"
INFO:  "ci_runner_machine_builds_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_job_annotations" inheritance tree
INFO:  analyzing "gitlab_partitions_dynamic.ci_job_annotations_100"
INFO:  "ci_job_annotations_100": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_job_annotations_101"
INFO:  "ci_job_annotations_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_builds_metadata" inheritance tree
INFO:  analyzing "public.ci_builds_metadata"
INFO:  "ci_builds_metadata": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_builds_metadata_101"
INFO:  "ci_builds_metadata_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_pipeline_variables" inheritance tree
INFO:  analyzing "public.ci_pipeline_variables"
INFO:  "ci_pipeline_variables": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "public.p_ci_builds" inheritance tree
INFO:  analyzing "public.ci_builds"
INFO:  "ci_builds": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
INFO:  analyzing "gitlab_partitions_dynamic.ci_builds_101"
INFO:  "ci_builds_101": scanned 0 of 0 pages, containing 0 live rows and 0 dead rows; 0 rows in sample, 0 estimated total rows
$ bin/rails db:migrate RAILS_ENV=test
$ bin/rails db:schema:dump RAILS_ENV=test

After

marius@rocket-sled ~/W/g/gitlab (master)> ./scripts/regenerate-schema
$ bin/rails db:drop RAILS_ENV=test
Dropped database 'gitlabhq_test'
Dropped database 'gitlabhq_test_ci'
$ git merge-base master HEAD
1916f512ab872a797029a68ad2b84d722b48499f

$ git checkout 1916f512ab872a797029a68ad2b84d722b48499f -- db/structure.sql

$ git reset -- db/structure.sql
Unstaged changes after reset:
M       lib/gitlab/database/partitioning/partition_manager.rb

$ git ls-files --others --exclude-standard -- db/schema_migrations/

$ git diff --name-only --diff-filter=A 1916f512ab872a797029a68ad2b84d722b48499f -- db/schema_migrations/

$ bin/spring stop
Spring is not running

$ bin/rails db:setup RAILS_ENV=test
Created database 'gitlabhq_test'
Created database 'gitlabhq_test_ci'
$ bin/rails db:migrate RAILS_ENV=test
$ bin/rails db:schema:dump RAILS_ENV=test

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Marius Bobin

Merge request reports