[
https://issues.apache.org/jira/browse/ZOOKEEPER-645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Martin updated ZOOKEEPER-645:
----------------------------------
Attachment: ZOOKEEPER-645.3.patch.txt
It seems as though both of the patches uploaded to date address real issues.
I've combined both patches and added a couple small changes:
- session ID is always padded out to the maximum number of digits in a long
(this is purely an esthetic change, but I added a test case to make sure that
the previous format and the current format could be intermingled).
- using a regex to extract the sequence ID from the znode. I'm doing this
based on the assumption that sequence numbers will always be padded to 10
digits (as stated on the wiki). This seemed a little more robust than simply
looking for the last index of '-' if, for example, somebody exactly creates a
znode in the directory where you only expect lock-related paths. On a related
note: is there no way to tell if a znode was created as a sequential node from
the Stat object. I see "ephemeralOwner", but no equivalent for checking if the
node was created as a sequential node.
After writing that last bullet point, I'm realizing that it would probably be
best to use "ephemeralOwner" instead of explicitly adding the session ID to the
path... I'll try to change that in a future patch.
> Bug in WriteLock recipe implementation?
> ---------------------------------------
>
> Key: ZOOKEEPER-645
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-645
> Project: ZooKeeper
> Issue Type: Bug
> Components: recipes
> Affects Versions: 3.2.2
> Environment: 3.2.2 java 1.6.0_12
> Reporter: Jaakko Laine
> Assignee: Mahadev konar
> Priority: Minor
> Fix For: 3.5.0
>
> Attachments: 645-fix-findPrefixInChildren.patch,
> ZOOKEEPER-645.3.patch.txt, ZOOKEEPER-645-compareTo.patch
>
>
> Not sure, but there seem to be two issues in the example WriteLock:
> (1) ZNodeName is sorted according to session ID first, and then according to
> znode sequence number. This might cause starvation as lower session IDs
> always get priority. WriteLock is not thread-safe in the first place, so
> having session ID involved in compare operation does not seem to make sense.
> (2) if findPrefixInChildren finds previous ID, it should add dir in front of
> the ID
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira