Cascade delayed project removal setting to parent namespace [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
Closes #321724 (closed)
Makes the POC from #291082 (closed) and !51498 (closed) production ready.
This will add the cascading setting framework plus make it work for the first attribute - delayed_project_removal
.
NOTE: Keeping MR as draft until %13.10 release date - this must not be included in %13.10.
Database
Migrate
== 20210308175224 ChangeNamespaceSettingsDelayedProjectRemovalNull: migrating =
-- change_column(:namespace_settings, :delayed_project_removal, :boolean, {:null=>true, :default=>nil})
-> 0.0041s
== 20210308175224 ChangeNamespaceSettingsDelayedProjectRemovalNull: migrated (0.0042s)
== 20210308175225 AddLockDelayedProjectRemovalToNamespaceSettings: migrating ==
-- add_column(:namespace_settings, :lock_delayed_project_removal, :boolean, {:default=>false, :null=>false})
-> 0.0042s
== 20210308175225 AddLockDelayedProjectRemovalToNamespaceSettings: migrated (0.0043s)
== 20210308175226 AddDelayedProjectRemovalToApplicationSettings: migrating ====
-- add_column(:application_settings, :delayed_project_removal, :boolean, {:default=>false, :null=>false})
-> 0.0042s
== 20210308175226 AddDelayedProjectRemovalToApplicationSettings: migrated (0.0042s)
== 20210308175227 AddLockDelayedProjectRemovalToApplicationSettings: migrating
-- add_column(:application_settings, :lock_delayed_project_removal, :boolean, {:default=>false, :null=>false})
-> 0.0040s
== 20210308175227 AddLockDelayedProjectRemovalToApplicationSettings: migrated (0.0040s)
Rollback
== 20210308175227 AddLockDelayedProjectRemovalToApplicationSettings: reverting
-- remove_column(:application_settings, :lock_delayed_project_removal, :boolean, {:default=>false, :null=>false})
-> 0.0113s
== 20210308175227 AddLockDelayedProjectRemovalToApplicationSettings: reverted (0.0132s)
== 20210308175226 AddDelayedProjectRemovalToApplicationSettings: reverting ====
-- remove_column(:application_settings, :delayed_project_removal, :boolean, {:default=>false, :null=>false})
-> 0.0038s
== 20210308175226 AddDelayedProjectRemovalToApplicationSettings: reverted (0.0039s)
== 20210308175225 AddLockDelayedProjectRemovalToNamespaceSettings: reverting ==
-- remove_column(:namespace_settings, :lock_delayed_project_removal, :boolean, {:default=>false, :null=>false})
-> 0.0046s
== 20210308175225 AddLockDelayedProjectRemovalToNamespaceSettings: reverted (0.0047s)
== 20210308175224 ChangeNamespaceSettingsDelayedProjectRemovalNull: reverting =
-- change_column_default(:namespace_settings, :delayed_project_removal, false)
-> 0.0058s
-- change_column_null(:namespace_settings, :delayed_project_removal, false, false)
-> 0.0038s
== 20210308175224 ChangeNamespaceSettingsDelayedProjectRemovalNull: reverted (0.0098s)
SQL
NOTE: Cannot run explain on lock query because the columns don't yet exist.
SELECT "namespace_settings"."delayed_project_removal" FROM "namespace_settings" join unnest(ARRAY[108,109,110,111]) with ordinality t(namespace_id, ord) USING (namespace_id) WHERE (delayed_project_removal IS NOT NULL) ORDER BY t.ord LIMIT 1
Explain: https://explain.depesz.com/s/3SfpV
Limit (cost=0.44..3.90 rows=1 width=9) (actual time=7.626..7.629 rows=1 loops=1)
Buffers: shared read=4
I/O Timings: read=7.548
-> Nested Loop (cost=0.44..346.25 rows=100 width=9) (actual time=7.624..7.626 rows=1 loops=1)
Buffers: shared read=4
I/O Timings: read=7.548
-> Function Scan on unnest t (cost=0.00..1.00 rows=100 width=12) (actual time=0.009..0.010 rows=1 loops=1)
-> Index Scan using namespace_settings_pkey on public.namespace_settings (cost=0.43..3.45 rows=1 width=5) (actual time=7.610..7.610 rows=1 loops=1)
Index Cond: (namespace_settings.namespace_id = t.namespace_id)
Filter: (namespace_settings.delayed_project_removal IS NOT NULL)
Rows Removed by Filter: 0
Buffers: shared read=4
I/O Timings: read=7.548
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Drew Blessing