diff --git a/db/database_connections/ci.yaml b/db/database_connections/ci.yaml index 212b053a98a7c929c061360f1d79e23e4d75a43f..4a5c2f26d951f53ce70b53360f2bb7ba19feb377 100644 --- a/db/database_connections/ci.yaml +++ b/db/database_connections/ci.yaml @@ -4,10 +4,12 @@ gitlab_schemas: - gitlab_internal - gitlab_shared - gitlab_ci + - gitlab_ci_cell_local lock_gitlab_schemas: - gitlab_main - gitlab_main_clusterwide - gitlab_main_cell + - gitlab_main_cell_local - gitlab_pm - gitlab_sec klass: Ci::ApplicationRecord diff --git a/db/database_connections/main.yaml b/db/database_connections/main.yaml index 62290046f9c59f70094cc84fa9185e596f439918..e2184b73ce2dabe71e918a7b97ad735260fe8e0a 100644 --- a/db/database_connections/main.yaml +++ b/db/database_connections/main.yaml @@ -5,10 +5,12 @@ gitlab_schemas: - gitlab_shared - gitlab_main - gitlab_main_cell + - gitlab_main_cell_local - gitlab_pm - gitlab_main_clusterwide lock_gitlab_schemas: - gitlab_ci + - gitlab_ci_cell_local - gitlab_sec # Note that we use ActiveRecord::Base here and not ApplicationRecord. # This is deliberate, as: diff --git a/db/database_connections/sec.yaml b/db/database_connections/sec.yaml index a758d4e852bcebc05502f2a1bc8da9b9bd71847b..1bc50bd46e6dfca5ed4d1ee28085fbc70455ab08 100644 --- a/db/database_connections/sec.yaml +++ b/db/database_connections/sec.yaml @@ -8,7 +8,9 @@ lock_gitlab_schemas: - gitlab_main - gitlab_main_clusterwide - gitlab_main_cell + - gitlab_main_cell_local - gitlab_ci + - gitlab_ci_cell_local - gitlab_pm klass: Gitlab::Database::SecApplicationRecord # if Sec database is not configured, use this database diff --git a/db/docs/analytics_usage_trends_measurements.yml b/db/docs/analytics_usage_trends_measurements.yml index 683e798280223d3796c58d169e94cbbfff6b5e2a..5ba8cc951e25a5f4f1ebe5232efb98e83e743e04 100644 --- a/db/docs/analytics_usage_trends_measurements.yml +++ b/db/docs/analytics_usage_trends_measurements.yml @@ -7,7 +7,6 @@ feature_categories: description: Contains periodically snapshotted database record counts. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62797 milestone: '14.0' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Cell local table storing instance level-aggregations table_size: small diff --git a/db/docs/approvers.yml b/db/docs/approvers.yml index a0b2e8f82253ddd8d29beb30f7a9f03f84a44195..700d96d791d7e9a8c44e9fcb781ad46463f0b780 100644 --- a/db/docs/approvers.yml +++ b/db/docs/approvers.yml @@ -7,7 +7,6 @@ feature_categories: description: Approvers of given merge request introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/3cc78d89984d9c9df8372c52b7bba38e6226f9f2 milestone: '7.13' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Marked for drop - https://gitlab.com/gitlab-org/gitlab/-/issues/444234 table_size: small diff --git a/db/docs/ci_cost_settings.yml b/db/docs/ci_cost_settings.yml index 421742ab7ca1c4e314c3c2ea3a58877854370f72..4425654af895b9c3bf7b6fd8236b098cbf3cfa27 100644 --- a/db/docs/ci_cost_settings.yml +++ b/db/docs/ci_cost_settings.yml @@ -8,7 +8,6 @@ description: A set of cost factors per runner which are applied to ci job durati based on project type. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111977 milestone: '15.10' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local notes: Exempted because Cell-local table storing cost information for instance runners table_size: small diff --git a/db/docs/ci_hosted_runners.yml b/db/docs/ci_hosted_runners.yml index d3802cb82f412f886b4a929de32b9a1be26bb48c..4bea64d6c2b8bbd05558a196534c3d4469e1e493 100644 --- a/db/docs/ci_hosted_runners.yml +++ b/db/docs/ci_hosted_runners.yml @@ -3,10 +3,9 @@ table_name: ci_hosted_runners classes: - Ci::HostedRunner feature_categories: -- hosted_runners +- hosted_runners description: Stores dedicated hosted runners, which are instance level runners managed by GitLab introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181447 milestone: '17.10' -gitlab_schema: gitlab_ci +gitlab_schema: gitlab_ci_cell_local table_size: small -exempt_from_sharding: true # dedicated only diff --git a/db/docs/ci_instance_variables.yml b/db/docs/ci_instance_variables.yml index 4096c216aa6345ad1a8fedfc6fa5c1d92a56173c..aad93e102b5b2fdff2c2697b3ab278e8e72cb2c2 100644 --- a/db/docs/ci_instance_variables.yml +++ b/db/docs/ci_instance_variables.yml @@ -7,7 +7,6 @@ feature_categories: description: CI/CD variables available to all projects and groups in an instance. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30156 milestone: '13.0' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local notes: Exempted because table not used in .com nor Cells. table_size: small diff --git a/db/docs/ci_partitions.yml b/db/docs/ci_partitions.yml index 88599f86f71928c9baa012f3a8a41ca762ff5317..c68c3f282cc6f1746606888236da1b6fc3cfbcfc 100644 --- a/db/docs/ci_partitions.yml +++ b/db/docs/ci_partitions.yml @@ -7,7 +7,6 @@ feature_categories: description: Database partitioning metadata for CI tables introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96856 milestone: '15.4' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local notes: Exempted because to be leveraged via Org Mover table_size: small diff --git a/db/docs/ci_runner_taggings.yml b/db/docs/ci_runner_taggings.yml index 81747edc7da4254e31c52404d8ad87ec327e9bde..ca1991b5f22c111273187597055c7e2201cc7680 100644 --- a/db/docs/ci_runner_taggings.yml +++ b/db/docs/ci_runner_taggings.yml @@ -9,7 +9,6 @@ feature_categories: description: Routing table that holds information for runner taggings introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170778 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local sharding_key_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/467664 table_size: small diff --git a/db/docs/ci_runner_taggings_instance_type.yml b/db/docs/ci_runner_taggings_instance_type.yml index 6ef5d2b2c1ce79f1cb4a3cb2ae822f027327641a..47faadca9e3f9c5cdf085d2b8cffdb6d5e8e72b1 100644 --- a/db/docs/ci_runner_taggings_instance_type.yml +++ b/db/docs/ci_runner_taggings_instance_type.yml @@ -9,6 +9,5 @@ feature_categories: description: Table holding information for group runner taggings, partition of `ci_runner_taggings` introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170778 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small diff --git a/db/docs/ci_runner_versions.yml b/db/docs/ci_runner_versions.yml index 30136ced5d98d1d8ce8e15792310638105ec48d7..8d955ccea82af78425a18d7240b2374efe4aaaca 100644 --- a/db/docs/ci_runner_versions.yml +++ b/db/docs/ci_runner_versions.yml @@ -7,6 +7,5 @@ feature_categories: description: Information about used Ci::Runner versions introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90982 milestone: '15.2' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small diff --git a/db/docs/conversational_development_index_metrics.yml b/db/docs/conversational_development_index_metrics.yml index eda68df528ceda5c3f2870260ebfd1d2a5bd113c..556df673895f1e7f393023c002f1e7a11dc1f191 100644 --- a/db/docs/conversational_development_index_metrics.yml +++ b/db/docs/conversational_development_index_metrics.yml @@ -7,8 +7,7 @@ feature_categories: description: Contains data for calculating DevOps score. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb milestone: '9.3' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Cell local table storing instance DevOps metrics calculated from service ping table_size: small diff --git a/db/docs/country_access_logs.yml b/db/docs/country_access_logs.yml index 43edca8c5d068e7bd62d9a5885a9229931043f4d..35de81173d292cb908fbc45bbe0f846826fcf3fb 100644 --- a/db/docs/country_access_logs.yml +++ b/db/docs/country_access_logs.yml @@ -7,7 +7,6 @@ feature_categories: description: Tracks user access from specific countries. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157480 milestone: '17.2' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Not related to projects or groups table_size: small diff --git a/db/docs/deleted_tables/ci_runner_machines_687967fa8a.yml b/db/docs/deleted_tables/ci_runner_machines_687967fa8a.yml index 5a3c5f15383afa0f091e054792819004937f517c..313b7e97d8067356df7ba26c134cb6a2d9a19e33 100644 --- a/db/docs/deleted_tables/ci_runner_machines_687967fa8a.yml +++ b/db/docs/deleted_tables/ci_runner_machines_687967fa8a.yml @@ -9,8 +9,7 @@ feature_categories: description: Routing table for CI runner managers introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/168131 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182859 removed_in_milestone: '17.10' diff --git a/db/docs/deleted_tables/ci_runners_e59bb2812d.yml b/db/docs/deleted_tables/ci_runners_e59bb2812d.yml index 121e24484e6a38b255a18d0d0fa505627a6764cb..e1fbe642c3e58a8c332433885a8ec70a3e1aa318 100644 --- a/db/docs/deleted_tables/ci_runners_e59bb2812d.yml +++ b/db/docs/deleted_tables/ci_runners_e59bb2812d.yml @@ -9,8 +9,7 @@ feature_categories: description: Routing table for CI runners introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166308 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182549 removed_in_milestone: '17.10' diff --git a/db/docs/deleted_tables/instance_type_ci_runner_machines_687967fa8a.yml b/db/docs/deleted_tables/instance_type_ci_runner_machines_687967fa8a.yml index b84afee85e1a6bbc84e7303c8f3f2f89161f4142..a923a21fa5166f63f64879d8de2f3c3a108a6e47 100644 --- a/db/docs/deleted_tables/instance_type_ci_runner_machines_687967fa8a.yml +++ b/db/docs/deleted_tables/instance_type_ci_runner_machines_687967fa8a.yml @@ -9,8 +9,7 @@ feature_categories: description: Information about runner managers associated to instance Ci::Runner models introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/168131 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182859 removed_in_milestone: '17.10' diff --git a/db/docs/deleted_tables/instance_type_ci_runners_e59bb2812d.yml b/db/docs/deleted_tables/instance_type_ci_runners_e59bb2812d.yml index 9d7ad467575e0a7c27bacfb50041981271b7c0a2..121e5818247d5a5d07bc142868434eae275aa64c 100644 --- a/db/docs/deleted_tables/instance_type_ci_runners_e59bb2812d.yml +++ b/db/docs/deleted_tables/instance_type_ci_runners_e59bb2812d.yml @@ -9,8 +9,7 @@ feature_categories: description: Registered CI instance runners introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166308 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/182549 removed_in_milestone: '17.10' diff --git a/db/docs/deleted_tables/pm_epss.yml b/db/docs/deleted_tables/pm_epss.yml index f6ec236432d04f07aad89c76cc01f567f63c5617..77a0902ec3f947f6748369b540c5adeba5e82045 100644 --- a/db/docs/deleted_tables/pm_epss.yml +++ b/db/docs/deleted_tables/pm_epss.yml @@ -10,5 +10,4 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158908 removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/168288 milestone: '17.3' gitlab_schema: gitlab_sec -exempt_from_sharding: true # See discussion on keys for pm_ tables https://gitlab.com/gitlab-org/gitlab/-/issues/434988#note_1827421068 removed_in_milestone: '17.6' diff --git a/db/docs/deleted_tables/search_indices.yml b/db/docs/deleted_tables/search_indices.yml index c3202d792b2e4ec765065d13cd8c1293c9c74fe1..bc058ce5851b24b47ed8743a9821b5f58a0735bf 100644 --- a/db/docs/deleted_tables/search_indices.yml +++ b/db/docs/deleted_tables/search_indices.yml @@ -9,6 +9,5 @@ description: Represents an Advanced Search index introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113612/ milestone: '15.11' gitlab_schema: gitlab_main_cell -exempt_from_sharding: true removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170242 removed_in_milestone: '17.6' diff --git a/db/docs/deleted_tables/zoekt_shards.yml b/db/docs/deleted_tables/zoekt_shards.yml index 7f39ddb0089ba61f93e1f153c1709e58dd708af2..92f0c3f9742c563fea7f35d4479d46a749f0d01c 100644 --- a/db/docs/deleted_tables/zoekt_shards.yml +++ b/db/docs/deleted_tables/zoekt_shards.yml @@ -8,6 +8,5 @@ description: Describes a Zoekt server that will be used for indexing and search introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/105049 milestone: '15.9' gitlab_schema: gitlab_main_cell -exempt_from_sharding: true # table scheduled for deletion https://gitlab.com/gitlab-org/gitlab/-/issues/473263 removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167720 removed_in_milestone: '17.5' diff --git a/db/docs/elastic_index_settings.yml b/db/docs/elastic_index_settings.yml index 38f519681b122e63a09cbdf39d7cedeba4204746..4815f7c964e910dacf7acee3b1757b5ca65c0b81 100644 --- a/db/docs/elastic_index_settings.yml +++ b/db/docs/elastic_index_settings.yml @@ -8,8 +8,7 @@ description: Describes the settings (such as number of shards and replicas) for Elasticsearch or Opensearch index introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56344 milestone: '13.11' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because data is specific to each cell's Elasticsearch cluster, no customer data table_size: small diff --git a/db/docs/elastic_reindexing_slices.yml b/db/docs/elastic_reindexing_slices.yml index f91669d6b568d59e85d603985348e98a95e530cd..0a4a5c1db590320c7439df739e2106fb98013b22 100644 --- a/db/docs/elastic_reindexing_slices.yml +++ b/db/docs/elastic_reindexing_slices.yml @@ -8,8 +8,7 @@ description: Used to track status of Zero downtime reindexing tasks in Elasticse or OpenSearch introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55681 milestone: '13.12' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because data is specific to each cell's Elasticsearch cluster, no customer data table_size: small diff --git a/db/docs/elastic_reindexing_subtasks.yml b/db/docs/elastic_reindexing_subtasks.yml index b98e8dba1c058ddd1816b5cbf2eb3be2deb7c439..f471e2e1bfd7b34f7a1df4857caedb72b860d19b 100644 --- a/db/docs/elastic_reindexing_subtasks.yml +++ b/db/docs/elastic_reindexing_subtasks.yml @@ -7,8 +7,7 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48334 milestone: '13.8' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because data is specific to each cell's Elasticsearch cluster, no customer data table_size: small diff --git a/db/docs/elastic_reindexing_tasks.yml b/db/docs/elastic_reindexing_tasks.yml index 084e94dac122fcbb791e091dfcaddad6369d4392..8deb26e23478f35b377e2261988c712f019b8139 100644 --- a/db/docs/elastic_reindexing_tasks.yml +++ b/db/docs/elastic_reindexing_tasks.yml @@ -7,8 +7,7 @@ feature_categories: description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34069 milestone: '13.2' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because data is specific to each cell's Elasticsearch cluster, no customer data table_size: small diff --git a/db/docs/feature_gates.yml b/db/docs/feature_gates.yml index d8b8bebc42f7ab1533b615fa22e677e3feba8e69..fb60a072c45282b2dd71114904223aa3fc9620bf 100644 --- a/db/docs/feature_gates.yml +++ b/db/docs/feature_gates.yml @@ -8,6 +8,5 @@ feature_categories: description: https://docs.gitlab.com/ee/development/feature_flags/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/671284ba375109becbfa2a288032cdc7301b157b milestone: '9.3' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/features.yml b/db/docs/features.yml index 695ff97411a506cdc1fcbd59c26a40d780bbcd11..49c73b635d96cb7571b44bd812ba4ef7723ac452 100644 --- a/db/docs/features.yml +++ b/db/docs/features.yml @@ -8,6 +8,5 @@ feature_categories: description: https://docs.gitlab.com/ee/development/feature_flags/ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/ee2d3de1a634611a1c660516c955be0d3000904b milestone: '8.12' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/geo_cache_invalidation_events.yml b/db/docs/geo_cache_invalidation_events.yml index 87dfe43e9b9234969f8f1b732fb064dd09ad32bb..cf4725466c555aabd2a0fe03afd596188f275d22 100644 --- a/db/docs/geo_cache_invalidation_events.yml +++ b/db/docs/geo_cache_invalidation_events.yml @@ -8,7 +8,6 @@ description: Geo event to process feature flag toggles instantly on a secondary invalidating the cache, belongs to geo_event_log. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/7738 milestone: '11.4' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Not org-specific table_size: small diff --git a/db/docs/geo_event_log.yml b/db/docs/geo_event_log.yml index 93570409a558aedb7b7a80db46c47b33bb54204c..d125ed785618a72870c115f455e4bc2d9f585820 100644 --- a/db/docs/geo_event_log.yml +++ b/db/docs/geo_event_log.yml @@ -8,8 +8,7 @@ description: Log of all events that a Geo secondary can process. Parsed/watched streaming replication on all secondaries. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/cb6c7cbe2a9ee05cea6926e3d8c18f6aa26f4c64 milestone: '9.3' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: This table is a log of all events that occur on a primary Geo node/site, which a secondary might be interested in. table_size: small diff --git a/db/docs/geo_events.yml b/db/docs/geo_events.yml index ef4b7288f73680f9a70c6f059fe858446daf833c..11e073428ab2b7e0a547889ccfaea589ae641a97 100644 --- a/db/docs/geo_events.yml +++ b/db/docs/geo_events.yml @@ -8,6 +8,5 @@ description: Geo events implemented generically, used by the SSF where all objec types can generate an event to be processed by the secondary sites. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23447 milestone: '12.8' -gitlab_schema: gitlab_main_cell +gitlab_schema: gitlab_main_cell_local table_size: small -exempt_from_sharding: true diff --git a/db/docs/geo_node_namespace_links.yml b/db/docs/geo_node_namespace_links.yml index 2ee8ed7cd6ff2d5625677f8e179e688b84ba6a9a..763cb7ee72b5e262a3f20214ddff7cf1daddf0df 100644 --- a/db/docs/geo_node_namespace_links.yml +++ b/db/docs/geo_node_namespace_links.yml @@ -7,6 +7,5 @@ feature_categories: description: Passthrough table for geo_nodes many-to-many namespaces relation. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/14c6128530579ca92fa79342d4119d25bcff1f2d milestone: '9.5' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/geo_node_statuses.yml b/db/docs/geo_node_statuses.yml index 298ce2a870372aa30e4a6e6aee57d4e82cde1dca..50dcc41140f1c709b3eb1e7a6283cc60ab172814 100644 --- a/db/docs/geo_node_statuses.yml +++ b/db/docs/geo_node_statuses.yml @@ -8,8 +8,7 @@ description: Contains sites status and metadata for each Geo site, updated async a scheduled worker. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3230 milestone: '10.2' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Geo nodes are an infrastructure-level concern, and are not org-specific. table_size: small diff --git a/db/docs/geo_nodes.yml b/db/docs/geo_nodes.yml index 2eb4c2a04ce71c4f57a5cfe419f3b4eb501bae8d..467cb5bfa9b0677bb86fedf94db9c43da9db3f6c 100644 --- a/db/docs/geo_nodes.yml +++ b/db/docs/geo_nodes.yml @@ -7,8 +7,7 @@ feature_categories: description: Contains Geo sites configuration data and settings. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/5ab12ad02ed753dd933485094ba45512890f0b50 milestone: '8.5' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local notes: Exempted because Geo nodes are an infrastructure-level concern, and are not org-specific. table_size: small diff --git a/db/docs/instance_type_ci_runners.yml b/db/docs/instance_type_ci_runners.yml index 12102fbacddf6f35ff5f2fe767e4e4bba43243e5..1ac608f2ae2bc0714093616bccbc8909056b9b00 100644 --- a/db/docs/instance_type_ci_runners.yml +++ b/db/docs/instance_type_ci_runners.yml @@ -9,6 +9,5 @@ feature_categories: description: Registered CI instance runners introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166308 milestone: '17.6' -gitlab_schema: gitlab_ci -exempt_from_sharding: true +gitlab_schema: gitlab_ci_cell_local table_size: small diff --git a/db/docs/pipl_users.yml b/db/docs/pipl_users.yml index 23156535e29af2b57ad46406e422ee026ee8019f..75dcc4865418984a9f733053da2806dc1f812452 100644 --- a/db/docs/pipl_users.yml +++ b/db/docs/pipl_users.yml @@ -7,7 +7,5 @@ feature_categories: description: Stores user accesses and notifications from PIPL countries introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169769 milestone: '17.6' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true -notes: Exempted because Not related to projects or groups +gitlab_schema: gitlab_main_clusterwide table_size: small diff --git a/db/docs/shards.yml b/db/docs/shards.yml index 971cf321708b03f8be52910e7679b2ce0134e5b5..84ff9e11c6eb3ae6de6a70e83f59c9fd690d2105 100644 --- a/db/docs/shards.yml +++ b/db/docs/shards.yml @@ -7,6 +7,5 @@ feature_categories: description: Holds name of a shard where a bunch of repositories are stored. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/f760c1cd17881c8aef3a33a3b43db54673db8111 milestone: '10.5' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/system_access_instance_microsoft_applications.yml b/db/docs/system_access_instance_microsoft_applications.yml index f5114f493276b10269ab886e09fb15460753651d..0102945a9da7f0b035de026694ad385b2ea38f9c 100644 --- a/db/docs/system_access_instance_microsoft_applications.yml +++ b/db/docs/system_access_instance_microsoft_applications.yml @@ -6,6 +6,5 @@ feature_categories: - system_access description: Integration with Microsoft Azure application for self-managed milestone: 17.5 -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/system_access_instance_microsoft_graph_access_tokens.yml b/db/docs/system_access_instance_microsoft_graph_access_tokens.yml index 54495e213b38c6b7935b2be32ba14fd9cc01f11d..890af2bf49fd5270cf95ca8f49a1b4b769505ee5 100644 --- a/db/docs/system_access_instance_microsoft_graph_access_tokens.yml +++ b/db/docs/system_access_instance_microsoft_graph_access_tokens.yml @@ -6,6 +6,5 @@ classes: - SystemAccess::InstanceMicrosoftGraphAccessToken description: Access tokens for the Microsoft Graph API for self-managed milestone: '17.5' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/system_access_microsoft_applications.yml b/db/docs/system_access_microsoft_applications.yml index d2b09bc0a20522884532b247cab48cb5cdde9121..4f15c1ead8e0fb5b4ad2be56cf86e5ce1fa80c14 100644 --- a/db/docs/system_access_microsoft_applications.yml +++ b/db/docs/system_access_microsoft_applications.yml @@ -7,6 +7,5 @@ feature_categories: description: Integration with Microsoft Azure application introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124101 milestone: '16.2' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/system_access_microsoft_graph_access_tokens.yml b/db/docs/system_access_microsoft_graph_access_tokens.yml index c1bdb0ed8ba3697be5c8b9dc18d5ba4c7df00935..40a65275c9a9fd961a80b950e3b8d6d603ff579d 100644 --- a/db/docs/system_access_microsoft_graph_access_tokens.yml +++ b/db/docs/system_access_microsoft_graph_access_tokens.yml @@ -7,6 +7,5 @@ feature_categories: description: Access tokens for the Microsoft Graph API introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124101 milestone: '16.2' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true -table_size: small \ No newline at end of file +gitlab_schema: gitlab_main_cell_local +table_size: small diff --git a/db/docs/zoekt_indices.yml b/db/docs/zoekt_indices.yml index 49257f6bb2a919aea0888a7611a10b7b6ab8507c..0e3fda1cc52d692fffaabdf0f5437d6855ae8707 100644 --- a/db/docs/zoekt_indices.yml +++ b/db/docs/zoekt_indices.yml @@ -7,6 +7,5 @@ feature_categories: description: Represents a zoekt index for a root namespace introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138992 milestone: '16.8' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/zoekt_nodes.yml b/db/docs/zoekt_nodes.yml index 55611f191c3e7555139d38fda368398eecd6544a..d494f30a46ebf3a5cde18b094bb12f0a20af3582 100644 --- a/db/docs/zoekt_nodes.yml +++ b/db/docs/zoekt_nodes.yml @@ -8,6 +8,5 @@ description: Describes a Zoekt server that will be used for indexing and search some configured namespaces introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134901 milestone: '16.6' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/zoekt_replicas.yml b/db/docs/zoekt_replicas.yml index 891a94dac682d42960b960bdf3e9eae72bbe17a0..ad76ea56235c04376adc3e5b7a6625076c504c8c 100644 --- a/db/docs/zoekt_replicas.yml +++ b/db/docs/zoekt_replicas.yml @@ -7,7 +7,5 @@ feature_categories: description: Represents a zoekt replica for a root namespace introduced_by_url: milestone: '17.2' -gitlab_schema: gitlab_main_cell -sharding_key: - namespace_id: namespaces +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/docs/zoekt_repositories.yml b/db/docs/zoekt_repositories.yml index 22517142c3a7dab6f3e1535dbbcdd0de3ad747cc..8e4160f77ed357fb6d06df1e733056cbb2561685 100644 --- a/db/docs/zoekt_repositories.yml +++ b/db/docs/zoekt_repositories.yml @@ -7,6 +7,5 @@ feature_categories: description: Represents a zoekt repository introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141864 milestone: '16.9' -gitlab_schema: gitlab_main_cell -exempt_from_sharding: true +gitlab_schema: gitlab_main_cell_local table_size: small diff --git a/db/gitlab_schemas/gitlab_ci.yaml b/db/gitlab_schemas/gitlab_ci.yaml index affd441d195750d70531a89b31fa147ff81c1e73..6ede3a5de771f7d30dda516146d00418c261d3df 100644 --- a/db/gitlab_schemas/gitlab_ci.yaml +++ b/db/gitlab_schemas/gitlab_ci.yaml @@ -1,5 +1,5 @@ name: gitlab_ci -description: Schema for all Cell-local CI tables, ex. ci_builds, etc. +description: Schema for all Organizational CI tables, ex. ci_builds, etc. allow_cross_joins: - gitlab_shared allow_cross_transactions: diff --git a/db/gitlab_schemas/gitlab_ci_cell_local.yaml b/db/gitlab_schemas/gitlab_ci_cell_local.yaml new file mode 100644 index 0000000000000000000000000000000000000000..da59ab52adab538cc8e752dad574f3c0408b8602 --- /dev/null +++ b/db/gitlab_schemas/gitlab_ci_cell_local.yaml @@ -0,0 +1,10 @@ +name: gitlab_ci_cell_local +description: Schema for all Cell-local CI tables, ex. ci_cost_settings, etc. +allow_cross_joins: + - gitlab_shared + - gitlab_ci +allow_cross_transactions: + - gitlab_internal + - gitlab_shared + - gitlab_ci +require_sharding_key: false diff --git a/db/gitlab_schemas/gitlab_main.yaml b/db/gitlab_schemas/gitlab_main.yaml index 616f2bffd4ff50c64bd3ec163a65f338fe00185f..a282de73b8fb48223abefb8fefefc3302c5c0da0 100644 --- a/db/gitlab_schemas/gitlab_main.yaml +++ b/db/gitlab_schemas/gitlab_main.yaml @@ -1,5 +1,5 @@ name: gitlab_main -description: Legacy schema for all Cell-local tables, ex. projects, issues, etc. +description: Legacy schema for all unclassified tables. allow_cross_joins: - gitlab_shared allow_cross_transactions: diff --git a/db/gitlab_schemas/gitlab_main_cell.yaml b/db/gitlab_schemas/gitlab_main_cell.yaml index 74df2ec2d3835c73fca039bc112334045d3596bd..65a8230f67c01653f9e1b63cf0da8331df3d473d 100644 --- a/db/gitlab_schemas/gitlab_main_cell.yaml +++ b/db/gitlab_schemas/gitlab_main_cell.yaml @@ -1,14 +1,16 @@ name: gitlab_main_cell -description: Schema for all Cell-local tables, ex. namespaces, projects, etc. +description: Schema for all Organization tables, ex. namespaces, projects, etc. allow_cross_joins: - gitlab_shared - gitlab_main - gitlab_main_clusterwide + - gitlab_main_cell_local allow_cross_transactions: - gitlab_internal - gitlab_shared - gitlab_main - gitlab_main_clusterwide + - gitlab_main_cell_local allow_cross_foreign_keys: - gitlab_main - gitlab_main_clusterwide diff --git a/db/gitlab_schemas/gitlab_main_cell_local.yaml b/db/gitlab_schemas/gitlab_main_cell_local.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2099719091671b541156db2e67f04fc0eb9cf1fb --- /dev/null +++ b/db/gitlab_schemas/gitlab_main_cell_local.yaml @@ -0,0 +1,14 @@ +name: gitlab_main_cell_local +description: Schema for all Cell-local tables, ex. zoekt_nodes, geo_nodes. +allow_cross_joins: + - gitlab_shared + - gitlab_main + - gitlab_main_clusterwide + - gitlab_main_cell +allow_cross_transactions: + - gitlab_internal + - gitlab_shared + - gitlab_main + - gitlab_main_clusterwide + - gitlab_main_cell +require_sharding_key: false diff --git a/db/gitlab_schemas/gitlab_main_clusterwide.yaml b/db/gitlab_schemas/gitlab_main_clusterwide.yaml index 2ba0d85119f4417841b0c9b82679b124ca07bc02..310d0dcab258df25ffa0461de20b5b7b44e4f0ef 100644 --- a/db/gitlab_schemas/gitlab_main_clusterwide.yaml +++ b/db/gitlab_schemas/gitlab_main_clusterwide.yaml @@ -4,11 +4,13 @@ allow_cross_joins: - gitlab_shared - gitlab_main - gitlab_main_cell + - gitlab_main_cell_local allow_cross_transactions: - gitlab_internal - gitlab_shared - gitlab_main - gitlab_main_cell + - gitlab_main_cell_local allow_cross_foreign_keys: - gitlab_main - gitlab_main_cell diff --git a/doc/development/cells/_index.md b/doc/development/cells/_index.md index a53be707678f6bedf1996e75ac29e81f57c8754b..f37fd17ea43b20c929410f4f6f99621c0d8d2c06 100644 --- a/doc/development/cells/_index.md +++ b/doc/development/cells/_index.md @@ -9,7 +9,7 @@ For background of GitLab Cells, refer to the [design document](https://handbook. ## Choose either the `gitlab_main_cell` or `gitlab_main_clusterwide` schema -Depending on the use case, your feature may be [cell-local or clusterwide](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/#how-do-i-decide-whether-to-move-my-feature-to-the-cluster-cell-or-organization-level) and hence the tables used for the feature should also use the appropriate schema. +Depending on the use case, your feature may be [organization-level, or clusterwide](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/#how-do-i-decide-whether-to-move-my-feature-to-the-cluster-cell-or-organization-level) and hence the tables used for the feature should also use the appropriate schema. When you choose the appropriate [schema](../database/multiple_databases.md#gitlab-schema) for tables, consider the following guidelines as part of the [Cells](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/) architecture: @@ -31,15 +31,15 @@ After a schema has been assigned, the merge request pipeline might fail due to o - [Cross-database transactions](../database/multiple_databases.md#fixing-cross-database-transactions) - [Cross-database foreign keys](../database/multiple_databases.md#foreign-keys-that-cross-databases) -## Defining a sharding key for all cell-local tables +## Defining a sharding key for all organizational tables -All tables with the following `gitlab_schema` are considered "cell-local": +All tables with the following `gitlab_schema` are considered organization level: - `gitlab_main_cell` - `gitlab_ci` - `gitlab_sec` -All newly created cell-local tables are required to have a `sharding_key` +All newly created organization-level tables are required to have a `sharding_key` defined in the corresponding `db/docs/` file for that table. The purpose of the sharding key is documented in the diff --git a/doc/development/database/multiple_databases.md b/doc/development/database/multiple_databases.md index 41c836361d88a05153dbb49977d24dfd2185d589..997effaea287019841ad43c0afe22b57beaf28cc 100644 --- a/doc/development/database/multiple_databases.md +++ b/doc/development/database/multiple_databases.md @@ -29,7 +29,9 @@ Each table of GitLab needs to have a `gitlab_schema` assigned: | -------- | ----------- | ------- | | `gitlab_main`| All tables that are being stored in the `main:` database. | Currently, this is being replaced with `gitlab_main_cell`, for the purpose of building the [Cells](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/) architecture. `gitlab_main_cell` schema describes all tables that are local to a cell in a GitLab installation. For example, `projects` and `groups` | | `gitlab_main_clusterwide` | All tables where all rows, or a subset of rows needs to be present across the cluster, in the [Cells](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/) architecture. For example, `users` and `application_settings`.| For the [Cells 1.0 architecture](https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/cells/iterations/cells-1.0/), there are no real clusterwide tables as each cell will have its own database. In effect, these tables will still be stored locally in each cell. | +| `gitlab_main_cell_local` | For tables in the `main:` database that are related to features that is distinct for each cell. For example, `zoekt_nodes`, or `shards`. | These cell-local tables should not have any foreign key references from/to organization tables. | | `gitlab_ci` | All CI tables that are being stored in the `ci:` database (for example, `ci_pipelines`, `ci_builds`) | | +| `gitlab_ci_cell_local` | For tables in the `ci:` database that are related to features that is distinct for each cell. For example, `zoekt_nodes`, or `shards`. | These cell-local tables should not have any foreign key references from/to organization tables. | | `gitlab_geo` | All Geo tables that are being stored in the `geo:` database (for example, like `project_registry`, `secondary_usage_data`) | | | `gitlab_shared` | All application tables that contain data across all decomposed databases (for example, `loose_foreign_keys_deleted_records`) for models that inherit from `Gitlab::Database::SharedModel`. | | | `gitlab_internal` | All internal tables of Rails and PostgreSQL (for example, `ar_internal_metadata`, `schema_migrations`, `pg_*`) | | @@ -55,7 +57,7 @@ This content has been moved to a ### Defining a sharding key for all cell-local tables This content has been moved to a -[new location](../cells/_index.md#defining-a-sharding-key-for-all-cell-local-tables) +[new location](../cells/_index.md#defining-a-sharding-key-for-all-organizational-tables) ### The impact of `gitlab_schema` diff --git a/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb b/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb index 353b2642a4dea73c13a6b5000967f0a424384bda..374fc41c99b765db25ba1eb4ae17eec77bfa964d 100644 --- a/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb +++ b/lib/gitlab/database/query_analyzers/restrict_allowed_schemas.rb @@ -18,9 +18,11 @@ class RestrictAllowedSchemas < Base gitlab_shared: nil, gitlab_internal: nil, - # Pods specific changes + # Cells specific changes gitlab_main_clusterwide: :gitlab_main, - gitlab_main_cell: :gitlab_main + gitlab_main_cell: :gitlab_main, + gitlab_main_cell_local: :gitlab_main, + gitlab_ci_cell_local: :gitlab_ci }.freeze class << self diff --git a/lib/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences.rake b/lib/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences.rake index 1ddf7c68ce15481c81fc349570fbf44f57a5fa76..7267655dd41fac429acca9578074802c7b0673fe 100644 --- a/lib/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences.rake +++ b/lib/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences.rake @@ -13,7 +13,14 @@ namespace :gitlab do exit 1 end - Gitlab::Database::BumpSequences.new(:gitlab_ci, increase_by).execute + ci_only_schemas = Gitlab::Database + .all_database_connections["main"] + .lock_gitlab_schemas + .intersection(Gitlab::Database.all_database_connections["ci"].gitlab_schemas) + + ci_only_schemas.each do |ci_schema| + Gitlab::Database::BumpSequences.new(ci_schema, increase_by).execute + end end end end diff --git a/spec/lib/gitlab/database/gitlab_schema_spec.rb b/spec/lib/gitlab/database/gitlab_schema_spec.rb index 58c3df458ae9ba21938490efb60cec0b13ad44b2..dec5ec69d4cc579dc5ab725d9a921b5deac08593 100644 --- a/spec/lib/gitlab/database/gitlab_schema_spec.rb +++ b/spec/lib/gitlab/database/gitlab_schema_spec.rb @@ -10,6 +10,21 @@ end RSpec.describe Gitlab::Database::GitlabSchema, feature_category: :database do + describe 'lock_gitlab_schemas for main and related databases' do + it 'all gitlab_schema is locked in other database_connections', :aggregate_failures do + database_connections = Gitlab::Database.all_database_connections + .select { |_, db| db.name == :main || db.fallback_database == :main } + .values + + database_connections.permutation(2) do |db, other_db| + gitlab_schemas = db.gitlab_schemas - [:gitlab_shared, :gitlab_internal] + + expect(other_db.lock_gitlab_schemas).to include(*gitlab_schemas), + "Expected `#{other_db.name}` lock_gitlab_schemas to include `#{db.name}` gitlab_schemas:" + end + end + end + shared_examples 'maps table name to table schema' do using RSpec::Parameterized::TableSyntax diff --git a/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb b/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb index e00466027e791effde81a31c53a300bfbdae20f0..4b7c1f8a4c2f99543e709d67af8396f33b47dd17 100644 --- a/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb +++ b/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb @@ -10,7 +10,21 @@ # The issue corresponding to the loose foreign key conversion # should be added as a comment along with the name of the column. let!(:allowed_cross_database_foreign_keys) do - [] + [ + 'snippet_repositories.shard_id', # Remove after https://gitlab.com/gitlab-org/gitlab/-/issues/515383 is resolved + 'project_repositories.shard_id', # Remove after https://gitlab.com/gitlab-org/gitlab/-/issues/515383 is resolved + 'group_wiki_repositories.shard_id', # Remove after https://gitlab.com/gitlab-org/gitlab/-/issues/515383 is resolved + 'pool_repositories.shard_id', # Remove after https://gitlab.com/gitlab-org/gitlab/-/issues/515383 is resolved + 'geo_node_namespace_links.namespace_id', + 'zoekt_indices.zoekt_enabled_namespace_id', + 'zoekt_repositories.project_id', + 'zoekt_replicas.zoekt_enabled_namespace_id', + 'zoekt_replicas.namespace_id', + 'system_access_microsoft_applications.namespace_id', + 'ci_cost_settings.runner_id', # The fk_rails_6a70651f75 FK needs to be dropped + 'ci_runner_taggings.tag_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/467664 + 'ci_runner_taggings_instance_type.tag_id' # https://gitlab.com/gitlab-org/gitlab/-/issues/467664 + ] end def foreign_keys_for(table_name) @@ -27,15 +41,23 @@ def is_cross_db?(fk_record) it 'onlies have allowed list of cross-database foreign keys', :aggregate_failures do all_tables = ApplicationRecord.connection.data_sources + allowlist = allowed_cross_database_foreign_keys.dup all_tables.each do |table| foreign_keys_for(table).each do |fk| - if is_cross_db?(fk) - column = "#{fk.from_table}.#{fk.column}" - expect(allowed_cross_database_foreign_keys).to include(column), "Found extra cross-database foreign key #{column} referencing #{fk.to_table} with constraint name #{fk.name}. When a foreign key references another database you must use a Loose Foreign Key instead https://docs.gitlab.com/ee/development/database/loose_foreign_keys.html ." - end + next unless is_cross_db?(fk) + + column = "#{fk.from_table}.#{fk.column}" + allowlist.delete(column) + + expect(allowed_cross_database_foreign_keys).to include(column), "Found extra cross-database foreign key #{column} referencing #{fk.to_table} with constraint name #{fk.name}. When a foreign key references another database you must use a Loose Foreign Key instead https://docs.gitlab.com/ee/development/database/loose_foreign_keys.html ." end end + + formatted_allowlist = allowlist.map { |item| "- #{item}" }.join("\n") + expect(allowlist).to be_empty, "The following items must be allowed_cross_database_foreign_keys` list," \ + "as it no longer appears as cross-database foreign key:\n" \ + "#{formatted_allowlist}" end it 'only allows existing foreign keys to be present in the exempted list', :aggregate_failures do diff --git a/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb b/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb index 6011fa4a43b206092f91e4ea33ed3fee89ed76b1..a0fe642ec066617ad2678b2828b4996b957b4b72 100644 --- a/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb +++ b/spec/tasks/gitlab/db/decomposition/rollback/bump_ci_sequences_rake_spec.rb @@ -17,12 +17,14 @@ let(:main_sequence_name) { 'issues_id_seq' } let(:ci_sequence_name) { 'ci_build_needs_id_seq' } + let(:ci_cell_local_sequence_name) { 'ci_instance_variables_id_seq' } # This is just to make sure that all of the sequences start with `is_called=True` # which means that the next call to nextval() is going to increment the sequence. # To give predictable test results. before do ApplicationRecord.connection.select_value("select nextval($1)", nil, [ci_sequence_name]) + ApplicationRecord.connection.select_value("select nextval($1)", nil, [ci_cell_local_sequence_name]) end context 'when passing wrong argument' do @@ -48,6 +50,9 @@ end.to change { last_value_of_sequence(ApplicationRecord.connection, ci_sequence_name) }.by(16) # the +1 is because the sequence has is_called = true + .and change { + last_value_of_sequence(ApplicationRecord.connection, ci_cell_local_sequence_name) + }.by(16) # the +1 is because the sequence has is_called = true end it 'will still increase the value of sequences that have is_called = False' do @@ -78,6 +83,9 @@ .and change { last_value_of_sequence(ApplicationRecord.connection, ci_sequence_name) }.by(11) # the +1 is because the sequence has is_called = true + .and change { + last_value_of_sequence(ApplicationRecord.connection, ci_cell_local_sequence_name) + }.by(11) # the +1 is because the sequence has is_called = true end end @@ -92,6 +100,9 @@ end.to change { last_value_of_sequence(Ci::ApplicationRecord.connection, ci_sequence_name) }.by(0) + .and change { + last_value_of_sequence(Ci::ApplicationRecord.connection, ci_cell_local_sequence_name) + }.by(0) end end end