-
Notifications
You must be signed in to change notification settings - Fork 131
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 parseSeq incorrectly parsing negative sequence number #65
Conversation
7ef4fb2
to
c1e98b7
Compare
From the ZK docs:
|
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
==========================================
+ Coverage 75.27% 76.28% +1.00%
==========================================
Files 7 7
Lines 1189 1189
==========================================
+ Hits 895 907 +12
+ Misses 202 193 -9
+ Partials 92 89 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks for that link to the ZK docs @pmazzini! After I encountered this I searched for details in the docs but hadn't come across that paragraph. |
Another option would just do a SplitN(..., 1) to only split on the first - |
I think |
What I am confused about is that the Java implementation does not look to be checking negative numbers: |
Interesting, that does seem to be a bug in the Java implementation as well. I've open an issue in the Apache JIRA regarding that: https://issues.apache.org/jira/browse/ZOOKEEPER-4372 |
I submitted a PR for the Java implementation as well: apache/zookeeper#1751 |
Seems good to me, @pmazzini any thoughts or good to merge? |
Looks good to me |
Hi, just wanted to see if we could get this merged in as it sounds like there were no major concerns with this PR. Thanks! |
This PR includes a change to the
parseSeq
function used by the lock to parse sequence numbers. When the Zookeeper sequence number rolls over it rolls to -2147483647 rather than 0.parseSeq
splits on a "-" symbol so when the path is split into parts the negative symbol is stripped away incorrectly. I changed this to split on the full prefix of "lock-" instead which saves the negative symbol. A test for this is included.