Skip to content
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

fix(mod/lock): correct watch index to remove cpu load #593

Merged
merged 1 commit into from
Feb 27, 2014

Conversation

benbjohnson
Copy link
Contributor

The waitIndex was being pulled from the wrong node in the lock parent which caused the watch to be returned immediately. This caused a continuous stream of get/watch calls while a client was waiting for a lock.

Confirmed with @oleksiyk that this change fixes #575.

/cc @philips @xiangli-cmu

@@ -42,16 +42,16 @@ func (s lockNodes) FindByValue(value string) (*etcd.Node, int) {
}

// Retrieves the index that occurs before a given index.
Copy link
Contributor

Choose a reason for hiding this comment

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

@benbjohnson I think we need to add some comments to make this function more easy to understand.

Find the node with the largest index in the lockNodes that is smaller than the given index. Also return the lastModified index of that node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xiangli-cmu I expanded on the function comment and a comment within the function itself.

The waitIndex was being pulled from the wrong node in the lock parent which caused the watch to be returned immediately. This caused a continuous set of calls while a client was waiting for a lock.
@xiang90
Copy link
Contributor

xiang90 commented Feb 27, 2014

lgtm

benbjohnson added a commit that referenced this pull request Feb 27, 2014
fix(mod/lock): correct watch index to remove cpu load
@benbjohnson benbjohnson merged commit a60481c into etcd-io:master Feb 27, 2014
@benbjohnson benbjohnson deleted the lock-fix branch February 27, 2014 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

High CPU load with Locks
2 participants