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:46:10 UTC
svn commit: r948357 - 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:46:10 2010
New Revision: 948357
URL: http://svn.apache.org/viewvc?rev=948357&view=rev
Log:
HBASE-2568 Add new svn, ml, and website locations into branches/0.20/src/doc...COMMITTED TO MUCH REVERSING IT
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=948357&r1=948356&r2=948357&view=diff
==============================================================================
--- hbase/branches/0.20/CHANGES.txt (original)
+++ hbase/branches/0.20/CHANGES.txt Wed May 26 07:46:10 2010
@@ -1,6 +1,6 @@
HBase Change Log
-Release 0.20.5 - Wed May 26 00:15:56 PDT 2010
+Release 0.20.5 - Mon May 17 10:14:58 PDT 2010
BUG FIXES
HBASE-2545 Unresponsive region server, potential deadlock
@@ -16,7 +16,6 @@ Release 0.20.5 - Wed May 26 00:15:56 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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -22,11 +22,34 @@
<document>
<header>
<title>
- Release Notes - Hadoop HBase
+ Release Notes - Hadoop HBase - Version 0.20.5
</title>
</header>
<body>
-<p><a href="https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310753&styleName=Html&version=12314800">0.20.5 Release Notes</a>
-</p>
+<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>
</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=948357&r1=948356&r2=948357&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:46:10 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="Release Notes" href="releasenotes.html" />
+ <api label="0.20.4 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://hbase.apache.org/"/>
- <lists href="http://hbase.apache.org/mailing_lists.html"/>
- <releases href="http://hbase.apache.org/releases.html">
+ <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">
<download href="#Download" />
</releases>
- <jira href="http://hbase.apache.org/issue_tracking.html"/>
+ <jira href="http://hadoop.apache.org/hbase/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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -29,7 +29,7 @@
directory (ends in '/'), in which case /index.html will be added
-->
- <tab label="Project" href="http://hbase.apache.org/" />
+ <tab label="Project" href="http://hadoop.apache.org/hbase/" />
<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=948357&r1=948356&r2=948357&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:46:10 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="hbase.apache.org" provider="google"/>
+ <search name="HBase" domain="hadoop.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://hbase.apache.org/</project-url>
+ <project-url>http://hadoop.apache.org/hbase/</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://hbase.apache.org/"/>
+ <link3 name="HBase" href="http://hadoop.apache.org/hbase/"/>
</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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -26,6 +26,7 @@ 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;
@@ -67,7 +68,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.getHostnamePort());
+ names.add(server.getName());
}
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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2010 The Apache Software Foundation
+ * Copyright 2007 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -22,70 +22,51 @@ package org.apache.hadoop.hbase;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
-import org.apache.hadoop.hbase.regionserver.HRegionServer;
-import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
/**
- * 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.
+ * 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.
*/
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><hostname> '{@ink #SERVERNAME_SEPARATOR"}' <port> '{@ink #SERVERNAME_SEPARATOR"}' <startcode></code>.
- */
- private static final String SERVERNAME_SEPARATOR = ",";
-
private HServerAddress serverAddress;
private long startCode;
private HServerLoad load;
private int infoPort;
private String serverName = null;
- // Hostname of the regionserver.
- private String hostname;
+ private String name;
+ private static Map<String,String> dnsCache = new HashMap<String,String>();
+ /** 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 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.
+ * Constructor
+ * @param serverAddress
+ * @param startCode
+ * @param infoPort Port the info server is listening on.
*/
- 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 hostname) {
+ final int infoPort, String name) {
this.serverAddress = serverAddress;
this.startCode = startCode;
this.load = new HServerLoad();
this.infoPort = infoPort;
- this.hostname = hostname;
+ this.name = name;
}
-
+
/**
- * Copy-constructor
+ * Construct a new object using another as input (like a copy constructor)
* @param other
*/
public HServerInfo(HServerInfo other) {
@@ -93,101 +74,109 @@ public class HServerInfo implements Writ
this.startCode = other.getStartCode();
this.load = other.getLoad();
this.infoPort = other.getInfoPort();
- this.hostname = other.hostname;
+ this.name = other.getName();
}
+ /**
+ * @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;
- }
-
+
/**
- * @return The hostname and port concatenated with a ':' as separator.
+ * @param infoPort - new port of info server
*/
- public String getHostnamePort() {
- return getHostnamePort(this.hostname, this.serverAddress.getPort());
+ public void setInfoPort(int infoPort) {
+ this.infoPort = infoPort;
}
-
+
/**
- * @param hostname
- * @param port
- * @return The hostname and port concatenated with a ':' as separator.
+ * @param startCode the startCode to set
*/
- public static String getHostnamePort(final String hostname, final int port) {
- return hostname + ":" + port;
+ public synchronized void setStartCode(long startCode) {
+ this.startCode = startCode;
+ this.serverName = null;
}
-
+
/**
- * @return Server name made of the concatenation of hostname, port and
- * startcode formatted as <code><hostname> ':' <port> ',' <startcode></code>
+ * @return the server name in the form hostname_startcode_port
*/
public synchronized String getServerName() {
if (this.serverName == null) {
- this.serverName = getServerName(this.hostname,
- this.serverAddress.getPort(), this.startCode);
+ // 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);
+ }
}
return this.serverName;
}
-
- 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><hostname> ',' <port> ',' <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();
+
+ /**
+ * 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;
}
/**
- * @return ServerName and load concatenated.
- * @see #getServerName()
- * @see #getLoad()
+ * @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "serverName=" + getServerName() +
- ", load=(" + this.load.toString() + ")";
+ return "address: " + this.serverAddress + ", startcode: " + this.startCode
+ + ", load: (" + this.load.toString() + ")";
}
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -202,17 +191,23 @@ 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.hostname = in.readUTF();
+ this.name = in.readUTF();
}
public void write(DataOutput out) throws IOException {
@@ -220,7 +215,7 @@ public class HServerInfo implements Writ
out.writeLong(this.startCode);
this.load.write(out);
out.writeInt(this.infoPort);
- out.writeUTF(hostname);
+ out.writeUTF(name);
}
public int compareTo(HServerInfo o) {
@@ -228,25 +223,53 @@ public class HServerInfo implements Writ
}
/**
- * 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;
+ * @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);
}
- return false;
+ 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();
}
-}
\ 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=948357&r1=948356&r2=948357&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:46:10 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)} is used) when
+ * of {@link Put}s (when {@link #put(List<Put>)} 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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -522,16 +522,16 @@ abstract class BaseScanner extends Chore
* @param regionServer
* @param meta
* @param info
- * @param hostnameAndPort hostname ':' port as it comes out of .META.
+ * @param serverAddress
* @param startCode
* @throws IOException
*/
protected void checkAssigned(final HRegionInterface regionServer,
final MetaRegion meta, final HRegionInfo info,
- final String hostnameAndPort, final long startCode)
+ final String serverAddress, final long startCode)
throws IOException {
String serverName = null;
- String sa = hostnameAndPort;
+ String sa = serverAddress;
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(hostnameAndPort)) {
+ if (sa != null && sa.length() > 0 && !sa.equalsIgnoreCase(serverAddress)) {
LOG.debug("GET on " + info.getRegionNameAsString() + " got different " +
- "address than SCAN: sa=" + sa + ", serverAddress=" + hostnameAndPort);
+ "address than SCAN: sa=" + sa + ", serverAddress=" + serverAddress);
}
// 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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -349,6 +349,10 @@ 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.
*/
@@ -560,7 +564,7 @@ public class HMaster extends Thread impl
HRegionInterface hri =
this.connection.getHRegionConnection(address, false);
HServerInfo info = hri.getHServerInfo();
- LOG.debug("Inspection found server " + info.getServerName());
+ LOG.debug("Inspection found server " + info.getName());
serverManager.recordNewServer(info, true);
HRegionInfo[] regions = hri.getRegionsAssignment();
for (HRegionInfo region : regions) {
@@ -682,18 +686,19 @@ public class HMaster extends Thread impl
*/
public MapWritable regionServerStartup(final HServerInfo serverInfo)
throws IOException {
- // 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()));
+ // 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()));
+ }
// Register with server manager
this.serverManager.regionServerStartup(serverInfo);
// Send back some config info
- MapWritable mw = createConfigurationSubset();
- mw.put(new Text("hbase.regionserver.address"), new Text(rsAddress));
- return mw;
+ return createConfigurationSubset();
}
/**
@@ -702,6 +707,12 @@ 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");
}
@@ -1008,26 +1019,29 @@ 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 hostnameAndPort = null;
+ String servername = null;
if (args.length == 2) {
- hostnameAndPort = Bytes.toString(((ImmutableBytesWritable)args[1]).get());
+ servername = Bytes.toString(((ImmutableBytesWritable)args[1]).get());
}
// Need hri
Result rr = getFromMETA(regionname, HConstants.CATALOG_FAMILY);
HRegionInfo hri = getHRegionInfo(rr.getRow(), rr);
- if (hostnameAndPort == null) {
+ if (servername == null) {
// Get server from the .META. if it wasn't passed as argument
- hostnameAndPort =
+ servername =
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 hostnameAndPort is still null, then none, exit.
- if (hostnameAndPort == null) break;
+ // 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);
long startCode =
Bytes.toLong(rr.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER));
- String name = HServerInfo.getServerName(hostnameAndPort, startCode);
+ String name = HServerInfo.getServerName(addr, 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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -68,18 +68,18 @@ class ProcessRegionOpen extends ProcessR
HRegionInterface server =
master.connection.getHRegionConnection(getMetaRegion().getServer());
LOG.info(regionInfo.getRegionNameAsString() + " open on " +
- serverInfo.getServerName());
+ serverInfo.getServerAddress().toString());
// Register the newly-available Region's location.
Put p = new Put(regionInfo.getRegionName());
p.add(CATALOG_FAMILY, SERVER_QUALIFIER,
- Bytes.toBytes(serverInfo.getHostnamePort()));
+ Bytes.toBytes(serverInfo.getServerAddress().toString()));
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.getHostnamePort());
+ serverInfo.getStartCode() + ", server=" + serverInfo.getServerAddress());
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=948357&r1=948356&r2=948357&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:46:10 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.
*/
-public class ServerManager implements HConstants {
+class ServerManager implements HConstants {
static final Log LOG =
LogFactory.getLog(ServerManager.class.getName());
private static final HMsg REGIONSERVER_QUIESCE =
@@ -75,6 +75,9 @@ public class ServerManager implements HC
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
@@ -107,7 +110,7 @@ public class ServerManager implements HC
}
protected void chore() {
- int numServers = serversToServerInfo.size();
+ int numServers = serverAddressToServerInfo.size();
int numDeadServers = deadServers.size();
double averageLoad = getAverageLoad();
String deadServersList = null;
@@ -217,6 +220,7 @@ public class ServerManager implements HC
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);
@@ -311,7 +315,7 @@ public class ServerManager implements HC
}
synchronized (serversToServerInfo) {
- removeServerInfo(info.getServerName());
+ removeServerInfo(info.getServerName(), info.getServerAddress());
serversToServerInfo.notifyAll();
}
@@ -334,7 +338,8 @@ public class ServerManager implements HC
try {
// This method removes ROOT/META from the list and marks them to be reassigned
// in addition to other housework.
- if (removeServerInfo(serverInfo.getServerName())) {
+ if (removeServerInfo(serverInfo.getServerName(),
+ serverInfo.getServerAddress())) {
// 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() +
@@ -393,6 +398,7 @@ public class ServerManager implements HC
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) {
@@ -599,7 +605,7 @@ public class ServerManager implements HC
if (duplicateAssignment) {
if (LOG.isDebugEnabled()) {
- LOG.warn("region server " + serverInfo.getServerName()
+ LOG.debug("region server " + serverInfo.getServerAddress().toString()
+ " should not have opened region " + Bytes.toString(region.getRegionName()));
}
@@ -688,8 +694,10 @@ public class ServerManager implements HC
}
/** Update a server load information because it's shutting down*/
- private boolean removeServerInfo(final String serverName) {
+ private boolean removeServerInfo(final String serverName,
+ final HServerAddress serverAddress) {
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.
@@ -771,19 +779,11 @@ public class ServerManager implements HC
}
}
- /**
- * @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();
- }
+ 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);
}
- return null;
}
/**
@@ -841,15 +841,18 @@ public class ServerManager implements HC
/** 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();
@@ -905,4 +908,5 @@ public class ServerManager implements HC
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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -520,8 +520,7 @@ public class HRegionServer implements HC
LOG.error("error closing and deleting HLog", e);
}
try {
- this.serverInfo =
- createServerInfoWithNewStartCode(this.serverInfo);
+ serverInfo.setStartCode(System.currentTimeMillis());
hlog = setupHLog();
this.hlogFlusher.setHLog(hlog);
} catch (IOException e) {
@@ -644,7 +643,8 @@ public class HRegionServer implements HC
}
closeAllRegions(); // Don't leave any open file handles
}
- LOG.info("aborting server at: " + this.serverInfo.getServerName());
+ LOG.info("aborting server at: " +
+ serverInfo.getServerAddress().toString());
} else {
ArrayList<HRegion> closedRegions = closeAllRegions();
try {
@@ -666,13 +666,14 @@ public class HRegionServer implements HC
}
LOG.info("telling master that region server is shutting down at: " +
- serverInfo.getServerName());
+ serverInfo.getServerAddress().toString());
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: " + this.serverInfo.getServerName());
+ LOG.info("stopping server at: " +
+ serverInfo.getServerAddress().toString());
}
if (this.hbaseMaster != null) {
HBaseRPC.stopProxy(this.hbaseMaster);
@@ -1048,7 +1049,7 @@ public class HRegionServer implements HC
}
if (fs.exists(logdir)) {
throw new RegionServerRunningException("region server already " +
- "running at " + this.serverInfo.getServerName() +
+ "running at " + this.serverInfo.getServerAddress().toString() +
" because logdir " + logdir.toString() + " exists");
}
HLog newlog = instantiateHLog(logdir);
@@ -1182,10 +1183,8 @@ 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 port.
- this.serverInfo = new HServerInfo(this.serverInfo.getServerAddress(),
- this.serverInfo.getStartCode(), port,
- this.serverInfo.getHostname());
+ // update HRS server info
+ this.serverInfo.setInfoPort(port);
}
}
}
@@ -1344,7 +1343,7 @@ public class HRegionServer implements HC
lastMsg = System.currentTimeMillis();
boolean startCodeOk = false;
while(!startCodeOk) {
- this.serverInfo = createServerInfoWithNewStartCode(this.serverInfo);
+ serverInfo.setStartCode(System.currentTimeMillis());
startCodeOk = zooKeeperWrapper.writeRSLocation(this.serverInfo);
if(!startCodeOk) {
LOG.debug("Start code already taken, trying another one");
@@ -1367,11 +1366,6 @@ 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=948357&r1=948356&r2=948357&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:46:10 2010
@@ -42,6 +42,8 @@
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();
%>
@@ -103,7 +105,7 @@
%>
<%= tableHeader %>
<%
- int infoPort = master.getServerManager().getHServerInfo(rootLocation).getInfoPort();
+ int infoPort = serverAddressToServerInfos.get(rootLocation).getInfoPort();
String url = "http://" + rootLocation.getHostname() + ":" + infoPort + "/";
%>
<tr>
@@ -121,7 +123,7 @@
<%
Map<byte [], MetaRegion> onlineRegions = master.getOnlineMetaRegions();
for (MetaRegion meta: onlineRegions.values()) {
- int infoPort = master.getServerManager().getHServerInfo(meta.getServer()).getInfoPort();
+ int infoPort = serverAddressToServerInfos.get(meta.getServer()).getInfoPort();
String url = "http://" + meta.getServer().getHostname() + ":" + infoPort + "/";
%>
<tr>
@@ -144,7 +146,10 @@
<%= tableHeader %>
<%
for(Map.Entry<HRegionInfo, HServerAddress> hriEntry : regions.entrySet()) {
- int infoPort = master.getServerManager().getHServerInfo(hriEntry.getValue()).getInfoPort();
+
+ int infoPort = serverAddressToServerInfos.get(
+ hriEntry.getValue()).getInfoPort();
+
String urlRegionServer =
"http://" + hriEntry.getValue().getHostname().toString() + ":" + infoPort + "/";
%>