Skip to content

Resolve "Prevent accidental deletions via soft delete for groups" - workers (MR: 2/n)

What does this MR do?

For #33257 (closed)

MR 2/n

I am splitting this feature into multiple MRs. This is the 2nd MR which adds necessary worker required to perform the cron job everyday of finding the already soft-deleted groups that are ready for permanent deletion and enqueueing the job for permanent deletion.

Database

The affected table was introduced only last week with !20276 (merged). Also, the changes (services, controllers etc) to insert rows into this table has not been merged yet, so this table will not have more than 0 records before this migration is merged. So I think it's safe to do the removal of the foreign key first before creating a secondary foreign key.

Queries

Group.aimed_for_deletion(deletion_cutoff).with_deletion_schedule

SELECT "namespaces".* FROM "namespaces" INNER JOIN "group_deletion_schedules" ON "group_deletion_schedules"."group_id" = "namespaces"."id" WHERE "namespaces"."type" IN ('Group') AND (group_deletion_schedules.marked_for_deletion_on <= '2019-11-26')

GroupDeletionSchedule Load (0.3ms)  SELECT "group_deletion_schedules".* FROM "group_deletion_schedules" WHERE "group_deletion_schedules"."group_id" = $1  [["group_id", 61]]

Route Load (4.3ms)  SELECT  "routes".* FROM "routes" WHERE "routes"."source_id" = $1 AND "routes"."source_type" = $2 LIMIT $3  [["source_id", 61], ["source_type", "Namespace"], ["LIMIT", 1]]

https://explain.depesz.com/s/HsVS

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 Alper Akgun

Merge request reports

Loading