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
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_artifact.yml9
-rw-r--r--db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_metadata.yml9
-rw-r--r--db/migrate/20231222071942_add_description_to_ci_instance_variables.rb12
-rw-r--r--db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb10
-rw-r--r--db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb30
-rw-r--r--db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb46
-rw-r--r--db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb10
-rw-r--r--db/post_migrate/20231222072237_add_text_limit_to_ci_instance_variables_description.rb18
-rw-r--r--db/post_migrate/20240108082419_queue_backfill_partition_id_ci_pipeline_metadata.rb26
-rw-r--r--db/post_migrate/20240109090354_queue_backfill_partition_id_ci_pipeline_artifact.rb26
-rw-r--r--db/schema_migrations/202312220719421
-rw-r--r--db/schema_migrations/202312220722371
-rw-r--r--db/schema_migrations/202401041501061
-rw-r--r--db/schema_migrations/202401041917361
-rw-r--r--db/schema_migrations/202401041918021
-rw-r--r--db/schema_migrations/202401080824191
-rw-r--r--db/schema_migrations/202401090823541
-rw-r--r--db/schema_migrations/202401090903541
-rw-r--r--db/structure.sql6
19 files changed, 209 insertions, 1 deletions
diff --git a/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_artifact.yml b/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_artifact.yml
new file mode 100644
index 00000000000..18a4ac13db1
--- /dev/null
+++ b/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_artifact.yml
@@ -0,0 +1,9 @@
+---
+migration_job_name: BackfillPartitionIdCiPipelineArtifact
+description: Fixes incorrect values for ci_pipeline_artifacts being in the wrong partition
+feature_category: continuous_integration
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141345
+milestone: '16.8'
+queued_migration_version: 20240109090354
+finalize_after: '2024-01-22'
+finalized_by: # version of the migration that finalized this BBM
diff --git a/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_metadata.yml b/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_metadata.yml
new file mode 100644
index 00000000000..a56fcfd4cca
--- /dev/null
+++ b/db/docs/batched_background_migrations/backfill_partition_id_ci_pipeline_metadata.yml
@@ -0,0 +1,9 @@
+---
+migration_job_name: BackfillPartitionIdCiPipelineMetadata
+description: Fixes incorrect values for ci_pipeline_metadata being in the wrong partition
+feature_category: continuous_integration
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141078
+milestone: '16.8'
+queued_migration_version: 20240108082419
+finalize_after: '2024-01-15'
+finalized_by: # version of the migration that finalized this BBM
diff --git a/db/migrate/20231222071942_add_description_to_ci_instance_variables.rb b/db/migrate/20231222071942_add_description_to_ci_instance_variables.rb
new file mode 100644
index 00000000000..e71f27411eb
--- /dev/null
+++ b/db/migrate/20231222071942_add_description_to_ci_instance_variables.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddDescriptionToCiInstanceVariables < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ enable_lock_retries!
+
+ # rubocop:disable Migration/AddLimitToTextColumns -- text limit is added in 20231222072237_add_text_limit_to_ci_instance_variables_description.rb migration
+ def change
+ add_column(:ci_instance_variables, :description, :text)
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb b/db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb
new file mode 100644
index 00000000000..cdada059306
--- /dev/null
+++ b/db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddPartitionIdToPipelineMetadata < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ enable_lock_retries!
+
+ def change
+ add_column(:ci_pipeline_metadata, :partition_id, :bigint, default: 100, null: false)
+ end
+end
diff --git a/db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb b/db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb
new file mode 100644
index 00000000000..3c3ef67e322
--- /dev/null
+++ b/db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class MigrateZoektIndexedNamespacesToZoektEnabledNamespaces < Gitlab::Database::Migration[2.2]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ milestone '16.8'
+
+ INSERTED_COLUMNS = %w[
+ root_namespace_id
+ search
+ created_at
+ updated_at
+ ].join(',')
+
+ def up
+ connection.execute(<<~SQL)
+ INSERT INTO zoekt_enabled_namespaces (#{INSERTED_COLUMNS})
+ (SELECT DISTINCT ON (namespace_id) namespace_id, search, created_at, updated_at
+ FROM zoekt_indexed_namespaces ORDER BY namespace_id, search)
+ SQL
+ end
+
+ def down
+ connection.execute(<<~SQL)
+ DELETE FROM zoekt_enabled_namespaces
+ SQL
+ end
+end
diff --git a/db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb b/db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb
new file mode 100644
index 00000000000..5461ad5094b
--- /dev/null
+++ b/db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+class MigrateZoektIndexedNamespacesToZoektIndices < Gitlab::Database::Migration[2.2]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ milestone '16.8'
+
+ INSERTED_COLUMNS = %w[
+ zoekt_enabled_namespace_id
+ namespace_id
+ zoekt_node_id
+ state
+ created_at
+ updated_at
+ ].join(',')
+
+ STATE_READY = 10
+
+ def up
+ connection.execute(<<~SQL)
+ WITH indexed_namespaces AS (
+ (SELECT DISTINCT ON (namespace_id) namespace_id, search, zoekt_node_id
+ FROM zoekt_indexed_namespaces ORDER BY namespace_id, search)
+ )
+
+ INSERT INTO zoekt_indices (#{INSERTED_COLUMNS})
+ SELECT
+ zoekt_enabled_namespaces.id,
+ indexed_namespaces.namespace_id,
+ indexed_namespaces.zoekt_node_id,
+ #{STATE_READY},
+ NOW(),
+ NOW()
+ FROM zoekt_enabled_namespaces
+ JOIN indexed_namespaces ON indexed_namespaces.namespace_id = zoekt_enabled_namespaces.root_namespace_id
+ SQL
+ end
+
+ def down
+ connection.execute(<<~SQL)
+ DELETE FROM zoekt_indices
+ SQL
+ end
+end
diff --git a/db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb b/db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb
new file mode 100644
index 00000000000..8a922aed648
--- /dev/null
+++ b/db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddPartitionIdToPipelineArtifact < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ enable_lock_retries!
+
+ def change
+ add_column(:ci_pipeline_artifacts, :partition_id, :bigint, default: 100, null: false)
+ end
+end
diff --git a/db/post_migrate/20231222072237_add_text_limit_to_ci_instance_variables_description.rb b/db/post_migrate/20231222072237_add_text_limit_to_ci_instance_variables_description.rb
new file mode 100644
index 00000000000..6ad13a591e4
--- /dev/null
+++ b/db/post_migrate/20231222072237_add_text_limit_to_ci_instance_variables_description.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddTextLimitToCiInstanceVariablesDescription < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_instance_variables
+ COLUMN_NAME = :description
+
+ def up
+ add_text_limit(TABLE_NAME, COLUMN_NAME, 255)
+ end
+
+ def down
+ remove_text_limit(TABLE_NAME, COLUMN_NAME)
+ end
+end
diff --git a/db/post_migrate/20240108082419_queue_backfill_partition_id_ci_pipeline_metadata.rb b/db/post_migrate/20240108082419_queue_backfill_partition_id_ci_pipeline_metadata.rb
new file mode 100644
index 00000000000..6bcaf376a05
--- /dev/null
+++ b/db/post_migrate/20240108082419_queue_backfill_partition_id_ci_pipeline_metadata.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class QueueBackfillPartitionIdCiPipelineMetadata < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+ MIGRATION = 'BackfillPartitionIdCiPipelineMetadata'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 250
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :ci_pipeline_metadata,
+ :pipeline_id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :ci_pipeline_metadata, :pipeline_id, [])
+ end
+end
diff --git a/db/post_migrate/20240109090354_queue_backfill_partition_id_ci_pipeline_artifact.rb b/db/post_migrate/20240109090354_queue_backfill_partition_id_ci_pipeline_artifact.rb
new file mode 100644
index 00000000000..30959a299fb
--- /dev/null
+++ b/db/post_migrate/20240109090354_queue_backfill_partition_id_ci_pipeline_artifact.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class QueueBackfillPartitionIdCiPipelineArtifact < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+ MIGRATION = 'BackfillPartitionIdCiPipelineArtifact'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 100
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :ci_pipeline_artifacts,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :ci_pipeline_artifacts, :id, [])
+ end
+end
diff --git a/db/schema_migrations/20231222071942 b/db/schema_migrations/20231222071942
new file mode 100644
index 00000000000..cc33e2239e2
--- /dev/null
+++ b/db/schema_migrations/20231222071942
@@ -0,0 +1 @@
+187b2c6e79e0f9e4636923f646ef9b5b5c609cb1797dac6265a1aa12e2a46f31 \ No newline at end of file
diff --git a/db/schema_migrations/20231222072237 b/db/schema_migrations/20231222072237
new file mode 100644
index 00000000000..4c71203247b
--- /dev/null
+++ b/db/schema_migrations/20231222072237
@@ -0,0 +1 @@
+c92fb56354f4471103cb34f0a49294961a221dde5ecea72b0f132fdd1c813095 \ No newline at end of file
diff --git a/db/schema_migrations/20240104150106 b/db/schema_migrations/20240104150106
new file mode 100644
index 00000000000..d2e7dbf0590
--- /dev/null
+++ b/db/schema_migrations/20240104150106
@@ -0,0 +1 @@
+e6829ae7a671ff2c13c78721c9304bcbaa7738aea01d8e83aeac79d0da2d2a47 \ No newline at end of file
diff --git a/db/schema_migrations/20240104191736 b/db/schema_migrations/20240104191736
new file mode 100644
index 00000000000..8072f3c5bfa
--- /dev/null
+++ b/db/schema_migrations/20240104191736
@@ -0,0 +1 @@
+92f7eddc8ba255987adc42e1140b47256c62235762f431ba8047561f120004dc \ No newline at end of file
diff --git a/db/schema_migrations/20240104191802 b/db/schema_migrations/20240104191802
new file mode 100644
index 00000000000..36ad8605992
--- /dev/null
+++ b/db/schema_migrations/20240104191802
@@ -0,0 +1 @@
+eb3a7d14833470fe74420874ed883428d54a4d1a24a7f131f2049bf2f7efa929 \ No newline at end of file
diff --git a/db/schema_migrations/20240108082419 b/db/schema_migrations/20240108082419
new file mode 100644
index 00000000000..8286b90e678
--- /dev/null
+++ b/db/schema_migrations/20240108082419
@@ -0,0 +1 @@
+273a951feb99c6064529c3a4403210ec0ff4a0be41867b7b90809b89fd767f5d \ No newline at end of file
diff --git a/db/schema_migrations/20240109082354 b/db/schema_migrations/20240109082354
new file mode 100644
index 00000000000..37ffffb7267
--- /dev/null
+++ b/db/schema_migrations/20240109082354
@@ -0,0 +1 @@
+b264b391bc50ede33db98df9e1e54a074c850e2e4af0c5bd380ce1f32646c95b \ No newline at end of file
diff --git a/db/schema_migrations/20240109090354 b/db/schema_migrations/20240109090354
new file mode 100644
index 00000000000..26f68dd746a
--- /dev/null
+++ b/db/schema_migrations/20240109090354
@@ -0,0 +1 @@
+7420ebb45a2ef0f82527b7427ec741bf8807efb966c317a9fedfda5c04fb4947 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index d7fe66a0086..bd165b96799 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -14344,9 +14344,11 @@ CREATE TABLE ci_instance_variables (
encrypted_value text,
encrypted_value_iv text,
raw boolean DEFAULT false NOT NULL,
+ description text,
CONSTRAINT check_07a45a5bcb CHECK ((char_length(encrypted_value_iv) <= 255)),
CONSTRAINT check_5aede12208 CHECK ((char_length(key) <= 255)),
- CONSTRAINT check_956afd70f1 CHECK ((char_length(encrypted_value) <= 13579))
+ CONSTRAINT check_956afd70f1 CHECK ((char_length(encrypted_value) <= 13579)),
+ CONSTRAINT check_a0a9762afa CHECK ((char_length(description) <= 255))
);
CREATE SEQUENCE ci_instance_variables_id_seq
@@ -14554,6 +14556,7 @@ CREATE TABLE ci_pipeline_artifacts (
verification_checksum bytea,
verification_failure text,
locked smallint DEFAULT 2,
+ partition_id bigint DEFAULT 100 NOT NULL,
CONSTRAINT check_191b5850ec CHECK ((char_length(file) <= 255)),
CONSTRAINT check_abeeb71caf CHECK ((file IS NOT NULL)),
CONSTRAINT ci_pipeline_artifacts_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255))
@@ -14608,6 +14611,7 @@ CREATE TABLE ci_pipeline_metadata (
name text,
auto_cancel_on_new_commit smallint DEFAULT 0 NOT NULL,
auto_cancel_on_job_failure smallint DEFAULT 0 NOT NULL,
+ partition_id bigint DEFAULT 100 NOT NULL,
CONSTRAINT check_9d3665463c CHECK ((char_length(name) <= 255))
);