-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add key lock for more resources #2781
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
|
|
oilbeater
approved these changes
May 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of this PR
Which issue(s) this PR fixes:
Fixes #2704
WHAT
🤖 Generated by Copilot at 5dd48e7
This pull request adds and improves concurrency control and data integrity for various controller functions in
kube-ovn
by using mutex locking and unlocking by resource keys. This prevents concurrent updates to the same resources by different workers or threads, and enhances the performance and reliability of the controller logic.🤖 Generated by Copilot at 5dd48e7
HOW
🤖 Generated by Copilot at 5dd48e7
vpcKeyMutex
,nsKeyMutex
, andsvcKeyMutex
to theController
struct and theRun
function inpkg/controller/controller.go
to synchronize access to VPC, namespace, and service resources by their names (link, link, link, link, link, link)subnetStatusKeyMutex
tosubnetKeyMutex
in theController
struct and theRun
function inpkg/controller/controller.go
to reflect its usage for both subnet status updates and subnet logical switch operations (link, link)Controller
struct inpkg/controller/controller.go
to group them by their related resources (link)epKeyMutex
by the endpoint key in thehandleUpdateEndpoint
function inpkg/controller/endpoint.go
to prevent concurrent updates to the same endpoint resource (link)nsKeyMutex
by the namespace key in theprocessNextAddNamespaceWorkItem
function inpkg/controller/namespace.go
to prevent concurrent updates to the same namespace resource (link)nodeKeyMutex
by the node key in thenodeUnderlayAddressSetName
,handleNodeAnnotationsForProviderNetworks
, andupdateProviderNetworkForNodeDeletion
functions inpkg/controller/node.go
to prevent concurrent updates to the same node resource (link, link, link)svcKeyMutex
by the service key in theprocessNextUpdateServiceWorkItem
,handleUpdateService
, andhandleAddService
functions inpkg/controller/service.go
to prevent concurrent updates to the same service resource (link, link, link)subnetKeyMutex
by the subnet name in thehandleAddOrUpdateSubnet
,handleUpdateSubnetStatus
, andhandleDeleteLogicalSwitch
functions inpkg/controller/subnet.go
to prevent concurrent updates to the same subnet resource (link, link, link)vlanKeyMutex
by the VLAN key in theprocessNextDelVlanWorkItem
,handleAddVlan
, andhandleUpdateVlan
functions inpkg/controller/vlan.go
to prevent concurrent updates to the same VLAN resource (link, link, link)vpcKeyMutex
by the VPC name or key in therunDelVpcWorker
,handleDelVpc
, andaddLoadBalancer
functions inpkg/controller/vpc.go
to prevent concurrent updates to the same VPC resource (link, link, link)pkg/controller/vlan.go
file for minor formatting improvement (link)