[go: up one dir, main page]

Skip to content

User mapping - Delete placeholder users when top-level group is deleted

When the top-level group is deleted, we should also try to delete the placeholder users, as these users will no longer be used.

However, because placeholder users might still be in use by transferred groups and projects, we need to make sure the placeholder users aren't in use before deleting them.

Proposal

Let's create an auxiliary table to hold additional placeholder user information.

Before deleting the group, we should record in the auxiliary table that the placeholder users are eligible for removal. Subsequently, a cron job will periodically attempt to delete any placeholder users marked for deletion.

The cronjob would list all placeholder users eligible for deletion and call Import::DeletePlaceholderUserWorker. Note that placeholder users may still be associated with transferred contributions. In this case, the flag marked for deletion could be changed to false so that the cronjob doesn't pick it up again.

The table could be like this:

Table (placeholder_user_attributes)

Column Description
placeholder_user_id
marked_for_deletion Set to true when user should be deleted
deletion_attempts
last_deletion_attempt_at We could attempt to delete the user once a month

Note this table would have to be gitlab_main_clusterwide

FYI, this idea is based on Luke's idea to handle transfers.

Edited by Martin Wortschack