You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2010/05/26 09:41:43 UTC

svn commit: r948356 - in /hbase/branches/0.20: ./ src/docs/src/documentation/ src/docs/src/documentation/content/xdocs/ src/java/org/apache/hadoop/hbase/ src/java/org/apache/hadoop/hbase/client/ src/java/org/apache/hadoop/hbase/master/ src/java/org/apa...

Author: stack
Date: Wed May 26 07:41:42 2010
New Revision: 948356

URL: http://svn.apache.org/viewvc?rev=948356&view=rev
Log:
HBASE-2568 Add new svn, ml, and website locations into branches/0.20/src/doc...

Modified:
    hbase/branches/0.20/CHANGES.txt
    hbase/branches/0.20/src/docs/src/documentation/content/xdocs/releasenotes.xml
    hbase/branches/0.20/src/docs/src/documentation/content/xdocs/site.xml
    hbase/branches/0.20/src/docs/src/documentation/content/xdocs/tabs.xml
    hbase/branches/0.20/src/docs/src/documentation/skinconf.xml
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ClusterStatus.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/HServerInfo.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HTable.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.20/src/webapps/master/table.jsp

Modified: hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/CHANGES.txt?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/CHANGES.txt (original)
+++ hbase/branches/0.20/CHANGES.txt Wed May 26 07:41:42 2010
@@ -1,6 +1,6 @@
 HBase Change Log
 
-Release 0.20.5 - Mon May 17 10:14:58 PDT 2010
+Release 0.20.5 - Wed May 26 00:15:56 PDT 2010
 
   BUG FIXES
    HBASE-2545  Unresponsive region server, potential deadlock
@@ -16,6 +16,7 @@ Release 0.20.5 - Mon May 17 10:14:58 PDT
 
   IMPROVEMENTS
    HBASE-2567  [stargate] minimize differences between 0.20 branch and trunk
+   HBASE-2568  Add new svn, ml, and website locations into branches/0.20/src/doc
 
 Release 0.20.4 - Mon May  3 16:16:02 PDT 2010
   INCOMPATIBLE CHANGES

Modified: hbase/branches/0.20/src/docs/src/documentation/content/xdocs/releasenotes.xml
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/docs/src/documentation/content/xdocs/releasenotes.xml?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/docs/src/documentation/content/xdocs/releasenotes.xml (original)
+++ hbase/branches/0.20/src/docs/src/documentation/content/xdocs/releasenotes.xml Wed May 26 07:41:42 2010
@@ -22,34 +22,11 @@
 <document> 
 <header> 
     <title>
-   Release Notes - Hadoop HBase - Version 0.20.5
+   Release Notes - Hadoop HBase
     </title>
 </header> 
 <body>
-<section>
-    <section><title>        Bug
-    </title>
-            <ul>
-                <li>[<a href='https://issues.apache.org/jira/browse/HBASE-2428'>HBASE-2428</a>] -         NPE in ProcessRegionClose because meta is offline kills master and thus the cluster
-                </li>
-                <li>[<a href='https://issues.apache.org/jira/browse/HBASE-2482'>HBASE-2482</a>] -         regions in transition do not get reassigned by master when RS crashes
-                </li>
-                <li>[<a href='https://issues.apache.org/jira/browse/HBASE-2503'>HBASE-2503</a>] -         PriorityQueue isn't thread safe, KeyValueHeap uses it that way
-                </li>
-                <li>[<a href='https://issues.apache.org/jira/browse/HBASE-2545'>HBASE-2545</a>] -         Unresponsive region server, potential deadlock
-                </li>
-            </ul>
-        </section>
-                                        
-        <section><title>        Task
-            </title>
-            <ul>
-                <li>[<a href='https://issues.apache.org/jira/browse/HBASE-2521'>HBASE-2521</a>] -         no license headers in 5 files
-                </li>
-            </ul>
-
-</section>
-                
-</section>
+<p><a href="https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310753&amp;styleName=Html&amp;version=12314800">0.20.5 Release Notes</a>
+</p>
 </body>
 </document>

Modified: hbase/branches/0.20/src/docs/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/docs/src/documentation/content/xdocs/site.xml?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/docs/src/documentation/content/xdocs/site.xml (original)
+++ hbase/branches/0.20/src/docs/src/documentation/content/xdocs/site.xml Wed May 26 07:41:42 2010
@@ -34,7 +34,7 @@ See http://forrest.apache.org/docs/linki
   <docs label="Documentation"> 
     <overview  label="Overview"           href="index.html" />
     <started   label="Getting Started"    href="ext:api/started" />
-    <api       label="0.20.4 Release Notes"   href="releasenotes.html" />
+    <api       label="Release Notes"   href="releasenotes.html" />
     <api       label="API Docs"           href="ext:api/index" />
     <api       label="HBase Metrics"      href="metrics.html" />
     <api       label="HBase  Default Configuration" href="hbase-conf.html" />
@@ -45,12 +45,12 @@ See http://forrest.apache.org/docs/linki
   </docs>
 
   <external-refs>
-    <site      href="http://hadoop.apache.org/hbase/"/>
-    <lists     href="http://hadoop.apache.org/hbase/mailing_lists.html"/>
-    <releases  href="http://hadoop.apache.org/hbase/releases.html">
+    <site      href="http://hbase.apache.org/"/>
+    <lists     href="http://hbase.apache.org/mailing_lists.html"/>
+    <releases  href="http://hbase.apache.org/releases.html">
       <download href="#Download" />
     </releases>
-    <jira      href="http://hadoop.apache.org/hbase/issue_tracking.html"/>
+    <jira      href="http://hbase.apache.org/issue_tracking.html"/>
     <wiki      href="http://wiki.apache.org/hadoop/Hbase" />
     <faq       href="http://wiki.apache.org/hadoop/Hbase/FAQ" />
     <zlib      href="http://www.zlib.net/" />

Modified: hbase/branches/0.20/src/docs/src/documentation/content/xdocs/tabs.xml
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/docs/src/documentation/content/xdocs/tabs.xml?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/docs/src/documentation/content/xdocs/tabs.xml (original)
+++ hbase/branches/0.20/src/docs/src/documentation/content/xdocs/tabs.xml Wed May 26 07:41:42 2010
@@ -29,7 +29,7 @@
     directory (ends in '/'), in which case /index.html will be added
   -->
 
-  <tab label="Project" href="http://hadoop.apache.org/hbase/" />
+  <tab label="Project" href="http://hbase.apache.org/" />
   <tab label="Wiki" href="http://wiki.apache.org/hadoop/Hbase" />
   <tab label="HBase Documentation" dir="" />  
 </tabs>

Modified: hbase/branches/0.20/src/docs/src/documentation/skinconf.xml
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/docs/src/documentation/skinconf.xml?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/docs/src/documentation/skinconf.xml (original)
+++ hbase/branches/0.20/src/docs/src/documentation/skinconf.xml Wed May 26 07:41:42 2010
@@ -30,7 +30,7 @@ which will be used to configure the chos
     In other words google will search the @domain for the query string.
 
   -->
-  <search name="HBase" domain="hadoop.apache.org" provider="google"/>
+  <search name="HBase" domain="hbase.apache.org" provider="google"/>
 
   <!-- Disable the print link? If enabled, invalid HTML 4.0.1 -->
   <disable-print-link>true</disable-print-link>  
@@ -66,7 +66,7 @@ which will be used to configure the chos
   <!-- project logo -->
   <project-name>HBase</project-name>
   <project-description>The Hadoop database</project-description>
-  <project-url>http://hadoop.apache.org/hbase/</project-url>
+  <project-url>http://hbase.apache.org/</project-url>
   <project-logo>images/hbase_small.gif</project-logo>
 
   <!-- group logo -->
@@ -98,7 +98,7 @@ which will be used to configure the chos
   <trail>
     <link1 name="Apache" href="http://www.apache.org/"/>
     <link2 name="Hadoop" href="http://hadoop.apache.org/"/>
-    <link3 name="HBase" href="http://hadoop.apache.org/hbase/"/>
+    <link3 name="HBase" href="http://hbase.apache.org/"/>
   </trail>
 
   <!-- Configure the TOC, i.e. the Table of Contents.

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ClusterStatus.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ClusterStatus.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ClusterStatus.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/ClusterStatus.java Wed May 26 07:41:42 2010
@@ -26,7 +26,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.NavigableMap;
 import java.util.TreeMap;
@@ -68,7 +67,7 @@ public class ClusterStatus extends Versi
   public Collection<String> getServerNames() {
     ArrayList<String> names = new ArrayList<String>(liveServerInfo.size());
     for (HServerInfo server: liveServerInfo) {
-      names.add(server.getName());
+      names.add(server.getHostnamePort());
     }
     return names;
   }

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/HServerInfo.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/HServerInfo.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/HServerInfo.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/HServerInfo.java Wed May 26 07:41:42 2010
@@ -1,5 +1,5 @@
 /**
- * Copyright 2007 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
  *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -22,51 +22,70 @@ package org.apache.hadoop.hbase;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.Map;
-import java.util.HashMap;
+import java.net.InetSocketAddress;
+import java.util.Set;
 
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 
 
 /**
- * HServerInfo contains metainfo about an HRegionServer, Currently it only
- * contains the server start code.
- * 
- * In the future it will contain information about the source machine and
- * load statistics.
+ * HServerInfo is meta info about an {@link HRegionServer}.  It is the token
+ * by which a master distingushes a particular regionserver from the rest.
+ * It holds hostname, ports, regionserver startcode, and load.  Each server has
+ * a <code>servername</code> where servername is made up of a concatenation of
+ * hostname, port, and regionserver startcode.  This servername is used in
+ * various places identifying this regionserver.  Its even used as part of
+ * a pathname in the filesystem.  As part of the initialization,
+ * master will pass the regionserver the address that it knows this regionserver
+ * by.  In subsequent communications, the regionserver will pass a HServerInfo
+ * with the master-supplied address.
  */
 public class HServerInfo implements WritableComparable<HServerInfo> {
+  /*
+   * This character is used as separator between server hostname and port and
+   * its startcode. Servername is formatted as
+   * <code>&lt;hostname> '{@ink #SERVERNAME_SEPARATOR"}' &lt;port> '{@ink #SERVERNAME_SEPARATOR"}' &lt;startcode></code>.
+   */
+  private static final String SERVERNAME_SEPARATOR = ",";
+
   private HServerAddress serverAddress;
   private long startCode;
   private HServerLoad load;
   private int infoPort;
   private String serverName = null;
-  private String name;
-  private static Map<String,String> dnsCache = new HashMap<String,String>();
+  // Hostname of the regionserver.
+  private String hostname;
 
-  /** default constructor - used by Writable */
   public HServerInfo() {
-    this(new HServerAddress(), 0, 
-        HConstants.DEFAULT_REGIONSERVER_INFOPORT, "default name");
+    this(new HServerAddress(), 0, HConstants.DEFAULT_REGIONSERVER_INFOPORT,
+      "default name");
   }
-  
+
   /**
-   * Constructor
-   * @param serverAddress
-   * @param startCode
-   * @param infoPort Port the info server is listening on.
+   * Constructor that creates a HServerInfo with a generated startcode and an
+   * empty load.
+   * @param serverAddress An {@link InetSocketAddress} encased in a {@link Writable}
+   * @param infoPort Port the webui runs on.
+   * @param hostname Server hostname.
    */
+  public HServerInfo(HServerAddress serverAddress, final int infoPort,
+      final String hostname) {
+    this(serverAddress, System.currentTimeMillis(), infoPort, hostname);
+  }
+
   public HServerInfo(HServerAddress serverAddress, long startCode,
-      final int infoPort, String name) {
+      final int infoPort, String hostname) {
     this.serverAddress = serverAddress;
     this.startCode = startCode;
     this.load = new HServerLoad();
     this.infoPort = infoPort;
-    this.name = name;
+    this.hostname = hostname;
   }
-  
+
   /**
-   * Construct a new object using another as input (like a copy constructor)
+   * Copy-constructor
    * @param other
    */
   public HServerInfo(HServerInfo other) {
@@ -74,109 +93,101 @@ public class HServerInfo implements Writ
     this.startCode = other.getStartCode();
     this.load = other.getLoad();
     this.infoPort = other.getInfoPort();
-    this.name = other.getName();
+    this.hostname = other.hostname;
   }
 
-  /**
-   * @return the load
-   */
   public HServerLoad getLoad() {
     return load;
   }
 
-  /**
-   * @param load the load to set
-   */
   public void setLoad(HServerLoad load) {
     this.load = load;
   }
 
-  /** @return the server address */
   public synchronized HServerAddress getServerAddress() {
     return new HServerAddress(serverAddress);
   }
-  
-  /**
-   * Change the server address.
-   * @param serverAddress New server address
-   */
+
   public synchronized void setServerAddress(HServerAddress serverAddress) {
     this.serverAddress = serverAddress;
     this.serverName = null;
   }
- 
-  /** @return the server start code */
+
   public synchronized long getStartCode() {
     return startCode;
   }
-  
-  /**
-   * @return Port the info server is listening on.
-   */
+
   public int getInfoPort() {
     return this.infoPort;
   }
-  
+
+  public String getHostname() {
+    return this.hostname;
+  }
+
   /**
-   * @param infoPort - new port of info server
+   * @return The hostname and port concatenated with a ':' as separator.
    */
-  public void setInfoPort(int infoPort) {
-    this.infoPort = infoPort;
+  public String getHostnamePort() {
+    return getHostnamePort(this.hostname, this.serverAddress.getPort());
   }
-  
+
   /**
-   * @param startCode the startCode to set
+   * @param hostname
+   * @param port
+   * @return The hostname and port concatenated with a ':' as separator.
    */
-  public synchronized void setStartCode(long startCode) {
-    this.startCode = startCode;
-    this.serverName = null;
+  public static String getHostnamePort(final String hostname, final int port) {
+    return hostname + ":" + port;
   }
-  
+
   /**
-   * @return the server name in the form hostname_startcode_port
+   * @return Server name made of the concatenation of hostname, port and
+   * startcode formatted as <code>&lt;hostname> ':' &lt;port> ',' &lt;startcode></code>
    */
   public synchronized String getServerName() {
     if (this.serverName == null) {
-      // if we have the hostname of the RS, use it
-      if(this.name != null) {
-        this.serverName = getServerName(this.name, this.serverAddress.getPort(), this.startCode);
-      }
-      // go to DNS name resolution only if we dont have the name of the RS
-      else {
-      this.serverName = getServerName(this.serverAddress, this.startCode);
-    }
+      this.serverName = getServerName(this.hostname,
+        this.serverAddress.getPort(), this.startCode);
     }
     return this.serverName;
   }
-  
-  /**
-   * Get the hostname of the server
-   * @return hostname
-   */
-  public String getName() {
-    return name;
-  }
- 
-  /**
-   * Set the hostname of the server
-   * @param name hostname
-   */
-  public void setName(String name) {
-    this.name = name;
+
+  public static synchronized String getServerName(final String hostAndPort,
+      final long startcode) {
+    int index = hostAndPort.indexOf(":");
+    if (index <= 0) throw new IllegalArgumentException("Expected <hostname> ':' <port>");
+    return getServerName(hostAndPort.substring(0, index),
+      Integer.parseInt(hostAndPort.substring(index + 1)), startcode);
+  }
+
+  /*
+   * @param hostname
+   * @param port
+   * @param sc Startcode
+   * @return Server name made of the concatenation of hostname, port and
+   * startcode formatted as <code>&lt;hostname> ',' &lt;port> ',' &lt;startcode></code>
+   */
+  static String getServerName(String hostname, int port, long sc) {
+    StringBuilder sb = new StringBuilder(hostname);
+    sb.append(SERVERNAME_SEPARATOR);
+    sb.append(port);
+    sb.append(SERVERNAME_SEPARATOR);
+    sb.append(sc);
+    return sb.toString();
   }
 
   /**
-   * @see java.lang.Object#toString()
+   * @return ServerName and load concatenated.
+   * @see #getServerName()
+   * @see #getLoad()
    */
   @Override
   public String toString() {
-    return "address: " + this.serverAddress + ", startcode: " + this.startCode
-    + ", load: (" + this.load.toString() + ")";
+    return "serverName=" + getServerName() +
+      ", load=(" + this.load.toString() + ")";
   }
 
-  /**
-   * @see java.lang.Object#equals(java.lang.Object)
-   */
   @Override
   public boolean equals(Object obj) {
     if (this == obj) {
@@ -191,23 +202,17 @@ public class HServerInfo implements Writ
     return compareTo((HServerInfo)obj) == 0;
   }
 
-  /**
-   * @see java.lang.Object#hashCode()
-   */
   @Override
   public int hashCode() {
     return this.getServerName().hashCode();
   }
 
-
-  // Writable
-  
   public void readFields(DataInput in) throws IOException {
     this.serverAddress.readFields(in);
     this.startCode = in.readLong();
     this.load.readFields(in);
     this.infoPort = in.readInt();
-    this.name = in.readUTF();
+    this.hostname = in.readUTF();
   }
 
   public void write(DataOutput out) throws IOException {
@@ -215,7 +220,7 @@ public class HServerInfo implements Writ
     out.writeLong(this.startCode);
     this.load.write(out);
     out.writeInt(this.infoPort);
-    out.writeUTF(name);
+    out.writeUTF(hostname);
   }
 
   public int compareTo(HServerInfo o) {
@@ -223,53 +228,25 @@ public class HServerInfo implements Writ
   }
 
   /**
-   * @param info
-   * @return the server name in the form hostname_startcode_port
-   */
-  private static String getServerName(HServerInfo info) {
-    return getServerName(info.getServerAddress(), info.getStartCode());
-  }
-  
-  /**
-   * @param serverAddress in the form hostname:port
-   * @param startCode
-   * @return the server name in the form hostname_startcode_port
-   */
-  public static String getServerName(String serverAddress, long startCode) {
-    String name = null;
-    if (serverAddress != null) {
-      int colonIndex = serverAddress.lastIndexOf(':');
-      if(colonIndex < 0) {
-        throw new IllegalArgumentException("Not a host:port pair: " + serverAddress);
-      }
-      String host = serverAddress.substring(0, colonIndex);
-      int port =
-        Integer.valueOf(serverAddress.substring(colonIndex + 1)).intValue();
-      if(!dnsCache.containsKey(host)) {
-        HServerAddress address = new HServerAddress(serverAddress);
-        dnsCache.put(host, address.getHostname());
-      }
-      host = dnsCache.get(host);
-      name = getServerName(host, port, startCode);
+   * Utility method that does a find of a servername or a hostandport combination
+   * in the passed Set.
+   * @param servers Set of server names
+   * @param serverName Name to look for
+   * @param hostAndPortOnly If <code>serverName</code> is a
+   * <code>hostname ':' port</code>
+   * or <code>hostname , port , startcode</code>.
+   * @return True if <code>serverName</code> found in <code>servers</code>
+   */
+  public static boolean isServer(final Set<String> servers,
+      final String serverName, final boolean hostAndPortOnly) {
+    if (!hostAndPortOnly) return servers.contains(serverName);
+    String serverNameColonReplaced =
+      serverName.replaceFirst(":", SERVERNAME_SEPARATOR);
+    for (String hostPortStartCode: servers) {
+      int index = hostPortStartCode.lastIndexOf(SERVERNAME_SEPARATOR);
+      String hostPortStrippedOfStartCode = hostPortStartCode.substring(0, index);
+      if (hostPortStrippedOfStartCode.equals(serverNameColonReplaced)) return true;
     }
-    return name;
-  }
-
-  /**
-   * @param address
-   * @param startCode
-   * @return the server name in the form hostname_startcode_port
-   */
-  public static String getServerName(HServerAddress address, long startCode) {
-    return getServerName(address.getHostname(), address.getPort(), startCode);
-  }
-
-  private static String getServerName(String hostName, int port, long startCode) {
-    StringBuilder name = new StringBuilder(hostName);
-    name.append(",");
-    name.append(port);
-    name.append(",");
-    name.append(startCode);
-    return name.toString();
+    return false;
   }
-}
+}
\ No newline at end of file

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HTable.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HTable.java Wed May 26 07:41:42 2010
@@ -656,7 +656,7 @@ public class HTable {
    * Executes all the buffered {@link Put} operations.
    * <p>
    * This method gets called once automatically for every {@link Put} or batch
-   * of {@link Put}s (when {@link #put(List<Put>)} is used) when
+   * of {@link Put}s (when {@link #put(List)} is used) when
    * {@link #isAutoFlush} is {@code true}.
    * @throws IOException if a remote or network exception occurs.
    */

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/BaseScanner.java Wed May 26 07:41:42 2010
@@ -522,16 +522,16 @@ abstract class BaseScanner extends Chore
    * @param regionServer
    * @param meta
    * @param info
-   * @param serverAddress
+   * @param hostnameAndPort hostname ':' port as it comes out of .META.
    * @param startCode
    * @throws IOException
    */
   protected void checkAssigned(final HRegionInterface regionServer,
     final MetaRegion meta, final HRegionInfo info,
-    final String serverAddress, final long startCode) 
+    final String hostnameAndPort, final long startCode)
   throws IOException {
     String serverName = null;
-    String sa = serverAddress;
+    String sa = hostnameAndPort;
     long sc = startCode;
     // Scans are sloppy. They don't respect row locks and they get and
     // cache a row internally so may have data that is stale. Make sure that for
@@ -543,9 +543,9 @@ abstract class BaseScanner extends Chore
     Result r = regionServer.get(meta.getRegionName(), g);
     if (r != null && !r.isEmpty()) {
       sa = getServerAddress(r);
-      if (sa != null && sa.length() > 0 && !sa.equalsIgnoreCase(serverAddress)) {
+      if (sa != null && sa.length() > 0 && !sa.equalsIgnoreCase(hostnameAndPort)) {
         LOG.debug("GET on " + info.getRegionNameAsString() + " got different " +
-          "address than SCAN: sa=" + sa + ", serverAddress=" + serverAddress);
+          "address than SCAN: sa=" + sa + ", serverAddress=" + hostnameAndPort);
       }
       // Reget startcode in case its changed in the meantime too.
       sc = getStartCode(r);

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/HMaster.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/HMaster.java Wed May 26 07:41:42 2010
@@ -349,10 +349,6 @@ public class HMaster extends Thread impl
     return serverManager.getServersToServerInfo();
   }
 
-  public Map<HServerAddress, HServerInfo> getServerAddressToServerInfo() {
-    return serverManager.getServerAddressToServerInfo();
-  }
-
   /**
    * @return Read-only map of servers to load.
    */
@@ -564,7 +560,7 @@ public class HMaster extends Thread impl
         HRegionInterface hri = 
           this.connection.getHRegionConnection(address, false);
         HServerInfo info = hri.getHServerInfo();
-        LOG.debug("Inspection found server " + info.getName());
+        LOG.debug("Inspection found server " + info.getServerName());
         serverManager.recordNewServer(info, true);
         HRegionInfo[] regions = hri.getRegionsAssignment();
         for (HRegionInfo region : regions) {
@@ -686,19 +682,18 @@ public class HMaster extends Thread impl
    */
   public MapWritable regionServerStartup(final HServerInfo serverInfo)
   throws IOException {
-    // Set the address for now even tho it will not be persisted on HRS side
-    // If the address given is not the default one,
-    // use the IP given by the user.
-    if (serverInfo.getServerAddress().getBindAddress().equals(
-        DEFAULT_HOST)) {
-      String rsAddress = HBaseServer.getRemoteAddress();
-      serverInfo.setServerAddress(new HServerAddress(rsAddress,
-        serverInfo.getServerAddress().getPort()));
-    }
+    // Set the ip into the passed in serverInfo.  Its ip is more than likely
+    // not the ip that the master sees here.  See at end of this method where
+    // we pass it back to the regionserver by setting "hbase.regionserver.address"
+    String rsAddress = HBaseServer.getRemoteAddress();
+    serverInfo.setServerAddress(new HServerAddress(rsAddress,
+      serverInfo.getServerAddress().getPort()));
     // Register with server manager
     this.serverManager.regionServerStartup(serverInfo);
     // Send back some config info
-    return createConfigurationSubset();
+    MapWritable mw = createConfigurationSubset();
+     mw.put(new Text("hbase.regionserver.address"), new Text(rsAddress));
+    return mw;
   }
   
   /**
@@ -707,12 +702,6 @@ public class HMaster extends Thread impl
    */
   protected MapWritable createConfigurationSubset() {
     MapWritable mw = addConfig(new MapWritable(), HConstants.HBASE_DIR);
-    // Get the real address of the HRS.
-    String rsAddress = HBaseServer.getRemoteAddress();
-    if (rsAddress != null) {
-      mw.put(new Text("hbase.regionserver.address"), new Text(rsAddress));
-    }
-    
     return addConfig(mw, "fs.default.name");
   }
 
@@ -1019,29 +1008,26 @@ public class HMaster extends Thread impl
       // Arguments are regionname and an optional server name.
       byte [] regionname = ((ImmutableBytesWritable)args[0]).get();
       LOG.debug("Attempting to close region: " + Bytes.toStringBinary(regionname));
-      String servername = null;
+      String hostnameAndPort = null;
       if (args.length == 2) {
-        servername = Bytes.toString(((ImmutableBytesWritable)args[1]).get());
+        hostnameAndPort = Bytes.toString(((ImmutableBytesWritable)args[1]).get());
       }
       // Need hri 
       Result rr = getFromMETA(regionname, HConstants.CATALOG_FAMILY);
       HRegionInfo hri = getHRegionInfo(rr.getRow(), rr);
-      if (servername == null) {
+      if (hostnameAndPort == null) {
         // Get server from the .META. if it wasn't passed as argument
-        servername = 
+        hostnameAndPort = 
           Bytes.toString(rr.getValue(CATALOG_FAMILY, SERVER_QUALIFIER));
       }
       // Take region out of the intransistions in case it got stuck there doing
       // an open or whatever.
       this.regionManager.clearFromInTransition(regionname);
-      // If servername is still null, then none, exit.
-      if (servername == null) break;
-      // Need to make up a HServerInfo 'servername' for that is how
-      // items are keyed in regionmanager Maps.
-      HServerAddress addr = new HServerAddress(servername);
+      // If hostnameAndPort is still null, then none, exit.
+      if (hostnameAndPort == null) break;
       long startCode =
         Bytes.toLong(rr.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER));
-      String name = HServerInfo.getServerName(addr, startCode);
+      String name = HServerInfo.getServerName(hostnameAndPort, startCode);
       LOG.info("Marking " + hri.getRegionNameAsString() +
         " as closing on " + name + "; cleaning SERVER + STARTCODE; " +
           "master will tell regionserver to close region on next heartbeat");

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java Wed May 26 07:41:42 2010
@@ -68,18 +68,18 @@ class ProcessRegionOpen extends ProcessR
     HRegionInterface server =
         master.connection.getHRegionConnection(getMetaRegion().getServer());
     LOG.info(regionInfo.getRegionNameAsString() + " open on " +
-        serverInfo.getServerAddress().toString());
+        serverInfo.getServerName());
 
     // Register the newly-available Region's location.
     Put p = new Put(regionInfo.getRegionName());
     p.add(CATALOG_FAMILY, SERVER_QUALIFIER,
-      Bytes.toBytes(serverInfo.getServerAddress().toString()));
+      Bytes.toBytes(serverInfo.getHostnamePort()));
     p.add(CATALOG_FAMILY, STARTCODE_QUALIFIER,
       Bytes.toBytes(serverInfo.getStartCode()));
     server.put(metaRegionName, p);
     LOG.info("Updated row " + regionInfo.getRegionNameAsString() +
       " in region " + Bytes.toString(metaRegionName) + " with startcode=" +
-      serverInfo.getStartCode() + ", server=" + serverInfo.getServerAddress());
+      serverInfo.getStartCode() + ", server=" + serverInfo.getHostnamePort());
     synchronized (master.regionManager) {
       if (isMetaTable) {
         // It's a meta region.
@@ -121,4 +121,4 @@ class ProcessRegionOpen extends ProcessR
   protected int getPriority() {
     return 0; // highest priority
   }
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ServerManager.java Wed May 26 07:41:42 2010
@@ -58,7 +58,7 @@ import org.apache.zookeeper.Watcher.Even
  * The ServerManager class manages info about region servers - HServerInfo, 
  * load numbers, dying servers, etc.
  */
-class ServerManager implements HConstants {
+public class ServerManager implements HConstants {
   static final Log LOG =
     LogFactory.getLog(ServerManager.class.getName());
   private static final HMsg REGIONSERVER_QUIESCE =
@@ -75,9 +75,6 @@ class ServerManager implements HConstant
   final Map<String, HServerInfo> serversToServerInfo =
     new ConcurrentHashMap<String, HServerInfo>();
 
-  final Map<HServerAddress, HServerInfo> serverAddressToServerInfo =
-      new ConcurrentHashMap<HServerAddress, HServerInfo>();
-  
   /**
    * Set of known dead servers.  On znode expiration, servers are added here.
    * This is needed in case of a network partitioning where the server's lease
@@ -110,7 +107,7 @@ class ServerManager implements HConstant
     }
 
     protected void chore() {
-      int numServers = serverAddressToServerInfo.size();
+      int numServers = serversToServerInfo.size();
       int numDeadServers = deadServers.size();
       double averageLoad = getAverageLoad();
       String deadServersList = null;
@@ -220,7 +217,6 @@ class ServerManager implements HConstant
     Watcher watcher = new ServerExpirer(serverName, info.getServerAddress());
     master.getZooKeeperWrapper().updateRSLocationGetWatch(info, watcher);
     serversToServerInfo.put(serverName, info);
-    serverAddressToServerInfo.put(info.getServerAddress(), info);
     serversToLoad.put(serverName, load);
     synchronized (loadToServers) {
       Set<String> servers = loadToServers.get(load);
@@ -315,7 +311,7 @@ class ServerManager implements HConstant
       }
 
       synchronized (serversToServerInfo) {
-        removeServerInfo(info.getServerName(), info.getServerAddress());
+        removeServerInfo(info.getServerName());
         serversToServerInfo.notifyAll();
       }
       
@@ -338,8 +334,7 @@ class ServerManager implements HConstant
       try {
         // This method removes ROOT/META from the list and marks them to be reassigned
         // in addition to other housework.
-        if (removeServerInfo(serverInfo.getServerName(),
-            serverInfo.getServerAddress())) {
+        if (removeServerInfo(serverInfo.getServerName())) {
           // Only process the exit message if the server still has registered info.
           // Otherwise we could end up processing the server exit twice.
           LOG.info("Region server " + serverInfo.getServerName() +
@@ -398,7 +393,6 @@ class ServerManager implements HConstant
       final HRegionInfo[] mostLoadedRegions, HMsg[] msgs)
   throws IOException {
     // Refresh the info object and the load information
-    serverAddressToServerInfo.put(serverInfo.getServerAddress(), serverInfo);
     serversToServerInfo.put(serverInfo.getServerName(), serverInfo);
     HServerLoad load = serversToLoad.get(serverInfo.getServerName());
     if (load != null) {
@@ -605,7 +599,7 @@ class ServerManager implements HConstant
     
       if (duplicateAssignment) {
         if (LOG.isDebugEnabled()) {
-          LOG.debug("region server " + serverInfo.getServerAddress().toString()
+          LOG.warn("region server " + serverInfo.getServerName()
               + " should not have opened region " + Bytes.toString(region.getRegionName()));
         }
 
@@ -694,10 +688,8 @@ class ServerManager implements HConstant
   }
   
   /** Update a server load information because it's shutting down*/
-  private boolean removeServerInfo(final String serverName,
-                                   final HServerAddress serverAddress) {
+  private boolean removeServerInfo(final String serverName) {
     boolean infoUpdated = false;
-    serverAddressToServerInfo.remove(serverAddress);
     HServerInfo info = serversToServerInfo.remove(serverName);
     // Only update load information once.
     // This method can be called a couple of times during shutdown.
@@ -779,11 +771,19 @@ class ServerManager implements HConstant
     }
   }
 
-  public Map<HServerAddress, HServerInfo> getServerAddressToServerInfo() {
-    // we use this one because all the puts to this map are parallel/synced with the other map.
-    synchronized (serversToServerInfo) {
-      return Collections.unmodifiableMap(serverAddressToServerInfo);
+  /**
+   * @param hsa
+   * @return The HServerInfo whose HServerAddress is <code>hsa</code> or null
+   * if nothing found.
+   */
+  public HServerInfo getHServerInfo(final HServerAddress hsa) {
+    synchronized(this.serversToServerInfo) {
+      // TODO: This is primitive.  Do a better search.
+      for (Map.Entry<String, HServerInfo> e: this.serversToServerInfo.entrySet()) {
+        if (e.getValue().getServerAddress().equals(hsa)) return e.getValue();
+      }
     }
+    return null;
   }
 
   /**
@@ -841,18 +841,15 @@ class ServerManager implements HConstant
   /** Watcher triggered when a RS znode is deleted */
   private class ServerExpirer implements Watcher {
     private String server;
-    private HServerAddress serverAddress;
 
     ServerExpirer(String server, HServerAddress serverAddress) {
       this.server = server;
-      this.serverAddress = serverAddress;
     }
 
     public void process(WatchedEvent event) {
       if(event.getType().equals(EventType.NodeDeleted)) {
         LOG.info(server + " znode expired");
         // Remove the server from the known servers list and update load info
-        serverAddressToServerInfo.remove(serverAddress);
         HServerInfo info = serversToServerInfo.remove(server);
         if (info != null) {
           String serverName = info.getServerName();
@@ -908,5 +905,4 @@ class ServerManager implements HConstant
   public void setMinimumServerCount(int minimumServerCount) {
     this.minimumServerCount = minimumServerCount;
   }
-
 }

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Wed May 26 07:41:42 2010
@@ -520,7 +520,8 @@ public class HRegionServer implements HC
                     LOG.error("error closing and deleting HLog", e);
                   }
                   try {
-                    serverInfo.setStartCode(System.currentTimeMillis());
+                    this.serverInfo =
+                      createServerInfoWithNewStartCode(this.serverInfo);
                     hlog = setupHLog();
                     this.hlogFlusher.setHLog(hlog);
                   } catch (IOException e) {
@@ -643,8 +644,7 @@ public class HRegionServer implements HC
         }
         closeAllRegions(); // Don't leave any open file handles
       }
-      LOG.info("aborting server at: " +
-        serverInfo.getServerAddress().toString());
+      LOG.info("aborting server at: " + this.serverInfo.getServerName());
     } else {
       ArrayList<HRegion> closedRegions = closeAllRegions();
       try {
@@ -666,14 +666,13 @@ public class HRegionServer implements HC
         }
 
         LOG.info("telling master that region server is shutting down at: " +
-            serverInfo.getServerAddress().toString());
+            serverInfo.getServerName());
         hbaseMaster.regionServerReport(serverInfo, exitMsg, (HRegionInfo[])null);
       } catch (Throwable e) {
         LOG.warn("Failed to send exiting message to master: ",
           RemoteExceptionHandler.checkThrowable(e));
       }
-      LOG.info("stopping server at: " +
-        serverInfo.getServerAddress().toString());
+      LOG.info("stopping server at: " + this.serverInfo.getServerName());
     }
     if (this.hbaseMaster != null) {
       HBaseRPC.stopProxy(this.hbaseMaster);
@@ -1049,7 +1048,7 @@ public class HRegionServer implements HC
     }
     if (fs.exists(logdir)) {
       throw new RegionServerRunningException("region server already " +
-        "running at " + this.serverInfo.getServerAddress().toString() +
+        "running at " + this.serverInfo.getServerName() +
         " because logdir " + logdir.toString() + " exists");
     }
     HLog newlog = instantiateHLog(logdir);
@@ -1183,8 +1182,10 @@ public class HRegionServer implements HC
           // auto bind enabled, try to use another port
           LOG.info("Failed binding http info server to port: " + port);
           port++;
-          // update HRS server info
-          this.serverInfo.setInfoPort(port);
+          // update HRS server info port.
+          this.serverInfo = new HServerInfo(this.serverInfo.getServerAddress(),
+            this.serverInfo.getStartCode(),  port,
+            this.serverInfo.getHostname());
         }
       } 
     }
@@ -1343,7 +1344,7 @@ public class HRegionServer implements HC
         lastMsg = System.currentTimeMillis();
         boolean startCodeOk = false; 
         while(!startCodeOk) {
-          serverInfo.setStartCode(System.currentTimeMillis());
+          this.serverInfo = createServerInfoWithNewStartCode(this.serverInfo);
           startCodeOk = zooKeeperWrapper.writeRSLocation(this.serverInfo);
           if(!startCodeOk) {
            LOG.debug("Start code already taken, trying another one");
@@ -1366,6 +1367,11 @@ public class HRegionServer implements HC
     return result;
   }
 
+  private HServerInfo createServerInfoWithNewStartCode(final HServerInfo hsi) {
+    return new HServerInfo(hsi.getServerAddress(), hsi.getInfoPort(),
+      hsi.getHostname());
+  }
+
   /* Add to the outbound message buffer */
   private void reportOpen(HRegionInfo region) {
     this.outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_OPEN, region));

Modified: hbase/branches/0.20/src/webapps/master/table.jsp
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/webapps/master/table.jsp?rev=948356&r1=948355&r2=948356&view=diff
==============================================================================
--- hbase/branches/0.20/src/webapps/master/table.jsp (original)
+++ hbase/branches/0.20/src/webapps/master/table.jsp Wed May 26 07:41:42 2010
@@ -42,8 +42,6 @@
   HBaseAdmin hbadmin = new HBaseAdmin(conf);
   String tableName = request.getParameter("name");
   HTable table = new HTable(conf, tableName);
-  Map<HServerAddress, HServerInfo> serverAddressToServerInfos =
-      master.getServerAddressToServerInfo();
   String tableHeader = "<h2>Table Regions</h2><table><tr><th>Name</th><th>Region Server</th><th>Encoded Name</th><th>Start Key</th><th>End Key</th></tr>";
   HServerAddress rootLocation = master.getRootRegionLocation();
 %>
@@ -105,7 +103,7 @@
 %>
 <%= tableHeader %>
 <%
-  int infoPort = serverAddressToServerInfos.get(rootLocation).getInfoPort();
+  int infoPort = master.getServerManager().getHServerInfo(rootLocation).getInfoPort();
   String url = "http://" + rootLocation.getHostname() + ":" + infoPort + "/";
 %>
 <tr>
@@ -123,7 +121,7 @@
 <%
   Map<byte [], MetaRegion> onlineRegions = master.getOnlineMetaRegions();
   for (MetaRegion meta: onlineRegions.values()) {
-    int infoPort = serverAddressToServerInfos.get(meta.getServer()).getInfoPort();
+    int infoPort = master.getServerManager().getHServerInfo(meta.getServer()).getInfoPort();
     String url = "http://" + meta.getServer().getHostname() + ":" + infoPort + "/";
 %>
 <tr>
@@ -146,10 +144,7 @@
 <%=     tableHeader %>
 <%
   for(Map.Entry<HRegionInfo, HServerAddress> hriEntry : regions.entrySet()) {
-    
-    int infoPort = serverAddressToServerInfos.get(
-        hriEntry.getValue()).getInfoPort();
-    
+    int infoPort = master.getServerManager().getHServerInfo(hriEntry.getValue()).getInfoPort();
     String urlRegionServer =
         "http://" + hriEntry.getValue().getHostname().toString() + ":" + infoPort + "/";
 %>