private void setFieldData(Type type, String id, String name, String val) throws Exception {
    try {
      zk.create().withMode(CreateMode.PERSISTENT).withACL(Ids.OPEN_ACL_UNSAFE)
        .forPath(makeFieldZnode(type, id, name), val.getBytes(ENCODING));
    } catch (KeeperException.NodeExistsException e) {
      zk.setData().forPath(makeFieldZnode(type, id, name), val.getBytes(ENCODING));
    }
  }
A helper method that sets a field value.
@throws java.lang.Exception
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/ZooKeeperStorage.java