You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Nitay Joffe (JIRA)" <ji...@apache.org> on 2009/01/25 19:52:59 UTC

[jira] Updated: (HBASE-1144) Store the ROOT region location in Zookeeper

     [ https://issues.apache.org/jira/browse/HBASE-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nitay Joffe updated HBASE-1144:
-------------------------------

    Attachment: hbase-1144.patch

I've attached a patch which is an update of the patches from HBASE-546.

Replying to comments from https://issues.apache.org/jira/browse/HBASE-546:

> Jean-Daniel Cryans - 21/Jan/09 07:33 AM
> Nitay,
> 
> The config in hbase-default.xml should be expressed as numbers and not operations like zookeeper.pause should be 2000 and not 2 * 1000. Also, since zookeeper.servers requires to be set for a fully distributed HBase,so you should modify the src/java/overview.html file.

Fixed.

> stack - 21/Jan/09 02:46 PM
> For zookeeper.servers, you specify a quorum by listing the quorum members?

Yes. This parameter feeds directly into the ZooKeeper object constructor. For example, I'm using in my config:

<name>zookeeper.servers</name>
<value>aa0-001-13.u.powerset.com:2181,aa0-000-12.u.powerset.com:2181,aa0-000-13.u.powerset.com:2181,aa0-000-14.u.powerset.com:2181...

> When single-instance of zk that has been started by hbase runs, where does it write its logs. Can that be configurable?
>
> What if I specify a full-path for zookeeper.znode.rootserver, will that write root region location outside of zookeeper.znode.parent?

Not as it was. Now it will. Fixed.

> (Regards a question you asked on IRC a few days ago) If things like DEFAULT_ZOOKEEPER_SERVERS , are only used in one place, I'd say don't need to be in HConstants... just do it in place used. If used more than once, its good to define HConstants AND they are used by more than one class (otherwise, do the define inside that class)
>
> Should below be synchronized nitay?
>
> + private ZooKeeperWrapper getZooKeeperWrapper() throws IOException {
>
> Is there danger that two threads could be asking for it at about same time?

Yes, good call. Fixed.

> This is an interesting change Nitay: - public HServerAddress findRootRegion();... removing it from the Master. I like it. ZK rules now!
> 
> Below....
> + * Copyright 2008 The Apache Software Foundation
> ... should be 2009

Fixed.

> Below has trailing '\'
>
> + * Wraps a ZooKeeper instance and adds HBase specific functionality.\

Fixed.

> Can these be final in ZKWrapper?
> 
> + private ZooKeeper zooKeeper;
> + private WatcherWrapper watcher;

Fixed.

> ... same in HRS:
> 
> + private ZooKeeperWrapper zooKeeperWrapper;

Fixed.

> In below...
> 
> + rootRegionZNode = parentZNode + "/" + rootServerZNodeName;
> 
> ... does ZK have a define for path separator?

Not that I can see in the code. I filed a JIRA for this: https://issues.apache.org/jira/browse/ZOOKEEPER-277. I put in my own constant for this with a comment to fix when that issue gets resolved.

> We don't throw exception if we fail to get root:
> 
> +    try {
> +      data = zooKeeper.getData(rootRegionZNode, false, null);
> +    } catch (InterruptedException e) {
> +      return null;
> +    } catch (KeeperException e) {
> +      return null;
> +    }
> 
> ... is that good? Does caller handle null?

Yes. There are two callers to this method:

HConnectionManager:

  if (outOfSafeMode) {
    rootRegionAddress = zooKeeperWrapper.readRootRegionLocation();
  }
  if (rootRegionAddress == null) {
    try {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Sleeping " + getPauseTime(tries) +
          "ms, waiting for root region.");
      }
      Thread.sleep(getPauseTime(tries));
    } catch (InterruptedException iex) {
      // continue
    }
    localTimeouts++;
  }

HRegionServer:

  HServerAddress rootServer = zooKeeperWrapper.readRootRegionLocation();
  if (rootServer != null) {
    // By setting the root region location, we bypass the wait imposed on
    // HTable for all regions being assigned.
    this.connection.setRootRegionLocation(
        new HRegionLocation(HRegionInfo.ROOT_REGIONINFO, rootServer));
    haveRootRegion.set(true);
  }

> Whats story w/ data in ZK? Its byte arrays? Should they be UTF-8? If so, Bytes.toBytes over in hbase util might help. E.g. rather than + String addressString = new String(data); ...
> which could give different answers if the client was in different local than original writer, be explicit its utf-8 and do Bytes.toBytes(....) when writing and Bytes.toString(... when getting?

Good call. I was doing the Bytes.toBytes() side of things, but not the Bytes.toString() side. Fixed.

> Store the ROOT region location in Zookeeper
> -------------------------------------------
>
>                 Key: HBASE-1144
>                 URL: https://issues.apache.org/jira/browse/HBASE-1144
>             Project: Hadoop HBase
>          Issue Type: Sub-task
>            Reporter: Jean-Daniel Cryans
>            Assignee: Nitay Joffe
>         Attachments: hbase-1144.patch
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.