Skip to content

feat(frontend): Remove the subscription lock - #5538

Closed
Matthew Barnes (mbarnes) wants to merge 1 commit into
Azure:mainfrom
mbarnes:1p/remove-subscription-lock
Closed

Matthew Barnes (mbarnes) wants to merge 1 commit into
Azure:mainfrom
mbarnes:1p/remove-subscription-lock

Conversation

@mbarnes

@mbarnes Matthew Barnes (mbarnes) commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

ARO-27391 - Remove subscription lock from RP write paths

What

HOLD until the below description is actually true. CS removal from frontend is still a work-in-progress.

Now that Clusters Service calls have been moved to the RP backend, the frontend pods need only write to Cosmos DB before responding to client requests. This can be done atomically using Cosmos DB's Transactional Batch Operations and therefore the cloud-distributed locking pattern is no longer needed.

Why

The locking pattern was a bottleneck in high-traffic subscriptions and was the source of much latency in the Azure control plane.

Testing

This is purely code removal, so no new tests required. All existing tests must still pass.

PR Checklist

  • PR is scoped to a single task (no mixed concerns)
  • Title follows Conventional Commits format
  • Summary explains the "Why" behind the change
  • Linked to relevant ticket/issue
  • Screenshots included (if graph/UI/metrics changes)
  • Self-reviewed the diff
  • CI/CD checks are passing (ignore Tide)
  • Draft PR used for WIP (if applicable)
  • Commit history is clean (rebased/squashed)
  • Tricky code blocks are commented
  • Specific reviewers tagged
  • All comment threads resolved before merge

Now that Clusters Service calls have been moved to the RP backend,
the frontend pods need only write to Cosmos DB before responding
to client requests. This can be done atomically using Cosmos DB's
Transactional Batch Operations and therefore the cloud-distributed
locking pattern is no longer needed.

The locking pattern was a bottleneck in high-traffic subscriptions
and was the source of much latency in the Azure control plane.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the frontend’s subscription-scoped locking mechanism and the associated Cosmos “locks” DB client/mocks, updating frontend construction and integration/unit test scaffolding accordingly.

Changes:

  • Remove subscription lock middleware from frontend routing and delete the lock middleware implementation/tests.
  • Remove LocksDBClient plumbing (Cosmos client, mocks, and integration test interfaces/implementations).
  • Update frontend constructors/call sites (cmd, unit tests, integration test harness) to match the new signature.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test-integration/utils/integrationutils/utils.go Updates integration test frontend creation to match the new NewFrontend signature.
test-integration/utils/integrationutils/mock_cosmos_testinfo.go Removes mock Locks DB client from mock Cosmos integration test info.
test-integration/utils/integrationutils/frontend_testinfo.go Removes LocksDBClient() from the storage test info interface.
test-integration/utils/integrationutils/cosmos_testinfo.go Removes real Locks DB client creation/storage from Cosmos integration test info.
internal/databasetesting/mock_locks_db_client.go Deletes the mock Locks DB client implementation.
internal/databasetesting/mock_dbclient_test.go Removes unit test coverage for the deleted mock lock client.
internal/database/locks_db_client.go Deletes the Locks DB client implementation.
internal/database/lock.go Deletes the lock client implementation and related types/helpers.
frontend/pkg/frontend/testhelpers.go Updates test helper frontend creation to remove locks client.
frontend/pkg/frontend/routes.go Removes subscription lock middleware from request handling chains.
frontend/pkg/frontend/middleware_locksubscription.go Deletes the subscription lock middleware implementation.
frontend/pkg/frontend/middleware_locksubscription_test.go Deletes tests for the removed middleware.
frontend/pkg/frontend/frontend.go Removes locksDBClient from Frontend and NewFrontend signature/state.
frontend/pkg/frontend/frontend_test.go Updates unit tests to construct frontend without locks client.
frontend/cmd/cmd.go Removes locks DB client creation and updates frontend startup wiring.

Comment thread frontend/pkg/frontend/routes.go
@miguelsorianod

Copy link
Copy Markdown
Collaborator

/lgtm

@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mbarnes, miguelsorianod

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mbarnes

Copy link
Copy Markdown
Collaborator Author

This was cherry-picked into #6121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants