HBASE-602 HBase Crash when network card has a IPv6 address

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@713488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-11-12 20:11:31 +00:00
parent b396f6b5f6
commit 01f09c1036
5 changed files with 36 additions and 14 deletions

View File

@ -70,7 +70,8 @@ Release 0.19.0 - Unreleased
HBASE-964, HBASE-678 provide for safe-mode without locking up HBase "waiting HBASE-964, HBASE-678 provide for safe-mode without locking up HBase "waiting
for root region" for root region"
HBASE-990 NoSuchElementException in flushSomeRegions HBASE-990 NoSuchElementException in flushSomeRegions
HBASE-602 HBase Crash when network card has a IPv6 address
IMPROVEMENTS IMPROVEMENTS
HBASE-901 Add a limit to key length, check key and value length on client side HBASE-901 Add a limit to key length, check key and value length on client side
HBASE-890 Alter table operation and also related changes in REST interface HBASE-890 Alter table operation and also related changes in REST interface

View File

@ -30,6 +30,7 @@ import java.net.InetSocketAddress;
* HServerAddress is a "label" for a HBase server that combines the host * HServerAddress is a "label" for a HBase server that combines the host
* name and port number. * name and port number.
*/ */
@SuppressWarnings("unchecked")
public class HServerAddress implements WritableComparable { public class HServerAddress implements WritableComparable {
private InetSocketAddress address; private InetSocketAddress address;
String stringValue; String stringValue;

View File

@ -77,13 +77,8 @@ class ProcessServerShutdown extends RegionServerOperation {
this.rootRegionServer = rootRegionServer; this.rootRegionServer = rootRegionServer;
this.logSplit = false; this.logSplit = false;
this.rootRescanned = false; this.rootRescanned = false;
StringBuilder dirName = new StringBuilder("log_"); this.oldLogDir =
dirName.append(deadServer.getBindAddress()); new Path(master.rootdir, HLog.getHLogDirectoryName(serverInfo));
dirName.append("_");
dirName.append(serverInfo.getStartCode());
dirName.append("_");
dirName.append(deadServer.getPort());
this.oldLogDir = new Path(master.rootdir, dirName.toString());
} }
@Override @Override
@ -257,8 +252,11 @@ class ProcessServerShutdown extends RegionServerOperation {
} }
if (!rootAvailable()) { if (!rootAvailable()) {
// Get root region assigned now that log has been split if (rootRegionServer) {
master.regionManager.reassignRootRegion(); // Get root region assigned now that log has been split and if the
// dead server was serving the root region
master.regionManager.reassignRootRegion();
}
// Return true so that worker does not put this request back on the // Return true so that worker does not put this request back on the
// toDoQueue. // toDoQueue.

View File

@ -22,6 +22,8 @@ package org.apache.hadoop.hbase.regionserver;
import java.io.EOFException; import java.io.EOFException;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.SortedMap; import java.util.SortedMap;
@ -40,6 +42,7 @@ import org.apache.hadoop.fs.Syncable;
import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HServerInfo;
import org.apache.hadoop.hbase.HStoreKey; import org.apache.hadoop.hbase.HStoreKey;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.RemoteExceptionHandler; import org.apache.hadoop.hbase.RemoteExceptionHandler;
@ -752,6 +755,28 @@ public class HLog implements HConstants, Syncable {
LOG.info("log file splitting completed for " + srcDir.toString()); LOG.info("log file splitting completed for " + srcDir.toString());
} }
/**
* Construct the HLog directory name
*
* @param info HServerInfo for server
* @return the HLog directory name
*/
public static String getHLogDirectoryName(HServerInfo info) {
StringBuilder dirName = new StringBuilder("log_");
try {
dirName.append(URLEncoder.encode(
info.getServerAddress().getBindAddress(), UTF8_ENCODING));
} catch (UnsupportedEncodingException e) {
LOG.error("Error encoding '" + info.getServerAddress().getBindAddress()
+ "'", e);
}
dirName.append("_");
dirName.append(info.getStartCode());
dirName.append("_");
dirName.append(info.getServerAddress().getPort());
return dirName.toString();
}
private static void usage() { private static void usage() {
System.err.println("Usage: java org.apache.hbase.HLog" + System.err.println("Usage: java org.apache.hbase.HLog" +
" {--dump <logfile>... | --split <logdir>...}"); " {--dump <logfile>... | --split <logdir>...}");

View File

@ -585,10 +585,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
private HLog setupHLog() throws RegionServerRunningException, private HLog setupHLog() throws RegionServerRunningException,
IOException { IOException {
Path logdir = new Path(rootDir, "log" + "_" + Path logdir = new Path(rootDir, HLog.getHLogDirectoryName(serverInfo));
serverInfo.getServerAddress().getBindAddress() + "_" +
this.serverInfo.getStartCode() + "_" +
this.serverInfo.getServerAddress().getPort());
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Log dir " + logdir); LOG.debug("Log dir " + logdir);
} }