Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-04 09:12:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-04 09:12:17 +0300
commit3f7324cf3aefa10a3b2126683e7d61e595bc210a (patch)
treebd43588be8a75fc96f807d7895b0fff8347a72dd
parent67b171dd3418702987b3cf5066c7ad344e21460d (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--GITLAB_KAS_VERSION2
-rw-r--r--config/feature_flags/development/use_primary_and_secondary_stores_for_db_load_balancing.yml8
-rw-r--r--config/feature_flags/development/use_primary_store_as_default_for_db_load_balancing.yml8
-rw-r--r--db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb3
-rw-r--r--db/migrate/20230426102200_fix_import_sources_on_application_settings_after_phabricator_removal.rb3
-rw-r--r--db/migrate/20230426161259_add_user_foreign_key_to_merge_request_diff_llm_summary.rb3
-rw-r--r--db/migrate/20230426161341_add_merge_request_diff_foreign_key_to_merge_request_diff_llm_summary.rb3
-rw-r--r--db/migrate/20230626065725_backfill_instance_audit_event_name.rb3
-rw-r--r--db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb3
-rw-r--r--db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb3
-rw-r--r--db/post_migrate/20230113003255_remove_atlassian_refresh_token_constraint.rb3
-rw-r--r--db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb3
-rw-r--r--db/post_migrate/20230124104310_prepare_web_hook_logs_id_created_at_async_index.rb3
-rw-r--r--db/post_migrate/20230315161408_finalize_set_notifications_bigint_conversion_backfill.rb3
-rw-r--r--db/post_migrate/20230328184031_swap_sent_notifications_id_columns.rb3
-rw-r--r--db/post_migrate/20230404061832_drop_sync_index_ci_job_artifacts_on_expire_at_for_removal.rb3
-rw-r--r--db/post_migrate/20230420065656_finalize_fix_incoherent_packages_size_on_project_statistics.rb3
-rw-r--r--db/post_migrate/20230427194552_drop_cycle_analytics_unused_tables.rb3
-rw-r--r--db/post_migrate/20230501094322_prepare_removal_partial_index_deployments_for_project_id_and_tag.rb3
-rw-r--r--db/post_migrate/20230501180958_drop_clusters_applications_cert_managers.rb3
-rw-r--r--db/post_migrate/20230502134532_drop_clusters_applications_cilium.rb3
-rw-r--r--db/post_migrate/20230502182754_drop_clusters_applications_crossplane.rb3
-rw-r--r--db/post_migrate/20230502193525_drop_clusters_applications_helm.rb3
-rw-r--r--db/post_migrate/20230502201251_drop_clusters_applications_ingress.rb3
-rw-r--r--db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb3
-rw-r--r--db/post_migrate/20230503152349_drop_clusters_applications_knative.rb3
-rw-r--r--db/post_migrate/20230503173101_drop_clusters_applications_prometheus.rb3
-rw-r--r--db/post_migrate/20230503175406_drop_clusters_applications_runners.rb3
-rw-r--r--db/post_migrate/20230503181808_drop_serverless_domain_cluster.rb3
-rw-r--r--db/post_migrate/20230515153600_finalize_back_fill_prepared_at_merge_requests.rb3
-rw-r--r--db/post_migrate/20230605192000_drop_tmp_index_oauth_access_tokens_on_id_where_expires_in_null.rb3
-rw-r--r--db/post_migrate/20230615030402_remove_audit_events_group_index.rb3
-rw-r--r--db/post_migrate/20230704042302_prepare_removal_index_deployments_on_project_id_sha.rb3
-rw-r--r--db/post_migrate/20230704044541_prepare_removal_index_deployments_on_project_id_and_status.rb3
-rw-r--r--db/post_migrate/20230704050739_prepare_removal_index_deployments_on_environment_id_and_iid_and_project_id.rb3
-rw-r--r--db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb3
-rw-r--r--db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb3
-rw-r--r--db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb3
-rw-r--r--db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb3
-rw-r--r--db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb3
-rw-r--r--db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb3
-rw-r--r--db/post_migrate/20230818034041_prepare_removal_index_success_deployments_on_cluster_id_and_environment_id.rb3
-rw-r--r--db/post_migrate/20230906181457_add_index_to_violations_on_target_proj_id.rb2
-rw-r--r--db/post_migrate/20230929095008_drop_application_settings_product_analytics_cluster_settings.rb3
-rw-r--r--db/post_migrate/20230929095728_drop_project_settings_product_analytics_cluster_settings.rb3
-rw-r--r--db/post_migrate/20231012180342_index_stopping_environments_on_updated_at.rb3
-rw-r--r--db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb3
-rw-r--r--doc/development/database/batched_background_migrations.md47
-rw-r--r--doc/user/product_analytics/instrumentation/browser_sdk.md2
-rw-r--r--doc/user/project/protected_branches.md3
-rw-r--r--lib/gitlab/instrumentation/redis_base.rb5
-rw-r--r--lib/gitlab/instrumentation/redis_interceptor.rb17
-rw-r--r--lib/gitlab/redis/db_load_balancing.rb9
-rw-r--r--spec/lib/gitlab/instrumentation/redis_base_spec.rb14
-rw-r--r--spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb20
-rw-r--r--spec/lib/gitlab/redis/db_load_balancing_spec.rb36
-rw-r--r--spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb51
57 files changed, 109 insertions, 244 deletions
diff --git a/GITLAB_KAS_VERSION b/GITLAB_KAS_VERSION
index cb09356c7a7..98fb152f096 100644
--- a/GITLAB_KAS_VERSION
+++ b/GITLAB_KAS_VERSION
@@ -1 +1 @@
-v16.7.0-rc2
+v16.7.0-rc3
diff --git a/config/feature_flags/development/use_primary_and_secondary_stores_for_db_load_balancing.yml b/config/feature_flags/development/use_primary_and_secondary_stores_for_db_load_balancing.yml
deleted file mode 100644
index 18f060f247d..00000000000
--- a/config/feature_flags/development/use_primary_and_secondary_stores_for_db_load_balancing.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: use_primary_and_secondary_stores_for_db_load_balancing
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111269
-rollout_issue_url:
-milestone: '15.9'
-type: development
-group: group::scalability
-default_enabled: false
diff --git a/config/feature_flags/development/use_primary_store_as_default_for_db_load_balancing.yml b/config/feature_flags/development/use_primary_store_as_default_for_db_load_balancing.yml
deleted file mode 100644
index 632ec40adfa..00000000000
--- a/config/feature_flags/development/use_primary_store_as_default_for_db_load_balancing.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: use_primary_store_as_default_for_db_load_balancing
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111269
-rollout_issue_url:
-milestone: '15.9'
-type: development
-group: group::scalability
-default_enabled: false
diff --git a/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb b/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb
index 51834a3b19b..d071c0484a7 100644
--- a/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb
+++ b/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddObjectiveAndKeyresultToWorkItemTypes < Gitlab::Database::Migration[2.0]
# Added the following statements as per https://docs.gitlab.com/ee/development/database/migrations_for_multiple_databases.html
disable_ddl_transaction!
diff --git a/db/migrate/20230426102200_fix_import_sources_on_application_settings_after_phabricator_removal.rb b/db/migrate/20230426102200_fix_import_sources_on_application_settings_after_phabricator_removal.rb
index e2061138fc4..ca56d4ac264 100644
--- a/db/migrate/20230426102200_fix_import_sources_on_application_settings_after_phabricator_removal.rb
+++ b/db/migrate/20230426102200_fix_import_sources_on_application_settings_after_phabricator_removal.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class FixImportSourcesOnApplicationSettingsAfterPhabricatorRemoval < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/migrate/20230426161259_add_user_foreign_key_to_merge_request_diff_llm_summary.rb b/db/migrate/20230426161259_add_user_foreign_key_to_merge_request_diff_llm_summary.rb
index d5692b4d956..64277833c76 100644
--- a/db/migrate/20230426161259_add_user_foreign_key_to_merge_request_diff_llm_summary.rb
+++ b/db/migrate/20230426161259_add_user_foreign_key_to_merge_request_diff_llm_summary.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddUserForeignKeyToMergeRequestDiffLlmSummary < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/migrate/20230426161341_add_merge_request_diff_foreign_key_to_merge_request_diff_llm_summary.rb b/db/migrate/20230426161341_add_merge_request_diff_foreign_key_to_merge_request_diff_llm_summary.rb
index 4271bd3c07c..c589717f0a2 100644
--- a/db/migrate/20230426161341_add_merge_request_diff_foreign_key_to_merge_request_diff_llm_summary.rb
+++ b/db/migrate/20230426161341_add_merge_request_diff_foreign_key_to_merge_request_diff_llm_summary.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddMergeRequestDiffForeignKeyToMergeRequestDiffLlmSummary < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/migrate/20230626065725_backfill_instance_audit_event_name.rb b/db/migrate/20230626065725_backfill_instance_audit_event_name.rb
index 082a57fcc99..ac3c617d261 100644
--- a/db/migrate/20230626065725_backfill_instance_audit_event_name.rb
+++ b/db/migrate/20230626065725_backfill_instance_audit_event_name.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class BackfillInstanceAuditEventName < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb b/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb
index bdbe8aa3a63..f2298703d11 100644
--- a/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb
+++ b/db/migrate/20231103162825_add_wolfi_purl_type_to_package_metadata_purl_types.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddWolfiPurlTypeToPackageMetadataPurlTypes < Gitlab::Database::Migration[2.2]
milestone '16.6'
diff --git a/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb b/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
index 19f6732d297..ef493e12f38 100644
--- a/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
+++ b/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class ChangeMemberNamespaceIdNotNull < Gitlab::Database::Migration[2.0]
disable_ddl_transaction!
diff --git a/db/post_migrate/20230113003255_remove_atlassian_refresh_token_constraint.rb b/db/post_migrate/20230113003255_remove_atlassian_refresh_token_constraint.rb
index 81c3f10c0f6..7929d4495c0 100644
--- a/db/post_migrate/20230113003255_remove_atlassian_refresh_token_constraint.rb
+++ b/db/post_migrate/20230113003255_remove_atlassian_refresh_token_constraint.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class RemoveAtlassianRefreshTokenConstraint < Gitlab::Database::Migration[2.1]
CONSTRAINT_NAME = 'atlassian_identities_refresh_token_length_constraint'
diff --git a/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb b/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb
index 19020fecad5..28a600c459f 100644
--- a/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb
+++ b/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class BackfillNamespaceLdapSettings < Gitlab::Database::Migration[2.1]
restrict_gitlab_migration gitlab_schema: :gitlab_main
disable_ddl_transaction!
diff --git a/db/post_migrate/20230124104310_prepare_web_hook_logs_id_created_at_async_index.rb b/db/post_migrate/20230124104310_prepare_web_hook_logs_id_created_at_async_index.rb
index ea087265c90..d22fda092d3 100644
--- a/db/post_migrate/20230124104310_prepare_web_hook_logs_id_created_at_async_index.rb
+++ b/db/post_migrate/20230124104310_prepare_web_hook_logs_id_created_at_async_index.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class PrepareWebHookLogsIdCreatedAtAsyncIndex < Gitlab::Database::Migration[2.1]
include Gitlab::Database::PartitioningMigrationHelpers
diff --git a/db/post_migrate/20230315161408_finalize_set_notifications_bigint_conversion_backfill.rb b/db/post_migrate/20230315161408_finalize_set_notifications_bigint_conversion_backfill.rb
index d4a6d86d9cb..2f83fc15672 100644
--- a/db/post_migrate/20230315161408_finalize_set_notifications_bigint_conversion_backfill.rb
+++ b/db/post_migrate/20230315161408_finalize_set_notifications_bigint_conversion_backfill.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class FinalizeSetNotificationsBigintConversionBackfill < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
restrict_gitlab_migration gitlab_schema: :gitlab_main
diff --git a/db/post_migrate/20230328184031_swap_sent_notifications_id_columns.rb b/db/post_migrate/20230328184031_swap_sent_notifications_id_columns.rb
index a2a0751c38a..b6215565b50 100644
--- a/db/post_migrate/20230328184031_swap_sent_notifications_id_columns.rb
+++ b/db/post_migrate/20230328184031_swap_sent_notifications_id_columns.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class SwapSentNotificationsIdColumns < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
diff --git a/db/post_migrate/20230404061832_drop_sync_index_ci_job_artifacts_on_expire_at_for_removal.rb b/db/post_migrate/20230404061832_drop_sync_index_ci_job_artifacts_on_expire_at_for_removal.rb
index efa0792c457..491ec0c02d5 100644
--- a/db/post_migrate/20230404061832_drop_sync_index_ci_job_artifacts_on_expire_at_for_removal.rb
+++ b/db/post_migrate/20230404061832_drop_sync_index_ci_job_artifacts_on_expire_at_for_removal.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropSyncIndexCiJobArtifactsOnExpireAtForRemoval < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_ci_job_artifacts_on_expire_at_for_removal'
CONDITIONS = 'locked = 0 AND expire_at IS NOT NULL'
diff --git a/db/post_migrate/20230420065656_finalize_fix_incoherent_packages_size_on_project_statistics.rb b/db/post_migrate/20230420065656_finalize_fix_incoherent_packages_size_on_project_statistics.rb
index aa03310eb0a..8932c52d445 100644
--- a/db/post_migrate/20230420065656_finalize_fix_incoherent_packages_size_on_project_statistics.rb
+++ b/db/post_migrate/20230420065656_finalize_fix_incoherent_packages_size_on_project_statistics.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class FinalizeFixIncoherentPackagesSizeOnProjectStatistics < Gitlab::Database::Migration[2.1]
MIGRATION = 'FixIncoherentPackagesSizeOnProjectStatistics'
disable_ddl_transaction!
diff --git a/db/post_migrate/20230427194552_drop_cycle_analytics_unused_tables.rb b/db/post_migrate/20230427194552_drop_cycle_analytics_unused_tables.rb
index 7c10238a1bc..be3f80389b0 100644
--- a/db/post_migrate/20230427194552_drop_cycle_analytics_unused_tables.rb
+++ b/db/post_migrate/20230427194552_drop_cycle_analytics_unused_tables.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropCycleAnalyticsUnusedTables < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/post_migrate/20230501094322_prepare_removal_partial_index_deployments_for_project_id_and_tag.rb b/db/post_migrate/20230501094322_prepare_removal_partial_index_deployments_for_project_id_and_tag.rb
index bbdfb89bb80..1c0edcd5c44 100644
--- a/db/post_migrate/20230501094322_prepare_removal_partial_index_deployments_for_project_id_and_tag.rb
+++ b/db/post_migrate/20230501094322_prepare_removal_partial_index_deployments_for_project_id_and_tag.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class PrepareRemovalPartialIndexDeploymentsForProjectIdAndTag < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'
diff --git a/db/post_migrate/20230501180958_drop_clusters_applications_cert_managers.rb b/db/post_migrate/20230501180958_drop_clusters_applications_cert_managers.rb
index 3eb5fc13a2a..0d60a816c02 100644
--- a/db/post_migrate/20230501180958_drop_clusters_applications_cert_managers.rb
+++ b/db/post_migrate/20230501180958_drop_clusters_applications_cert_managers.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsCertManagers < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_cert_managers
diff --git a/db/post_migrate/20230502134532_drop_clusters_applications_cilium.rb b/db/post_migrate/20230502134532_drop_clusters_applications_cilium.rb
index 2c7b7d89bf5..e7755c940a5 100644
--- a/db/post_migrate/20230502134532_drop_clusters_applications_cilium.rb
+++ b/db/post_migrate/20230502134532_drop_clusters_applications_cilium.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsCilium < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_cilium
diff --git a/db/post_migrate/20230502182754_drop_clusters_applications_crossplane.rb b/db/post_migrate/20230502182754_drop_clusters_applications_crossplane.rb
index 1eeb7770c82..9262f7d9955 100644
--- a/db/post_migrate/20230502182754_drop_clusters_applications_crossplane.rb
+++ b/db/post_migrate/20230502182754_drop_clusters_applications_crossplane.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsCrossplane < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_crossplane
diff --git a/db/post_migrate/20230502193525_drop_clusters_applications_helm.rb b/db/post_migrate/20230502193525_drop_clusters_applications_helm.rb
index c435b356e01..2efa53e5b31 100644
--- a/db/post_migrate/20230502193525_drop_clusters_applications_helm.rb
+++ b/db/post_migrate/20230502193525_drop_clusters_applications_helm.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsHelm < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_helm
diff --git a/db/post_migrate/20230502201251_drop_clusters_applications_ingress.rb b/db/post_migrate/20230502201251_drop_clusters_applications_ingress.rb
index 3ccc536cb7e..409c9c49b1c 100644
--- a/db/post_migrate/20230502201251_drop_clusters_applications_ingress.rb
+++ b/db/post_migrate/20230502201251_drop_clusters_applications_ingress.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsIngress < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_ingress
diff --git a/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb b/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb
index bd98aa6d19c..35bddba301a 100644
--- a/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb
+++ b/db/post_migrate/20230503115918_drop_clusters_applications_jupyter.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsJupyter < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_jupyter
diff --git a/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb b/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb
index e8473b74408..38f28eca109 100644
--- a/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb
+++ b/db/post_migrate/20230503152349_drop_clusters_applications_knative.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsKnative < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_knative
diff --git a/db/post_migrate/20230503173101_drop_clusters_applications_prometheus.rb b/db/post_migrate/20230503173101_drop_clusters_applications_prometheus.rb
index b62452f2052..35db7cbed47 100644
--- a/db/post_migrate/20230503173101_drop_clusters_applications_prometheus.rb
+++ b/db/post_migrate/20230503173101_drop_clusters_applications_prometheus.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsPrometheus < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_prometheus
diff --git a/db/post_migrate/20230503175406_drop_clusters_applications_runners.rb b/db/post_migrate/20230503175406_drop_clusters_applications_runners.rb
index a4ab75dbce5..fb177b5a1de 100644
--- a/db/post_migrate/20230503175406_drop_clusters_applications_runners.rb
+++ b/db/post_migrate/20230503175406_drop_clusters_applications_runners.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropClustersApplicationsRunners < Gitlab::Database::Migration[2.1]
def up
drop_table :clusters_applications_runners
diff --git a/db/post_migrate/20230503181808_drop_serverless_domain_cluster.rb b/db/post_migrate/20230503181808_drop_serverless_domain_cluster.rb
index 003f2d91b54..b68b7e85285 100644
--- a/db/post_migrate/20230503181808_drop_serverless_domain_cluster.rb
+++ b/db/post_migrate/20230503181808_drop_serverless_domain_cluster.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropServerlessDomainCluster < Gitlab::Database::Migration[2.1]
def up
drop_table :serverless_domain_cluster
diff --git a/db/post_migrate/20230515153600_finalize_back_fill_prepared_at_merge_requests.rb b/db/post_migrate/20230515153600_finalize_back_fill_prepared_at_merge_requests.rb
index 6c0e4e722d2..2b5d7424450 100644
--- a/db/post_migrate/20230515153600_finalize_back_fill_prepared_at_merge_requests.rb
+++ b/db/post_migrate/20230515153600_finalize_back_fill_prepared_at_merge_requests.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class FinalizeBackFillPreparedAtMergeRequests < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/post_migrate/20230605192000_drop_tmp_index_oauth_access_tokens_on_id_where_expires_in_null.rb b/db/post_migrate/20230605192000_drop_tmp_index_oauth_access_tokens_on_id_where_expires_in_null.rb
index c74df0a5cdd..b82c2dfb8ed 100644
--- a/db/post_migrate/20230605192000_drop_tmp_index_oauth_access_tokens_on_id_where_expires_in_null.rb
+++ b/db/post_migrate/20230605192000_drop_tmp_index_oauth_access_tokens_on_id_where_expires_in_null.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropTmpIndexOauthAccessTokensOnIdWhereExpiresInNull < Gitlab::Database::Migration[2.1]
TMP_INDEX = 'tmp_index_oauth_access_tokens_on_id_where_expires_in_null'
diff --git a/db/post_migrate/20230615030402_remove_audit_events_group_index.rb b/db/post_migrate/20230615030402_remove_audit_events_group_index.rb
index 9a77d7a4d0d..ff75a04b0f4 100644
--- a/db/post_migrate/20230615030402_remove_audit_events_group_index.rb
+++ b/db/post_migrate/20230615030402_remove_audit_events_group_index.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class RemoveAuditEventsGroupIndex < Gitlab::Database::Migration[2.1]
include Gitlab::Database::PartitioningMigrationHelpers
diff --git a/db/post_migrate/20230704042302_prepare_removal_index_deployments_on_project_id_sha.rb b/db/post_migrate/20230704042302_prepare_removal_index_deployments_on_project_id_sha.rb
index 77ddd909215..3ab42c70d8a 100644
--- a/db/post_migrate/20230704042302_prepare_removal_index_deployments_on_project_id_sha.rb
+++ b/db/post_migrate/20230704042302_prepare_removal_index_deployments_on_project_id_sha.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class PrepareRemovalIndexDeploymentsOnProjectIdSha < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_deployments_on_project_id_sha'
diff --git a/db/post_migrate/20230704044541_prepare_removal_index_deployments_on_project_id_and_status.rb b/db/post_migrate/20230704044541_prepare_removal_index_deployments_on_project_id_and_status.rb
index 0c9a292eb8c..0098eaabf76 100644
--- a/db/post_migrate/20230704044541_prepare_removal_index_deployments_on_project_id_and_status.rb
+++ b/db/post_migrate/20230704044541_prepare_removal_index_deployments_on_project_id_and_status.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class PrepareRemovalIndexDeploymentsOnProjectIdAndStatus < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_deployments_on_project_id_and_status'
diff --git a/db/post_migrate/20230704050739_prepare_removal_index_deployments_on_environment_id_and_iid_and_project_id.rb b/db/post_migrate/20230704050739_prepare_removal_index_deployments_on_environment_id_and_iid_and_project_id.rb
index 6171b58ac53..204579d6e18 100644
--- a/db/post_migrate/20230704050739_prepare_removal_index_deployments_on_environment_id_and_iid_and_project_id.rb
+++ b/db/post_migrate/20230704050739_prepare_removal_index_deployments_on_environment_id_and_iid_and_project_id.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class PrepareRemovalIndexDeploymentsOnEnvironmentIdAndIidAndProjectId < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_deployments_on_environment_id_and_iid_and_project_id'
diff --git a/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb b/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb
index 0c76b73dcdc..5dea67a5d16 100644
--- a/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb
+++ b/db/post_migrate/20230712052619_drop_index_deployments_on_project_id_and_status.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropIndexDeploymentsOnProjectIdAndStatus < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_deployments_on_project_id_and_status'
diff --git a/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb b/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb
index 9916ee7f9ba..edb0ee98d43 100644
--- a/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb
+++ b/db/post_migrate/20230712054057_drop_index_deployments_on_project_id_sha.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropIndexDeploymentsOnProjectIdSha < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_deployments_on_project_id_sha'
diff --git a/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb b/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb
index 52a02e68d14..4791baf9d9e 100644
--- a/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb
+++ b/db/post_migrate/20230712055956_drop_index_deployments_on_environment_id_and_iid_and_project_id.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropIndexDeploymentsOnEnvironmentIdAndIidAndProjectId < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_deployments_on_environment_id_and_iid_and_project_id'
diff --git a/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb b/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb
index d93517fb49b..c0a5c577403 100644
--- a/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb
+++ b/db/post_migrate/20230717062445_backfill_ci_stages_pipeline_id_conversion.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class BackfillCiStagesPipelineIdConversion < Gitlab::Database::Migration[2.1]
restrict_gitlab_migration gitlab_schema: :gitlab_ci
diff --git a/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb b/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb
index fd2387e2bc4..2a60e948007 100644
--- a/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb
+++ b/db/post_migrate/20230724150939_index_projects_on_namespace_id_and_repository_size_limit.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class IndexProjectsOnNamespaceIdAndRepositorySizeLimit < Gitlab::Database::Migration[2.1]
INDEX_NAME = "index_projects_on_namespace_id_and_repository_size_limit"
diff --git a/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb b/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb
index 43b4db7d9b5..b5986967214 100644
--- a/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb
+++ b/db/post_migrate/20230726080827_add_issue_search_data_namespace_id_foreign_key.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddIssueSearchDataNamespaceIdForeignKey < Gitlab::Database::Migration[2.1]
include Gitlab::Database::PartitioningMigrationHelpers
diff --git a/db/post_migrate/20230818034041_prepare_removal_index_success_deployments_on_cluster_id_and_environment_id.rb b/db/post_migrate/20230818034041_prepare_removal_index_success_deployments_on_cluster_id_and_environment_id.rb
index 39a45774676..db40584bb3a 100644
--- a/db/post_migrate/20230818034041_prepare_removal_index_success_deployments_on_cluster_id_and_environment_id.rb
+++ b/db/post_migrate/20230818034041_prepare_removal_index_success_deployments_on_cluster_id_and_environment_id.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class PrepareRemovalIndexSuccessDeploymentsOnClusterIdAndEnvironmentId < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_successful_deployments_on_cluster_id_and_environment_id'
diff --git a/db/post_migrate/20230906181457_add_index_to_violations_on_target_proj_id.rb b/db/post_migrate/20230906181457_add_index_to_violations_on_target_proj_id.rb
index 13c76a3c2de..a51fbd0a00a 100644
--- a/db/post_migrate/20230906181457_add_index_to_violations_on_target_proj_id.rb
+++ b/db/post_migrate/20230906181457_add_index_to_violations_on_target_proj_id.rb
@@ -2,7 +2,7 @@
class AddIndexToViolationsOnTargetProjId < Gitlab::Database::Migration[2.1]
TABLE_NAME = 'merge_requests_compliance_violations'
- # Use funciton based naming as suggested in docs:
+ # Use function based naming as suggested in docs:
# https://docs.gitlab.com/ee/development/migration_style_guide.html#truncate-long-index-names
INDEX_NAME = 'i_compliance_violations_for_export'
diff --git a/db/post_migrate/20230929095008_drop_application_settings_product_analytics_cluster_settings.rb b/db/post_migrate/20230929095008_drop_application_settings_product_analytics_cluster_settings.rb
index b759ee21912..d8a7f0017fa 100644
--- a/db/post_migrate/20230929095008_drop_application_settings_product_analytics_cluster_settings.rb
+++ b/db/post_migrate/20230929095008_drop_application_settings_product_analytics_cluster_settings.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropApplicationSettingsProductAnalyticsClusterSettings < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/post_migrate/20230929095728_drop_project_settings_product_analytics_cluster_settings.rb b/db/post_migrate/20230929095728_drop_project_settings_product_analytics_cluster_settings.rb
index e6f0c29fb7a..d8054a34a4b 100644
--- a/db/post_migrate/20230929095728_drop_project_settings_product_analytics_cluster_settings.rb
+++ b/db/post_migrate/20230929095728_drop_project_settings_product_analytics_cluster_settings.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class DropProjectSettingsProductAnalyticsClusterSettings < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
diff --git a/db/post_migrate/20231012180342_index_stopping_environments_on_updated_at.rb b/db/post_migrate/20231012180342_index_stopping_environments_on_updated_at.rb
index 3b9332ab0f8..cca6ed23fef 100644
--- a/db/post_migrate/20231012180342_index_stopping_environments_on_updated_at.rb
+++ b/db/post_migrate/20231012180342_index_stopping_environments_on_updated_at.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class IndexStoppingEnvironmentsOnUpdatedAt < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_environments_on_updated_at_for_stopping_state'
diff --git a/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb b/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb
index 01fe32d6bd7..5df8625c24c 100644
--- a/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb
+++ b/db/post_migrate/20231023113908_add_index_stopping_environments_on_updated_at.rb
@@ -1,8 +1,5 @@
# frozen_string_literal: true
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddIndexStoppingEnvironmentsOnUpdatedAt < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_environments_on_updated_at_for_stopping_state'
diff --git a/doc/development/database/batched_background_migrations.md b/doc/development/database/batched_background_migrations.md
index e3c34c4fdff..585f9069ef6 100644
--- a/doc/development/database/batched_background_migrations.md
+++ b/doc/development/database/batched_background_migrations.md
@@ -670,6 +670,53 @@ The following process has been configured to make dependencies more evident whil
whether they got finished by looking up the `finalized_by` key in the
[BBM dictionary](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/generators/batched_background_migration/templates/batched_background_migration_dictionary.template).
+Example:
+
+```ruby
+ class QueueBackfillRoutesNamespaceId < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'BackfillRouteNamespaceId'
+....
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ ...
+ queued_migration_version: '20231113120650',
+ ...
+ )
+ end
+...
+ end
+ ```
+
+ ```ruby
+ class NewQueueBackfillRoutesNamespaceId < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'NewBackfillRouteNamespaceId'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 100
+ DEPENDENT_BATCHED_BACKGROUND_MIGRATIONS = ["20231113120650"]
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :routes,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ queued_migration_version: '20241213120651',
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :routes, :id, [])
+ end
+ end
+ ```
+
#### Notes
- `BackgroundMigration::DictionaryFile` cop ensures the presence of `finalize_after` and `introduced_by_url` keys in the
diff --git a/doc/user/product_analytics/instrumentation/browser_sdk.md b/doc/user/product_analytics/instrumentation/browser_sdk.md
index 3ab7e2750e1..66865ab37f1 100644
--- a/doc/user/product_analytics/instrumentation/browser_sdk.md
+++ b/doc/user/product_analytics/instrumentation/browser_sdk.md
@@ -83,7 +83,7 @@ interface GitLabClientSDKOptions {
| :---------------------------- | :---------- |
| `appId` | The ID provided by the GitLab Project Analytics setup guide. This ID ensures your data is sent to your analytics instance. |
| `host` | The GitLab Project Analytics instance provided by the setup guide. |
-| `hasCookieConsent` | Whether to use cookies to identify unique users and record their full IP address. Set to `false` by default. When `false`, users are considered anonymous users. No cookies or other storage mechanisms are used to identify users. |
+| `hasCookieConsent` | Whether to use cookies to identify unique users. Set to `false` by default. When `false`, users are considered anonymous users. No cookies or other storage mechanisms are used to identify users. |
| `respectGlobalPrivacyControl` | Whether to respect the user's [GPC](https://globalprivacycontrol.org/) configuration to permit or refuse tracking. Set to `true` by default. When `false`, events are emitted regardless of user configuration. |
| `trackerId` | Used to differentiate between multiple trackers running on the same page or application, because each tracker instance can be configured differently to capture different sets of data. This identifier helps ensure that the data sent to the collector is correctly associated with the correct tracker configuration. Default value is `gitlab`. |
| `pagePingTracking` | Option to track user engagement on your website or application by sending periodic events while a user is actively browsing a page. Page pings provide valuable insight into how users interact with your content, such as how long they spend on a page, which sections they are viewing, and whether they are scrolling. `pagePingTracking` can be boolean or an object. As a boolean, set to `true` it enables page ping with default options, and set to `false` it disables page ping tracking. As an object, it has two options: `minimumVisitLength` (the minimum time that must have elapsed before the first heartbeat) and `heartbeatDelay` (the interval at which the callback is fired). |
diff --git a/doc/user/project/protected_branches.md b/doc/user/project/protected_branches.md
index f957a5ae2c0..2ec92fbb52f 100644
--- a/doc/user/project/protected_branches.md
+++ b/doc/user/project/protected_branches.md
@@ -43,6 +43,9 @@ When a branch is protected, the default behavior enforces these restrictions on
for that branch at the project level are ignored. All other protections continue
to use project level settings.
+You can implement a [scan result policy](../application_security/policies/scan-result-policies.md#approval_settings)
+to prevent protected branches being unprotected or deleted.
+
### When a branch matches multiple rules
When a branch matches multiple rules, the **most permissive rule** determines the
diff --git a/lib/gitlab/instrumentation/redis_base.rb b/lib/gitlab/instrumentation/redis_base.rb
index 88991495a10..1e117172c3a 100644
--- a/lib/gitlab/instrumentation/redis_base.rb
+++ b/lib/gitlab/instrumentation/redis_base.rb
@@ -128,6 +128,11 @@ module Gitlab
@exception_counter.increment({ storage: storage_key, exception: ex.class.to_s })
end
+ def instance_count_connection_exception(ex)
+ @connection_exception_counter ||= Gitlab::Metrics.counter(:gitlab_redis_client_connection_exceptions_total, 'Client side Redis connection exception count, per Redis server, per exception class')
+ @connection_exception_counter.increment({ storage: storage_key, exception: ex.class.to_s })
+ end
+
def instance_count_cluster_redirection(ex)
# This metric is meant to give a client side view of how often are commands
# redirected to the right node, especially during resharding..
diff --git a/lib/gitlab/instrumentation/redis_interceptor.rb b/lib/gitlab/instrumentation/redis_interceptor.rb
index bb0c783e93b..377354f8d07 100644
--- a/lib/gitlab/instrumentation/redis_interceptor.rb
+++ b/lib/gitlab/instrumentation/redis_interceptor.rb
@@ -28,6 +28,23 @@ module Gitlab
result
end
+ def ensure_connected
+ super do
+ instrument_reconnection_errors do
+ yield
+ end
+ end
+ end
+
+ def instrument_reconnection_errors
+ yield
+ rescue ::Redis::BaseConnectionError => ex
+ instrumentation_class.log_exception(ex)
+ instrumentation_class.instance_count_connection_exception(ex)
+
+ raise ex
+ end
+
# That's required so it knows which GitLab Redis instance
# it's interacting with in order to categorize accordingly.
#
diff --git a/lib/gitlab/redis/db_load_balancing.rb b/lib/gitlab/redis/db_load_balancing.rb
index 01276445611..f6769a39397 100644
--- a/lib/gitlab/redis/db_load_balancing.rb
+++ b/lib/gitlab/redis/db_load_balancing.rb
@@ -8,15 +8,6 @@ module Gitlab
def config_fallback
SharedState
end
-
- private
-
- def redis
- primary_store = ::Redis.new(params)
- secondary_store = ::Redis.new(config_fallback.params)
-
- MultiStore.new(primary_store, secondary_store, store_name)
- end
end
end
end
diff --git a/spec/lib/gitlab/instrumentation/redis_base_spec.rb b/spec/lib/gitlab/instrumentation/redis_base_spec.rb
index 426997f6e86..f0854b38353 100644
--- a/spec/lib/gitlab/instrumentation/redis_base_spec.rb
+++ b/spec/lib/gitlab/instrumentation/redis_base_spec.rb
@@ -222,4 +222,18 @@ RSpec.describe Gitlab::Instrumentation::RedisBase, :request_store do
instrumentation_class_a.log_exception(StandardError.new)
end
end
+
+ describe '.instance_count_connection_exception' do
+ before do
+ # initialise connection_exception_counter
+ instrumentation_class_a.instance_count_connection_exception(StandardError.new)
+ end
+
+ it 'counts connection exception' do
+ expect(instrumentation_class_a.instance_variable_get(:@connection_exception_counter)).to receive(:increment)
+ .with({ storage: instrumentation_class_a.storage_key, exception: 'Redis::ConnectionError' })
+
+ instrumentation_class_a.instance_count_connection_exception(Redis::ConnectionError.new)
+ end
+ end
end
diff --git a/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb b/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb
index 4168fdf5425..e73de608ec8 100644
--- a/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb
+++ b/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb
@@ -72,6 +72,26 @@ RSpec.describe Gitlab::Instrumentation::RedisInterceptor, :request_store, featur
end
end
+ context 'when encountering connection exceptions within process' do
+ before do
+ redis_store_class.with do |redis|
+ allow(redis._client).to receive(:write).and_call_original
+ end
+ end
+
+ it 'counts connection exceptions' do
+ redis_store_class.with do |redis|
+ expect(redis._client).to receive(:write).with([:get, 'foobar']).and_raise(::Redis::ConnectionError)
+ end
+
+ expect(instrumentation_class).to receive(:log_exception).with(instance_of(Redis::ConnectionError)).and_call_original
+ expect(instrumentation_class).to receive(:instance_count_connection_exception)
+ .with(instance_of(Redis::ConnectionError)).and_call_original
+
+ redis_store_class.with { |redis| redis.call(:get, 'foobar') }
+ end
+ end
+
context 'when encountering exceptions' do
where(:case_name, :exception, :exception_counter) do
'generic exception' | Redis::CommandError | :instance_count_exception
diff --git a/spec/lib/gitlab/redis/db_load_balancing_spec.rb b/spec/lib/gitlab/redis/db_load_balancing_spec.rb
index d3d3ced62a9..c3209ee12e5 100644
--- a/spec/lib/gitlab/redis/db_load_balancing_spec.rb
+++ b/spec/lib/gitlab/redis/db_load_balancing_spec.rb
@@ -5,40 +5,4 @@ require 'spec_helper'
RSpec.describe Gitlab::Redis::DbLoadBalancing, feature_category: :scalability do
include_examples "redis_new_instance_shared_examples", 'db_load_balancing', Gitlab::Redis::SharedState
include_examples "redis_shared_examples"
-
- describe '#pool' do
- let(:config_new_format_host) { "spec/fixtures/config/redis_new_format_host.yml" }
- let(:config_new_format_socket) { "spec/fixtures/config/redis_new_format_socket.yml" }
-
- subject { described_class.pool }
-
- before do
- allow(described_class).to receive(:config_file_name).and_return(config_new_format_host)
-
- # Override rails root to avoid having our fixtures overwritten by `redis.yml` if it exists
- allow(Gitlab::Redis::SharedState).to receive(:rails_root).and_return(mktmpdir)
- allow(Gitlab::Redis::SharedState).to receive(:config_file_name).and_return(config_new_format_socket)
- end
-
- around do |example|
- clear_pool
- example.run
- ensure
- clear_pool
- end
-
- it 'instantiates an instance of MultiStore' do
- subject.with do |redis_instance|
- expect(redis_instance).to be_instance_of(::Gitlab::Redis::MultiStore)
-
- expect(redis_instance.primary_store.connection[:id]).to eq("redis://test-host:6379/99")
- expect(redis_instance.secondary_store.connection[:id]).to eq("unix:///path/to/redis.sock/0")
-
- expect(redis_instance.instance_name).to eq('DbLoadBalancing')
- end
- end
-
- it_behaves_like 'multi store feature flags', :use_primary_and_secondary_stores_for_db_load_balancing,
- :use_primary_store_as_default_for_db_load_balancing
- end
end
diff --git a/spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb
deleted file mode 100644
index a5e4df1c272..00000000000
--- a/spec/support/shared_examples/lib/gitlab/redis/multi_store_feature_flags_shared_examples.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.shared_examples 'multi store feature flags' do |use_primary_and_secondary_stores, use_primary_store_as_default|
- context "with feature flag :#{use_primary_and_secondary_stores} is enabled" do
- before do
- stub_feature_flags(use_primary_and_secondary_stores => true)
- end
-
- it 'multi store is enabled' do
- subject.with do |redis_instance|
- expect(redis_instance.use_primary_and_secondary_stores?).to be true
- end
- end
- end
-
- context "with feature flag :#{use_primary_and_secondary_stores} is disabled" do
- before do
- stub_feature_flags(use_primary_and_secondary_stores => false)
- end
-
- it 'multi store is disabled' do
- subject.with do |redis_instance|
- expect(redis_instance.use_primary_and_secondary_stores?).to be false
- end
- end
- end
-
- context "with feature flag :#{use_primary_store_as_default} is enabled" do
- before do
- stub_feature_flags(use_primary_store_as_default => true)
- end
-
- it 'primary store is enabled' do
- subject.with do |redis_instance|
- expect(redis_instance.use_primary_store_as_default?).to be true
- end
- end
- end
-
- context "with feature flag :#{use_primary_store_as_default} is disabled" do
- before do
- stub_feature_flags(use_primary_store_as_default => false)
- end
-
- it 'primary store is disabled' do
- subject.with do |redis_instance|
- expect(redis_instance.use_primary_store_as_default?).to be false
- end
- end
- end
-end