Path lock validations are not memoized properly
In ChangeAccess#validate_path_locks
, we attempt to memoize the state in https://gitlab.com/gitlab-org/gitlab-ee/blob/v10.3.2-ee/lib/gitlab/checks/change_access.rb#L299, but it turns out we hit this every time if the value returns false
. See https://jtway.co/how-to-memoize-false-and-nil-values-fe28b8ede9f8 for more details.
This leads to excessive SQL queries for large diffs and contributes to unicorn timing out.
ZD: https://gitlab.zendesk.com/agent/tickets/89075
/cc: @vsizov
Edited by Stan Hu