Uploaded image for project: 'Hama'
  1. Hama
  2. HAMA-499

Refactor clearZKNodes() in BSPMaster

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.4.0
    • 0.5.0
    • bsp core

    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:

        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) {
          }
        }
      

      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:

      zk.delete(node, -1);
      

      Attachments

        1. HAMA-499.patch
          14 kB
          Apurv Verma
        2. HAMA-499_2.patch
          7 kB
          Apurv Verma
        3. move.sh
          0.1 kB
          Apurv Verma

        Activity

          People

            dapurv5 Apurv Verma
            udanax Edward J. Yoon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: