summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-11-18 13:39:06 +0000
committerRémy Coutable <remy@rymai.me>2016-11-18 13:39:06 +0000
commitcda016651d59fe8402931c7b239b3d4ff5784aa6 (patch)
treecc3af433b63635ecc556afacb4f5571388e8c3cb /app
parentbccdf9f5570728eb312fb0bde26467dfa61d6a91 (diff)
parent6806fdf080171977b36df99c4bbe8d17c669990a (diff)
downloadgitlab-ce-cda016651d59fe8402931c7b239b3d4ff5784aa6.tar.gz
Merge branch '23223-group-deletion-race-condition' into 'master'
Remove race condition while deleting groups ## What does this MR do? The intended flow during a group deletion is: ``` Soft-delete group (sync) -> Delete group projects (async) -> Hard-delete group (async) ``` The soft-delete was run in a transaction, which was committed only after the async job (for hard-deletion) was kicked off. There was a race condition here - the soft-delete transaction could complete _after_ the hard delete completed, leaving a soft-deleted record in the database. This MR removes this race condition. There is no need to run the soft-delete in a transaction. The soft-delete completes before the async job is kicked off. This MR also adds a migration to delete all existing (soft-deleted) groups left in an inconsistent state due to this bug. - Closes #23223 - EE merge request: gitlab-org/gitlab-ee!886 See merge request !7528
Diffstat (limited to 'app')
-rw-r--r--app/services/destroy_group_service.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/services/destroy_group_service.rb b/app/services/destroy_group_service.rb
index 0081364b8aa..a880952e274 100644
--- a/app/services/destroy_group_service.rb
+++ b/app/services/destroy_group_service.rb
@@ -6,12 +6,10 @@ class DestroyGroupService
end
def async_execute
- group.transaction do
- # Soft delete via paranoia gem
- group.destroy
- job_id = GroupDestroyWorker.perform_async(group.id, current_user.id)
- Rails.logger.info("User #{current_user.id} scheduled a deletion of group ID #{group.id} with job ID #{job_id}")
- end
+ # Soft delete via paranoia gem
+ group.destroy
+ job_id = GroupDestroyWorker.perform_async(group.id, current_user.id)
+ Rails.logger.info("User #{current_user.id} scheduled a deletion of group ID #{group.id} with job ID #{job_id}")
end
def execute