hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r773825 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java src/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
Date Tue, 12 May 2009 08:54:06 GMT
Author: apurtell
Date: Tue May 12 08:54:05 2009
New Revision: 773825

URL: http://svn.apache.org/viewvc?rev=773825&view=rev
Log:
HBASE-1391 NPE in TableInputFormatBase.restart if zoo.cfg is wrong or missing on tasktrackers

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=773825&r1=773824&r2=773825&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Tue May 12 08:54:05 2009
@@ -123,6 +123,8 @@
                Purtell)
    HBASE-1311  ZooKeeperWrapper: Failed to set watcher on ZNode /hbase/master
                (Nitay Joffe via Stack)
+   HBASE-1391  NPE in TableInputFormatBase$TableRecordReader.restart if zoo.cfg
+               is wrong or missing on task trackers
 
   IMPROVEMENTS
    HBASE-1089  Add count of regions on filesystem to master UI; add percentage

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java?rev=773825&r1=773824&r2=773825&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormat.java Tue May
12 08:54:05 2009
@@ -30,6 +30,7 @@
 import org.apache.hadoop.mapred.FileInputFormat;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.JobConfigurable;
+import org.apache.hadoop.util.StringUtils;
 
 /**
  * Convert HBase tabular data into a format that is consumable by Map/Reduce.
@@ -58,7 +59,7 @@
     try {
       setHTable(new HTable(new HBaseConfiguration(job), tableNames[0].getName()));
     } catch (Exception e) {
-      LOG.error(e);
+      LOG.error(StringUtils.stringifyException(e));
     }
   }
 
@@ -69,6 +70,12 @@
       throw new IOException("expecting one table name");
     }
 
+    // connected to table?
+    if (getHTable() == null) {
+      throw new IOException("could not connect to table '" +
+        tableNames[0].getName() + "'");
+    }
+
     // expecting at least one column
     String colArg = job.get(COLUMN_LIST);
     if (colArg == null || colArg.length() == 0) {

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java?rev=773825&r1=773824&r2=773825&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/mapred/TableInputFormatBase.java Tue
May 12 08:54:05 2009
@@ -305,6 +305,13 @@
   }
 
   /**
+   * Allows subclasses to get the {@link HTable}.
+   */
+  protected HTable getHTable() {
+    return this.table;
+  }
+
+  /**
    * Allows subclasses to set the {@link HTable}.
    *
    * @param table to get the data from

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java?rev=773825&r1=773824&r2=773825&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Tue
May 12 08:54:05 2009
@@ -20,6 +20,8 @@
 package org.apache.hadoop.hbase.zookeeper;
 
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
@@ -32,6 +34,7 @@
 import org.apache.hadoop.hbase.HServerAddress;
 import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.util.StringUtils;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.Watcher;
@@ -158,6 +161,7 @@
 
     // The clientPort option may come after the server.X hosts, so we need to
     // grab everything and then create the final host:port comma separated list.
+    boolean anyValid = false;
     for (Entry<Object,Object> property : properties.entrySet()) {
       String key = property.getKey().toString().trim();
       String value = property.getValue().toString().trim();
@@ -167,9 +171,20 @@
       else if (key.startsWith("server.")) {
         String host = value.substring(0, value.indexOf(':'));
         servers.add(host);
+        try {
+          InetAddress.getByName(host);
+          anyValid = true;
+        } catch (UnknownHostException e) {
+          LOG.warn(StringUtils.stringifyException(e));
+        }
       }
     }
 
+    if (!anyValid) {
+      LOG.error("no valid quorum servers found in " + ZOOKEEPER_CONFIG_NAME);
+      return;
+    }
+
     if (clientPort == null) {
       LOG.error("no clientPort found in " + ZOOKEEPER_CONFIG_NAME);
       return;



Mime
View raw message