Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

added a validation to check whether lock exists in case of network pa… #230

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

continuum-Nikhil-Bhide
Copy link

This addresses #229

@continuum-Nikhil-Bhide
Copy link
Author

continuum-Nikhil-Bhide commented Feb 9, 2020

IT seems that CI is failing on the make command.
FAIL github.com/samuel/go-zookeeper/zk 500.019s
Makefile:37: recipe for target 'test' failed
make: *** [test] Error 1
The command "make" exited with 2.

zk/lock.go Outdated Show resolved Hide resolved
zk/lock.go Outdated Show resolved Hide resolved
zk/lock.go Outdated Show resolved Hide resolved
zk/lock.go Outdated Show resolved Hide resolved
zk/lock.go Outdated Show resolved Hide resolved
zk/lock.go Outdated Show resolved Hide resolved
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.4%) to 78.222% when pulling 3853aff on continuum-Nikhil-Bhide:zk_229_lock_deadlock into 2cc03de on samuel:master.

@coveralls
Copy link

coveralls commented Feb 10, 2020

Coverage Status

Coverage increased (+0.3%) to 79.886% when pulling 6288894 on continuum-Nikhil-Bhide:zk_229_lock_deadlock into 2cc03de on samuel:master.

Copy link

@ydidukh ydidukh left a comment

Choose a reason for hiding this comment

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

This fix doesn't solve the problem you've described. CreateProtectedEphemeralSequential may return an empty path, while znode itself can be normally created by ZK server. To implement fix right, you need to match session identifiers for zknode objects and your connection if they are the same, and if so then you can assume that lock is acquired.

In addition to this you need to add tests for your new code and ensure that your code is properly formatted as it seems that it's not following golang styleguides.

Copy link

@Metalscreame Metalscreame left a comment

Choose a reason for hiding this comment

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

As @ydidukh this might work. Have you tried to test it manually?

Suggestion. Is there a possibility to listen for the State of the client? if yes, there might be a way to make new connection when the state is back to connected and assign session identifiers existing locks (or recreate them with new identifiers).

@continuum-Nikhil-Bhide
Copy link
Author

Hi Samuel,
Requesting you to verify this change and approve the merge.

  • Nikhil

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.

5 participants