Skip to content

WIP: Graceful locking for internal ids

Andreas Brandl requested to merge ab-internal-id-graceful-locking into master

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: https://gitlab.com/gitlab-org/gitlab-ce/issues/63093

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

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 @gitlab-com/gl-security/appsec
  • 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
Edited by Andreas Brandl

Merge request reports