diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-08 09:07:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-08 09:07:15 +0300 |
commit | 80abbcbeaf4b0c47a8fe6201bd5e2d9c8af6e272 (patch) | |
tree | e729ae01587f97a0375c36aa8fe4f42e5ad91be5 | |
parent | e7dc35bfd6a07a4c23f83b8173df2e4d1963402a (diff) |
Add latest changes from gitlab-org/gitlab@master
20 files changed, 924 insertions, 74 deletions
diff --git a/app/models/namespaces/descendants.rb b/app/models/namespaces/descendants.rb new file mode 100644 index 00000000000..99abda2dd6a --- /dev/null +++ b/app/models/namespaces/descendants.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Namespaces + class Descendants < ApplicationRecord + self.table_name = :namespace_descendants + + belongs_to :namespace + + validates :namespace_id, uniqueness: true + end +end diff --git a/app/models/user.rb b/app/models/user.rb index 9038ce46c14..c9873975cc9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -303,6 +303,10 @@ class User < MainClusterwide::ApplicationRecord # Validations # # Note: devise :validatable above adds validations for :email and :password + validates :username, + presence: true, + exclusion: { in: Gitlab::PathRegex::TOP_LEVEL_ROUTES, message: N_('%{value} is a reserved name') } + validates :username, uniqueness: true, unless: :namespace validates :name, presence: true, length: { maximum: 255 } validates :first_name, length: { maximum: 127 } validates :last_name, length: { maximum: 127 } @@ -313,7 +317,6 @@ class User < MainClusterwide::ApplicationRecord validates :projects_limit, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: Gitlab::Database::MAX_INT_VALUE } - validates :username, presence: true validate :check_password_weakness, if: :encrypted_password_changed? validates :namespace, presence: true, unless: :optional_namespace? @@ -1643,6 +1646,9 @@ class User < MainClusterwide::ApplicationRecord self.errors.add(:base, :username_exists_as_a_different_namespace) else namespace_path_errors.each do |msg| + # Already handled by username validation. + next if msg.ends_with?('is a reserved name') + self.errors.add(:username, msg) end end diff --git a/db/docs/namespace_descendants.yml b/db/docs/namespace_descendants.yml new file mode 100644 index 00000000000..995441b8147 --- /dev/null +++ b/db/docs/namespace_descendants.yml @@ -0,0 +1,12 @@ +--- +table_name: namespace_descendants +classes: +- Namespaces::Descendants +feature_categories: +- groups_and_projects +description: Storing de-normalized descendant ids for Namespace records +introduced_by_url: +milestone: '16.8' +gitlab_schema: gitlab_main_cell +sharding_key: + namespace_id: namespaces diff --git a/db/migrate/20231221171135_create_namespace_descendants_table.rb b/db/migrate/20231221171135_create_namespace_descendants_table.rb new file mode 100644 index 00000000000..5201b132582 --- /dev/null +++ b/db/migrate/20231221171135_create_namespace_descendants_table.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CreateNamespaceDescendantsTable < Gitlab::Database::Migration[2.2] + include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers + + milestone '16.8' + + def up + execute <<~SQL + CREATE TABLE namespace_descendants ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] NOT NULL DEFAULT ARRAY[]::bigint[], + all_project_ids bigint[] NOT NULL DEFAULT ARRAY[]::bigint[], + traversal_ids bigint[] NOT NULL DEFAULT ARRAY[]::bigint[], + outdated_at timestamp with time zone, + calculated_at timestamp with time zone, + PRIMARY KEY(namespace_id) + ) + PARTITION BY HASH (namespace_id); + SQL + + execute <<~SQL + CREATE INDEX + index_on_namespace_descendants_outdated + ON namespace_descendants (namespace_id) + WHERE outdated_at IS NOT NULL + SQL + + create_hash_partitions(:namespace_descendants, 32) + end + + def down + drop_table :namespace_descendants + end +end diff --git a/db/schema_migrations/20231221171135 b/db/schema_migrations/20231221171135 new file mode 100644 index 00000000000..9fe93b8301a --- /dev/null +++ b/db/schema_migrations/20231221171135 @@ -0,0 +1 @@ +b03eee7eff8f7402f3c590b6ae2010c6c278aaa433db52d444a60357bbd8b582
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 97a95c00c4a..0223a9fb431 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2526,6 +2526,304 @@ CREATE TABLE gitlab_partitions_static.issue_search_data_63 ( namespace_id bigint ); +CREATE TABLE namespace_descendants ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +) +PARTITION BY HASH (namespace_id); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_00 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_01 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_02 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_03 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_04 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_05 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_06 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_07 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_08 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_09 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_10 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_11 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_12 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_13 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_14 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_15 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_16 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_17 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_18 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_19 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_20 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_21 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_22 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_23 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_24 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_25 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_26 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_27 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_28 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_29 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_30 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + +CREATE TABLE gitlab_partitions_static.namespace_descendants_31 ( + namespace_id bigint NOT NULL, + self_and_descendant_group_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + all_project_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + traversal_ids bigint[] DEFAULT ARRAY[]::bigint[] NOT NULL, + outdated_at timestamp with time zone, + calculated_at timestamp with time zone +); + CREATE TABLE product_analytics_events_experimental ( id bigint NOT NULL, project_id integer NOT NULL, @@ -26223,6 +26521,70 @@ ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.iss ALTER TABLE ONLY issue_search_data ATTACH PARTITION gitlab_partitions_static.issue_search_data_63 FOR VALUES WITH (modulus 64, remainder 63); +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_00 FOR VALUES WITH (modulus 32, remainder 0); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_01 FOR VALUES WITH (modulus 32, remainder 1); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_02 FOR VALUES WITH (modulus 32, remainder 2); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_03 FOR VALUES WITH (modulus 32, remainder 3); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_04 FOR VALUES WITH (modulus 32, remainder 4); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_05 FOR VALUES WITH (modulus 32, remainder 5); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_06 FOR VALUES WITH (modulus 32, remainder 6); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_07 FOR VALUES WITH (modulus 32, remainder 7); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_08 FOR VALUES WITH (modulus 32, remainder 8); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_09 FOR VALUES WITH (modulus 32, remainder 9); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_10 FOR VALUES WITH (modulus 32, remainder 10); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_11 FOR VALUES WITH (modulus 32, remainder 11); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_12 FOR VALUES WITH (modulus 32, remainder 12); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_13 FOR VALUES WITH (modulus 32, remainder 13); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_14 FOR VALUES WITH (modulus 32, remainder 14); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_15 FOR VALUES WITH (modulus 32, remainder 15); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_16 FOR VALUES WITH (modulus 32, remainder 16); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_17 FOR VALUES WITH (modulus 32, remainder 17); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_18 FOR VALUES WITH (modulus 32, remainder 18); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_19 FOR VALUES WITH (modulus 32, remainder 19); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_20 FOR VALUES WITH (modulus 32, remainder 20); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_21 FOR VALUES WITH (modulus 32, remainder 21); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_22 FOR VALUES WITH (modulus 32, remainder 22); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_23 FOR VALUES WITH (modulus 32, remainder 23); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_24 FOR VALUES WITH (modulus 32, remainder 24); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_25 FOR VALUES WITH (modulus 32, remainder 25); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_26 FOR VALUES WITH (modulus 32, remainder 26); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_27 FOR VALUES WITH (modulus 32, remainder 27); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_28 FOR VALUES WITH (modulus 32, remainder 28); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_29 FOR VALUES WITH (modulus 32, remainder 29); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_30 FOR VALUES WITH (modulus 32, remainder 30); + +ALTER TABLE ONLY namespace_descendants ATTACH PARTITION gitlab_partitions_static.namespace_descendants_31 FOR VALUES WITH (modulus 32, remainder 31); + ALTER TABLE ONLY product_analytics_events_experimental ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_00 FOR VALUES WITH (modulus 64, remainder 0); ALTER TABLE ONLY product_analytics_events_experimental ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_01 FOR VALUES WITH (modulus 64, remainder 1); @@ -27956,6 +28318,105 @@ ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_62 ALTER TABLE ONLY gitlab_partitions_static.issue_search_data_63 ADD CONSTRAINT issue_search_data_63_pkey PRIMARY KEY (project_id, issue_id); +ALTER TABLE ONLY namespace_descendants + ADD CONSTRAINT namespace_descendants_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_00 + ADD CONSTRAINT namespace_descendants_00_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_01 + ADD CONSTRAINT namespace_descendants_01_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_02 + ADD CONSTRAINT namespace_descendants_02_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_03 + ADD CONSTRAINT namespace_descendants_03_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_04 + ADD CONSTRAINT namespace_descendants_04_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_05 + ADD CONSTRAINT namespace_descendants_05_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_06 + ADD CONSTRAINT namespace_descendants_06_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_07 + ADD CONSTRAINT namespace_descendants_07_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_08 + ADD CONSTRAINT namespace_descendants_08_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_09 + ADD CONSTRAINT namespace_descendants_09_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_10 + ADD CONSTRAINT namespace_descendants_10_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_11 + ADD CONSTRAINT namespace_descendants_11_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_12 + ADD CONSTRAINT namespace_descendants_12_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_13 + ADD CONSTRAINT namespace_descendants_13_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_14 + ADD CONSTRAINT namespace_descendants_14_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_15 + ADD CONSTRAINT namespace_descendants_15_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_16 + ADD CONSTRAINT namespace_descendants_16_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_17 + ADD CONSTRAINT namespace_descendants_17_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_18 + ADD CONSTRAINT namespace_descendants_18_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_19 + ADD CONSTRAINT namespace_descendants_19_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_20 + ADD CONSTRAINT namespace_descendants_20_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_21 + ADD CONSTRAINT namespace_descendants_21_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_22 + ADD CONSTRAINT namespace_descendants_22_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_23 + ADD CONSTRAINT namespace_descendants_23_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_24 + ADD CONSTRAINT namespace_descendants_24_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_25 + ADD CONSTRAINT namespace_descendants_25_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_26 + ADD CONSTRAINT namespace_descendants_26_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_27 + ADD CONSTRAINT namespace_descendants_27_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_28 + ADD CONSTRAINT namespace_descendants_28_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_29 + ADD CONSTRAINT namespace_descendants_29_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_30 + ADD CONSTRAINT namespace_descendants_30_pkey PRIMARY KEY (namespace_id); + +ALTER TABLE ONLY gitlab_partitions_static.namespace_descendants_31 + ADD CONSTRAINT namespace_descendants_31_pkey PRIMARY KEY (namespace_id); + ALTER TABLE ONLY product_analytics_events_experimental ADD CONSTRAINT product_analytics_events_experimental_pkey PRIMARY KEY (id, project_id); @@ -31337,6 +31798,72 @@ CREATE INDEX issue_search_data_63_issue_id_idx ON gitlab_partitions_static.issue CREATE INDEX issue_search_data_63_search_vector_idx ON gitlab_partitions_static.issue_search_data_63 USING gin (search_vector); +CREATE INDEX index_on_namespace_descendants_outdated ON ONLY namespace_descendants USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_00_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_00 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_01_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_01 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_02_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_02 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_03_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_03 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_04_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_04 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_05_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_05 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_06_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_06 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_07_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_07 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_08_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_08 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_09_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_09 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_10_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_10 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_11_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_11 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_12_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_12 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_13_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_13 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_14_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_14 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_15_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_15 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_16_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_16 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_17_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_17 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_18_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_18 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_19_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_19 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_20_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_20 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_21_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_21 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_22_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_22 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_23_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_23 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_24_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_24 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_25_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_25 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_26_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_26 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_27_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_27 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_28_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_28 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_29_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_29 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_30_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_30 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + +CREATE INDEX namespace_descendants_31_namespace_id_idx ON gitlab_partitions_static.namespace_descendants_31 USING btree (namespace_id) WHERE (outdated_at IS NOT NULL); + CREATE INDEX index_product_analytics_events_experimental_project_and_time ON ONLY product_analytics_events_experimental USING btree (project_id, collector_tstamp); CREATE INDEX product_analytics_events_expe_project_id_collector_tstamp_idx10 ON gitlab_partitions_static.product_analytics_events_experimental_10 USING btree (project_id, collector_tstamp); @@ -36917,6 +37444,134 @@ ALTER INDEX issue_search_data_pkey ATTACH PARTITION gitlab_partitions_static.iss ALTER INDEX index_issue_search_data_on_search_vector ATTACH PARTITION gitlab_partitions_static.issue_search_data_63_search_vector_idx; +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_00_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_00_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_01_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_01_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_02_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_02_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_03_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_03_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_04_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_04_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_05_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_05_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_06_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_06_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_07_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_07_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_08_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_08_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_09_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_09_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_10_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_10_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_11_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_11_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_12_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_12_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_13_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_13_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_14_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_14_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_15_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_15_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_16_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_16_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_17_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_17_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_18_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_18_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_19_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_19_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_20_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_20_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_21_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_21_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_22_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_22_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_23_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_23_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_24_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_24_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_25_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_25_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_26_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_26_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_27_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_27_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_28_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_28_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_29_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_29_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_30_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_30_pkey; + +ALTER INDEX index_on_namespace_descendants_outdated ATTACH PARTITION gitlab_partitions_static.namespace_descendants_31_namespace_id_idx; + +ALTER INDEX namespace_descendants_pkey ATTACH PARTITION gitlab_partitions_static.namespace_descendants_31_pkey; + ALTER INDEX index_product_analytics_events_experimental_project_and_time ATTACH PARTITION gitlab_partitions_static.product_analytics_events_expe_project_id_collector_tstamp_idx10; ALTER INDEX index_product_analytics_events_experimental_project_and_time ATTACH PARTITION gitlab_partitions_static.product_analytics_events_expe_project_id_collector_tstamp_idx11; diff --git a/doc/administration/dedicated/index.md b/doc/administration/dedicated/index.md index c69162a254f..005017c6178 100644 --- a/doc/administration/dedicated/index.md +++ b/doc/administration/dedicated/index.md @@ -32,6 +32,8 @@ To create a new GitLab Dedicated environment for your organization, provide the - Email addresses of the users who are responsible to complete the onboarding and create your GitLab Dedicated instance using [Switchboard](https://about.gitlab.com/direction/saas-platforms/switchboard/). If you've been granted access to Switchboard, you receive an email invitation with temporary credentials to sign in. +Your invitation to Switchboard is valid for seven days. If you are having issues accessing +Switchboard, or if your invitation has expired, please [submit a support ticket](https://support.gitlab.com/hc/en-us/requests/new?ticket_form_id=4414917877650). NOTE: The credentials for Switchboard are separate from any other GitLab credentials you may already have to sign in to a GitLab self-managed or GitLab.com instance. diff --git a/doc/development/ai_features/index.md b/doc/development/ai_features/index.md index 4c69f26c2de..87c82f85a5a 100644 --- a/doc/development/ai_features/index.md +++ b/doc/development/ai_features/index.md @@ -181,10 +181,9 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test- 1. Ensure that the following environment variables are set in the `.env` file: ```shell - AUTH_BYPASS_EXTERNAL=true - ANTHROPIC_API_KEY="[REDACTED]" # IMPORTANT: Ensure you use Corp account. See https://gitlab.com/gitlab-org/gitlab/-/issues/435911#note_1701762954. - PALM_TEXT_MODEL_NAME=text-bison - PALM_TEXT_PROJECT="[REDACTED]" + AIGW_AUTH__BYPASS_EXTERNAL=true + ANTHROPIC_API_KEY="[REDACTED]" # IMPORTANT: Ensure you use Corp account. See https://gitlab.com/gitlab-org/gitlab/-/issues/435911#note_1701762954. + AIGW_VERTEX_TEXT_MODEL__PROJECT="[REDACTED]" ``` 1. Run `poetry run ai_gateway`. @@ -215,7 +214,7 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test- 1. Create a dummy access token via `gdk rails console` OR skip this step and setup GitLab or Customer Dot as OIDC provider (See the following section): ```ruby - # Creating dummy token, and this will work as long as `AUTH_BYPASS_EXTERNAL=true` in AI Gateway. + # Creating dummy token, and this will work as long as `AIGW_AUTH__BYPASS_EXTERNAL=true` in AI Gateway. ::Ai::ServiceAccessToken.create!(token: 'dummy', expires_at: 1.month.from_now) ``` @@ -272,9 +271,9 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test- 1. Additionally, ensure that the following environment variables are set in the `.env` file: ```shell - GITLAB_URL="http://gdk.test:3000/" - GITLAB_API_URL="http://gdk.test:3000/api/v4/" - AUTH_BYPASS_EXTERNAL=False + AIGW_GITLAB_URL="http://gdk.test:3000/" + AIGW_GITLAB_API_URL="http://gdk.test:3000/api/v4/" + AIGW_AUTH__BYPASS_EXTERNAL=False ``` 1. Restart AI Gateway. @@ -290,7 +289,7 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test- ### Use Customer Dot as OIDC provider in AI Gateway 1. AI Gateway: - 1. Ensure `CUSTOMER_PORTAL_BASE_URL` in the `.env` file points to your Customer Dot URL. + 1. Ensure `AIGW_CUSTOMER_PORTAL_BASE_URL` in the `.env` file points to your Customer Dot URL. 1. Restart ## Experimental REST API diff --git a/doc/development/code_suggestions/index.md b/doc/development/code_suggestions/index.md index f282dbb1223..2bf36664437 100644 --- a/doc/development/code_suggestions/index.md +++ b/doc/development/code_suggestions/index.md @@ -12,7 +12,7 @@ The recommended setup for locally developing and debugging Code Suggestions is t - IDE Extension (e.g. VS Code Extension) - Main application configured correctly -- [Model gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist) +- [AI Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist) This should enable everyone to see locally any change in an IDE being sent to the main application transformed to a prompt which is then sent to the respective model. @@ -29,21 +29,21 @@ This should enable everyone to see locally any change in an IDE being sent to th 1. Run `bundle exec rails c` to start a Rails console 1. Call `Feature.enable(:code_suggestions_tokens_api)` from the console 1. Run the GDK with ```export CODE_SUGGESTIONS_BASE_URL=http://localhost:5052``` -1. [Setup Model Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally) +1. [Setup AI Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally) 1. Build tree sitter libraries ```poetry run scripts/build-tree-sitter-lib.py``` - 1. Extra .env Changes for all debugging insights - 1. LOG_LEVEL=DEBUG - 1. LOG_FORMAT_JSON=false - 1. LOG_TO_FILE=true + 1. Extra .env changes for all debugging insights + 1. `AIGW_LOGGING__LEVEL=DEBUG` + 1. `AIGW_LOGGING__FORMAT_JSON=false` + 1. `AIGW_LOGGING__TO_FILE=true` 1. Watch the new log file ```modelgateway_debug.log``` , e.g. ```tail -f modelgateway_debug.log | fblog -a prefix -a suffix -a current_file_name -a suggestion -a language -a input -a parameters -a score -a exception``` -### Setup instructions to use staging Model Gateway +### Setup instructions to use staging AI Gateway -When testing interactions with the Model Gateway, you might want to integrate your local GDK -with the deployed staging Model Gateway. To do this: +When testing interactions with the AI Gateway, you might want to integrate your local GDK +with the deployed staging AI Gateway. To do this: 1. You need a [cloud staging license](../../user/project/repository/code_suggestions/self_managed.md#upgrade-gitlab) that has the Code Suggestions add-on, because add-ons are enabled on staging. Drop a note in the `#s_fulfillment` internal Slack channel to request an add-on to your license. See this [handbook page](https://about.gitlab.com/handbook/developer-onboarding/#working-on-gitlab-ee-developer-licenses) for how to request a license for local development. -1. Set environment variables to point customers-dot to staging, and the Model Gateway to staging: +1. Set environment variables to point customers-dot to staging, and the AI Gateway to staging: ```shell export GITLAB_LICENSE_MODE=test diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 3dc6dbfff30..cac8f663139 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1339,6 +1339,9 @@ msgstr "" msgid "%{user} user’s menu" msgstr "" +msgid "%{value} is a reserved name" +msgstr "" + msgid "%{value} is not included in the list" msgstr "" diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 7b66087280b..ae9404eac63 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -87,6 +87,7 @@ RSpec.describe 'Database schema', feature_category: :database do merge_request_diffs: %w[project_id], merge_request_diff_commits: %w[commit_author_id committer_id], namespaces: %w[owner_id parent_id], + namespace_descendants: %w[namespace_id], notes: %w[author_id commit_id noteable_id updated_by_id resolved_by_id confirmed_by_id discussion_id namespace_id], notification_settings: %w[source_id], oauth_access_grants: %w[resource_owner_id application_id], diff --git a/spec/factories/namespaces/descendants.rb b/spec/factories/namespaces/descendants.rb new file mode 100644 index 00000000000..6325481294a --- /dev/null +++ b/spec/factories/namespaces/descendants.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :namespace_descendants, class: 'Namespaces::Descendants' do + namespace { association(:group) } + self_and_descendant_group_ids { namespace.self_and_descendant_ids.pluck(:id).sort } + all_project_ids { namespace.all_projects.pluck(:id).sort } + traversal_ids { namespace.traversal_ids } + outdated_at { nil } + calculated_at { Time.current } + end +end diff --git a/spec/finders/ci/runners_finder_spec.rb b/spec/finders/ci/runners_finder_spec.rb index 98e66ca6f31..7e9ef2139c9 100644 --- a/spec/finders/ci/runners_finder_spec.rb +++ b/spec/finders/ci/runners_finder_spec.rb @@ -660,12 +660,13 @@ RSpec.describe Ci::RunnersFinder, feature_category: :fleet_visibility do end context 'by creator' do - let_it_be(:runner_creator_1) { create(:ci_runner, creator_id: '1') } + let_it_be(:creator) { create(:user) } + let_it_be(:runner_with_creator) { create(:ci_runner, creator: creator) } - let(:extra_params) { { creator_id: '1' } } + let(:extra_params) { { creator_id: creator.id } } it 'returns correct runners' do - is_expected.to contain_exactly(runner_creator_1) + is_expected.to contain_exactly(runner_with_creator) end end diff --git a/spec/frontend/ci/pipeline_editor/components/popovers/walkthrough_popover_spec.js b/spec/frontend/ci/pipeline_editor/components/popovers/walkthrough_popover_spec.js index 37339b1c422..d379da390a4 100644 --- a/spec/frontend/ci/pipeline_editor/components/popovers/walkthrough_popover_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/popovers/walkthrough_popover_spec.js @@ -1,24 +1,23 @@ -import { mount, shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; +import { shallowMount } from '@vue/test-utils'; +import { GlButton } from '@gitlab/ui'; import WalkthroughPopover from '~/ci/pipeline_editor/components/popovers/walkthrough_popover.vue'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; - -Vue.config.ignoredElements = ['gl-emoji']; describe('WalkthroughPopover component', () => { let wrapper; - const createComponent = (mountFn = shallowMount) => { - return extendedWrapper(mountFn(WalkthroughPopover)); + const createComponent = () => { + wrapper = shallowMount(WalkthroughPopover, { + components: { + GlEmoji: { template: '<img/>' }, + }, + }); }; describe('CTA button clicked', () => { - beforeEach(async () => { - wrapper = createComponent(mount); - await wrapper.findByTestId('ctaBtn').trigger('click'); - }); - it('emits "walkthrough-popover-cta-clicked" event', () => { + createComponent(shallowMount); + wrapper.findComponent(GlButton).vm.$emit('click'); + expect(wrapper.emitted()['walkthrough-popover-cta-clicked']).toHaveLength(1); }); }); diff --git a/spec/frontend/ci/pipelines_page/components/empty_state/pipelines_ci_templates_spec.js b/spec/frontend/ci/pipelines_page/components/empty_state/pipelines_ci_templates_spec.js index f824dab9ae1..96de1d18aa2 100644 --- a/spec/frontend/ci/pipelines_page/components/empty_state/pipelines_ci_templates_spec.js +++ b/spec/frontend/ci/pipelines_page/components/empty_state/pipelines_ci_templates_spec.js @@ -18,6 +18,9 @@ describe('Pipelines CI Templates', () => { showJenkinsCiPrompt: false, ...propsData, }, + components: { + GlEmoji: { template: '<img/>' }, + }, stubs, }); }; diff --git a/spec/frontend/groups/components/group_item_spec.js b/spec/frontend/groups/components/group_item_spec.js index 94460de9dd6..f2d11f91eb9 100644 --- a/spec/frontend/groups/components/group_item_spec.js +++ b/spec/frontend/groups/components/group_item_spec.js @@ -24,7 +24,7 @@ const createComponent = ( ) => { return mountExtended(GroupItem, { propsData, - components: { GroupFolder }, + components: { GroupFolder, GroupItem }, provide, }); }; @@ -261,10 +261,9 @@ describe('GroupItemComponent', () => { }); it.each` - attr | value - ${'itemscope'} | ${'itemscope'} - ${'itemtype'} | ${'https://schema.org/Organization'} - ${'itemprop'} | ${'subOrganization'} + attr | value + ${'itemtype'} | ${'https://schema.org/Organization'} + ${'itemprop'} | ${'subOrganization'} `('does set correct $attr', ({ attr, value } = {}) => { expect(wrapper.attributes(attr)).toBe(value); }); @@ -281,7 +280,7 @@ describe('GroupItemComponent', () => { }); describe('visibility warning popover', () => { - const findPopover = () => extendedWrapper(wrapper.findComponent(GlPopover)); + const findPopover = () => wrapper.findComponent(GlPopover); const itDoesNotRenderVisibilityWarningPopover = () => { it('does not render visibility warning popover', () => { @@ -343,9 +342,10 @@ describe('GroupItemComponent', () => { if (isPopoverShown) { it('renders visibility warning popover with `Learn more` link', () => { - const popover = findPopover(); + const popover = extendedWrapper(findPopover()); expect(popover.exists()).toBe(true); + expect( popover.findByRole('link', { name: GroupItem.i18n.learnMore }).attributes('href'), ).toBe( diff --git a/spec/lib/gitlab/database/sharding_key_spec.rb b/spec/lib/gitlab/database/sharding_key_spec.rb index eb5a65f30c8..67c1422af3c 100644 --- a/spec/lib/gitlab/database/sharding_key_spec.rb +++ b/spec/lib/gitlab/database/sharding_key_spec.rb @@ -27,7 +27,8 @@ RSpec.describe 'new tables missing sharding_key', feature_category: :cell do let(:allowed_to_be_missing_foreign_key) do [ 'p_catalog_resource_sync_events.project_id', - 'zoekt_indices.namespace_id' + 'zoekt_indices.namespace_id', + 'namespace_descendants.namespace_id' ] end diff --git a/spec/models/namespaces/descendants_spec.rb b/spec/models/namespaces/descendants_spec.rb new file mode 100644 index 00000000000..26d3619ea39 --- /dev/null +++ b/spec/models/namespaces/descendants_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Namespaces::Descendants, feature_category: :database do + describe 'associations' do + it { is_expected.to belong_to(:namespace) } + end + + describe 'validations' do + subject(:namespace_descendants) { create(:namespace_descendants) } + + it { is_expected.to validate_uniqueness_of(:namespace_id) } + end + + describe 'factory' do + let_it_be(:group) { create(:group) } + let_it_be(:subgroup) { create(:group, parent: group) } + + let_it_be(:project1) { create(:project, group: subgroup) } + let_it_be(:project2) { create(:project, group: group) } + + it 'up to date descendant record for a group' do + descendants = create(:namespace_descendants, namespace: group) + + expect(descendants).to have_attributes( + self_and_descendant_group_ids: [group.id, subgroup.id], + all_project_ids: [project1.id, project2.id], + traversal_ids: [group.id] + ) + end + + it 'creates up-to-date descendant record for a subgroup' do + descendants = create(:namespace_descendants, namespace: subgroup) + + expect(descendants).to have_attributes( + self_and_descendant_group_ids: [subgroup.id], + all_project_ids: [project1.id], + traversal_ids: [group.id, subgroup.id] + ) + end + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 58d64742c92..7014c9e685f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -626,38 +626,33 @@ RSpec.describe User, feature_category: :user_profile do end end - describe 'username' do + shared_examples 'username validations' do it 'validates presence' do expect(subject).to validate_presence_of(:username) end - it 'rejects denied names' do - user = build(:user, username: 'dashboard') + context 'when username is reserved' do + let(:username) { 'dashboard' } - expect(user).not_to be_valid - expect(user.errors.messages[:username]).to eq ['dashboard is a reserved name'] - end - - it 'allows child names' do - user = build(:user, username: 'avatar') - - expect(user).to be_valid + it 'rejects denied names' do + expect(user).not_to be_valid + expect(user.errors.messages[:username]).to eq ['dashboard is a reserved name'] + end end - it 'allows wildcard names' do - user = build(:user, username: 'blob') + context 'when username is a child' do + let(:username) { 'avatar' } - expect(user).to be_valid + it 'allows child names' do + expect(user).to be_valid + end end - context 'when username is changed' do - let(:user) { build_stubbed(:user, username: 'old_path', namespace: build_stubbed(:user_namespace)) } + context 'when username is a wildcard' do + let(:username) { 'blob' } - it 'validates move_dir is allowed for the namespace' do - expect(user.namespace).to receive(:any_project_has_container_registry_tags?).and_return(true) - user.username = 'new_path' - expect(user).to be_invalid - expect(user.errors.messages[:username].first).to eq(_('cannot be changed if a personal project has container registry tags.')) + it 'allows wildcard names' do + expect(user).to be_valid end end @@ -666,25 +661,59 @@ RSpec.describe User, feature_category: :user_profile do let!(:other_user) { create(:user, username: username) } it 'is invalid' do - user = build(:user, username: username) - expect(user).not_to be_valid expect(user.errors.full_messages).to eq(['Username has already been taken']) end end - it 'validates format' do - Mime::EXTENSION_LOOKUP.keys.each do |type| - user = build(:user, username: "test.#{type}") + Mime::EXTENSION_LOOKUP.keys.each do |type| + context 'with extension format' do + let(:username) { "test.#{type}" } - expect(user).not_to be_valid - expect(user.errors.full_messages).to include('Username ending with a reserved file extension is not allowed.') - expect(build(:user, username: "test#{type}")).to be_valid + it do + expect(user).not_to be_valid + expect(user.errors.full_messages).to include('Username ending with a reserved file extension is not allowed.') + end + end + + context 'when suffixed by extension type' do + let(:username) { "test#{type}" } + + it do + expect(user).to be_valid + end end end + end + + context 'when creating user' do + let(:user) { build(:user, username: username) } + + include_examples 'username validations' + end + + context 'when updating user' do + let(:user) { create(:user) } + + before do + user.username = username if defined?(username) + end + + include_examples 'username validations' + + context 'when personal project has container registry tags' do + let(:user) { build_stubbed(:user, username: 'old_path', namespace: build_stubbed(:user_namespace)) } + + before do + expect(user.namespace).to receive(:any_project_has_container_registry_tags?).and_return(true) + end - it 'validates format on updated record' do - expect(create(:user).update(username: 'profile.html')).to be_falsey + it 'validates move_dir is allowed for the namespace' do + user.username = 'new_path' + + expect(user).to be_invalid + expect(user.errors.messages[:username].first).to eq(_('cannot be changed if a personal project has container registry tags.')) + end end end diff --git a/spec/requests/api/graphql/ci/runners_spec.rb b/spec/requests/api/graphql/ci/runners_spec.rb index 189106fae7b..bfe5282cbaa 100644 --- a/spec/requests/api/graphql/ci/runners_spec.rb +++ b/spec/requests/api/graphql/ci/runners_spec.rb @@ -165,6 +165,43 @@ RSpec.describe 'Query.runners', feature_category: :fleet_visibility do end end end + + context 'when filtered by creator' do + let_it_be(:user) { create(:user) } + let_it_be(:runner_created_by_user) { create(:ci_runner, :project, creator: user) } + + let(:query) do + %( + query { + runners(creatorId: "#{creator.to_global_id}") { + #{fields} + } + } + ) + end + + context 'when existing user id given' do + let(:creator) { user } + + before do + create(:ci_runner, :project, creator: create(:user)) # Should not be returned + end + + it_behaves_like 'a working graphql query returning expected runners' do + let(:expected_runners) { runner_created_by_user } + end + end + + context 'when non existent user id given' do + let(:creator) { User.new(id: non_existing_record_id) } + + it 'does not return any runners' do + post_graphql(query, current_user: current_user) + + expect(graphql_data_at(:runners, :nodes)).to be_empty + end + end + end end end |