[
https://issues.apache.org/jira/browse/HAMA-499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Edward J. Yoon updated HAMA-499:
--------------------------------
Description:
As you know, Hama uses ZooKeepr for a barrier synchronization. User can use
Hama ZK, or their own existing ZK cluster. To avoid some potential problems,
BSPMaster calls clearZKNodes() to delete all remained sub-nodes of 'bspRoot' at
initialization stage. That code is here and very ugly:
{code}
public void clearZKNodes() {
try {
for (String node : zk.getChildren(bspRoot, this)) {
for (String subnode : zk.getChildren(bspRoot + "/" + node, this)) {
for (String subnode2 : zk.getChildren(bspRoot + "/" + node, this)) {
for (String subnode3 : zk.getChildren(bspRoot + "/" + node + "/" +
subnode2, this)) {
zk.delete(bspRoot + "/" + node + "/" + subnode + "/" + subnode2 +
"/" + subnode3, 0);
}
zk.delete(bspRoot + "/" + node + "/" + subnode + "/" + subnode2, 0);
}
zk.delete(bspRoot + "/" + node + "/" + subnode, 0);
}
zk.delete(bspRoot + "/" + node, 0);
}
} catch (KeeperException e) {
} catch (InterruptedException e) {
}
}
{code}
In this issue, we'll refactor this method. For example, you can delete
recursively.
P.S., must use '-1' to delete all version of each node like this:
{code}
zk.delete(node, -1);
{code}
was:
We provide Hama ZK cluster, or their own existing ZK cluster as a Hama sync
service. And, BSPMaster calls clearZKNodes() to delete all sub-nodes of
'bspRoot' in ZK cluster when it started initially.
That code is here and very ugly.
{code}
public void clearZKNodes() {
try {
for (String node : zk.getChildren(bspRoot, this)) {
for (String subnode : zk.getChildren(bspRoot + "/" + node, this)) {
for (String subnode2 : zk.getChildren(bspRoot + "/" + node, this)) {
for (String subnode3 : zk.getChildren(bspRoot + "/" + node + "/" +
subnode2, this)) {
zk.delete(bspRoot + "/" + node + "/" + subnode + "/" + subnode2 +
"/" + subnode3, 0);
}
zk.delete(bspRoot + "/" + node + "/" + subnode + "/" + subnode2, 0);
}
zk.delete(bspRoot + "/" + node + "/" + subnode, 0);
}
zk.delete(bspRoot + "/" + node, 0);
}
} catch (KeeperException e) {
} catch (InterruptedException e) {
}
}
{code}
In this issue, we'll refactor this method. For example, you can delete
recursively.
P.S., must use '-1' to delete all version of each node like this:
{code}
zk.delete(node, -1);
{code}
> Refactor clearZKNodes() in BSPMaster
> ------------------------------------
>
> Key: HAMA-499
> URL: https://issues.apache.org/jira/browse/HAMA-499
> Project: Hama
> Issue Type: Improvement
> Components: bsp
> Affects Versions: 0.4.0
> Reporter: Edward J. Yoon
> Labels: newbie
> Fix For: 0.5.0
>
>
> As you know, Hama uses ZooKeepr for a barrier synchronization. User can use
> Hama ZK, or their own existing ZK cluster. To avoid some potential problems,
> BSPMaster calls clearZKNodes() to delete all remained sub-nodes of 'bspRoot'
> at initialization stage. That code is here and very ugly:
> {code}
> public void clearZKNodes() {
> try {
> for (String node : zk.getChildren(bspRoot, this)) {
> for (String subnode : zk.getChildren(bspRoot + "/" + node, this)) {
> for (String subnode2 : zk.getChildren(bspRoot + "/" + node, this)) {
> for (String subnode3 : zk.getChildren(bspRoot + "/" + node + "/"
> + subnode2, this)) {
> zk.delete(bspRoot + "/" + node + "/" + subnode + "/" + subnode2
> + "/" + subnode3, 0);
> }
> zk.delete(bspRoot + "/" + node + "/" + subnode + "/" + subnode2,
> 0);
> }
> zk.delete(bspRoot + "/" + node + "/" + subnode, 0);
> }
> zk.delete(bspRoot + "/" + node, 0);
> }
> } catch (KeeperException e) {
> } catch (InterruptedException e) {
> }
> }
> {code}
> In this issue, we'll refactor this method. For example, you can delete
> recursively.
> P.S., must use '-1' to delete all version of each node like this:
> {code}
> zk.delete(node, -1);
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira