[
https://issues.apache.org/jira/browse/HADOOP-14543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16060533#comment-16060533
]
Rakesh R commented on HADOOP-14543:
-----------------------------------
Thanks all for pointing out this, am adding [ZooKeeper user mailing list
discussion
thread|http://zookeeper-user.578899.n2.nabble.com/Version-parameter-passed-to-ZooKeeper-setACL-td7583140.html]
link. The fix looks good to me.
Just curiosity I've tried unit testing this part. Perhaps, you could include
this unit test as well.
{code}
/**
* Test to verify that proper ZooKeper ACLs can be updated on
* ActiveStandbyElector's parent znode.
*/
@Test(timeout = 15000)
public void testSetZooKeeperACLsOnParentZnodeName() throws Exception {
ActiveStandbyElectorCallback cb = Mockito
.mock(ActiveStandbyElectorCallback.class);
ActiveStandbyElector elector = new ActiveStandbyElector(hostPort, 5000,
PARENT_DIR, Ids.READ_ACL_UNSAFE, Collections.<ZKAuthInfo> emptyList(),
cb, CommonConfigurationKeys.HA_FC_ELECTOR_ZK_OP_RETRIES_DEFAULT);
// Simulate the case by pre-creating znode 'parentZnodeName'. Then updates
// znode's data so that data version will be increased to 1. Here znode's
// aversion is 0.
ZooKeeper otherClient = createClient();
otherClient.create(PARENT_DIR, "sample1".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
otherClient.setData(PARENT_DIR, "sample2".getBytes(), -1);
otherClient.close();
elector.ensureParentZNode();
}
{code}
> Should use getAversion() while setting the zkacl
> ------------------------------------------------
>
> Key: HADOOP-14543
> URL: https://issues.apache.org/jira/browse/HADOOP-14543
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Brahma Reddy Battula
> Assignee: Brahma Reddy Battula
> Attachments: HADOOP-14543.patch
>
>
> while setting the zkacl we used {{getVersion()}} which is dataVersion,Ideally
> we should use {{getAversion()}}. If there is any acl changes( i.e relam
> change/..) ,we set the ACL with dataversion which will cause BADVersion and
> *process will not start*. See
> [here|https://issues.apache.org/jira/browse/HDFS-11403?focusedCommentId=16051804&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16051804]
> {{zkClient.setACL(path, zkAcl, stat.getVersion());}}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]