Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Wrap stats update with lock during parallel sync #315

Merged
merged 2 commits into from
Jul 27, 2019

Conversation

aramase
Copy link
Member

@aramase aramase commented Jul 26, 2019

Reason for Change:

Wrap stats update with a lock to prevent concurrent access in the sync loop where nodes are processed in parallel.

Issue Fixed:

Notes for Reviewers:

@@ -58,7 +58,9 @@ type Client struct {
SyncLoopStarted bool
syncRetryInterval time.Duration

syncing int32 // protect against conucrrent sync's
syncing int32 // protect against conucrrent sync's
statsMutex sync.Mutex
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a stats property and locking should be internally handled by stats.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is really the only place where stats is updated in parallel currently. I think we can switch to moving it to stats and wrapping in structs next.

@kkmsft
Copy link
Contributor

kkmsft commented Jul 27, 2019

Merging with the TODO that we will move the mutex to inside stats before 1.5 release.

@kkmsft kkmsft merged commit 6e83e31 into Azure:master Jul 27, 2019
@aramase aramase deleted the stats-sync branch July 27, 2019 00:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants