feat(frontend): Remove the subscription lock - #5538
Matthew Barnes (mbarnes) wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
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
LocksDBClientplumbing (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. |
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
PR needs rebase. DetailsInstructions 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. |
|
This was cherry-picked into #6121. |
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