WIP: Graceful locking for internal ids
What does this MR do?
With this change, we use
FOR UPDATE SKIP LOCKED which does not block but indicates if the lock was not granted (by returning 0 rows here). If we don't get the lock, we simply wait a bit and retry the same logic. This avoids running into statement timeout while waiting for the grant.
There are indicators in https://gitlab.com/gitlab-com/gl-infra/infrastructure/snippets/1865195#master-1022016104-17, that we spend a lot of time on this query.
Issue: #63093 (closed)
Does this MR meet the acceptance criteria?
- Changelog entry
- Documentation created/updated or follow-up review issue created
- Code review guidelines
- Merge request performance guidelines
- Style guides
- Database guides
- Separation of EE specific content
Performance and testing
- Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
- Tested in all supported browsers
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
- 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