Skip to content

Fix nonatomic database update potentially causing project star counts to go negative

Stan Hu requested to merge stanhu/gitlab-ce:fix-issue-3067 into master

The counter_cache decrement function is called when a project star is deleted, but there was no guarantee multiple workers would not attempt to delete the same item simultaneously. Use an atomic update to prevent the count from going negative.

Note: I was only able to duplicate the issue on GitLab.com, but I haven't been able to replicate it anywhere else. Presumably this bug happens when the WHERE clause takes some time to search for the right entry and multiple requests get sent simultaneously. Need to verify whether this fix truly solves the issue.

Closes #3067 (closed)

Merge request reports