hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1138601 - in /hbase/trunk/src: main/java/org/apache/hadoop/hbase/avro/ main/java/org/apache/hadoop/hbase/client/ main/java/org/apache/hadoop/hbase/util/ test/java/org/apache/hadoop/hbase/avro/ test/java/org/apache/hadoop/hbase/util/
Date Wed, 22 Jun 2011 19:55:40 GMT
Author: stack
Date: Wed Jun 22 19:55:40 2011
New Revision: 1138601

URL: http://svn.apache.org/viewvc?rev=1138601&view=rev
Log:
HBASE-451 Remove HTableDescriptor from HRegionInfo -- part 2, some cleanup

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/avro/TestAvroServer.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java?rev=1138601&r1=1138600&r2=1138601&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/avro/AvroServer.java Wed Jun 22 19:55:40
2011
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.HBaseConf
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.TableExistsException;
+import org.apache.hadoop.hbase.TableNotFoundException;
 import org.apache.hadoop.hbase.avro.generated.AClusterStatus;
 import org.apache.hadoop.hbase.avro.generated.ADelete;
 import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor;
@@ -190,6 +191,8 @@ public class AvroServer {
     public ATableDescriptor describeTable(ByteBuffer table) throws AIOError {
       try {
 	return AvroUtil.htdToATD(admin.getTableDescriptor(Bytes.toBytes(table)));
+      } catch (TableNotFoundException e) {
+        return null;
       } catch (IOException e) {
         AIOError ioe = new AIOError();
         ioe.message = new Utf8(e.getMessage());

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1138601&r1=1138600&r2=1138601&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Wed Jun 22 19:55:40
2011
@@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.RegionExc
 import org.apache.hadoop.hbase.RemoteExceptionHandler;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableExistsException;
+import org.apache.hadoop.hbase.TableNotFoundException;
 import org.apache.hadoop.hbase.UnknownRegionException;
 import org.apache.hadoop.hbase.ZooKeeperConnectionException;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
@@ -194,10 +195,11 @@ public class HBaseAdmin implements Abort
    * Method for getting the tableDescriptor
    * @param tableName as a byte []
    * @return the tableDescriptor
+   * @throws TableNotFoundException
    * @throws IOException if a remote or network exception occurs
    */
   public HTableDescriptor getTableDescriptor(final byte [] tableName)
-  throws IOException {
+  throws TableNotFoundException, IOException {
     return this.connection.getHTableDescriptor(tableName);
   }
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1138601&r1=1138600&r2=1138601&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Wed Jun 22 19:55:40
2011
@@ -936,6 +936,9 @@ public class FSUtils {
     HTableDescriptor htd = null;
     try {
       htd = getTableDescriptor(fs, getTablePath(hbaseRootDir, tableName));
+    } catch (NullPointerException e) {
+      LOG.debug("Exception during readTableDecriptor. Current table name = " +
+        tableName , e);
     } catch (IOException ioe) {
       LOG.debug("Exception during readTableDecriptor. Current table name = " +
         tableName , ioe);
@@ -944,10 +947,10 @@ public class FSUtils {
   }
 
   public static HTableDescriptor getTableDescriptor(FileSystem fs, Path tableDir)
-  throws IOException {
+  throws IOException, NullPointerException {
     if (tableDir == null) throw new NullPointerException();
-    FSDataInputStream fsDataInputStream =
-      fs.open(new Path(tableDir, HConstants.TABLEINFO_NAME));
+    Path tableinfo = new Path(tableDir, HConstants.TABLEINFO_NAME);
+    FSDataInputStream fsDataInputStream = fs.open(tableinfo);
     HTableDescriptor hTableDescriptor = null;
     try {
       hTableDescriptor = new HTableDescriptor();

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/avro/TestAvroServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/avro/TestAvroServer.java?rev=1138601&r1=1138600&r2=1138601&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/avro/TestAvroServer.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/avro/TestAvroServer.java Wed Jun 22
19:55:40 2011
@@ -125,7 +125,11 @@ public class TestAvroServer {
     tableA.maxFileSize = 123456L;
     impl.modifyTable(tableAname, tableA);
     // It can take a while for the change to take effect.  Wait here a while.
-    while(impl.describeTable(tableAname).maxFileSize != 123456L) Threads.sleep(100);
+    while(impl.describeTable(tableAname) == null) {
+      Threads.sleep(100);
+    }
+
+    assertTrue(impl.describeTable(tableAname).maxFileSize == 123456L);
     assertEquals(123456L, (long) impl.describeTable(tableAname).maxFileSize);
 /* DISABLED FOR NOW TILL WE HAVE BETTER DISABLE/ENABLE
     impl.enableTable(tableAname);

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java?rev=1138601&r1=1138600&r2=1138601&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java Wed Jun 22
19:55:40 2011
@@ -36,8 +36,6 @@ import org.apache.hadoop.hbase.HTableDes
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.catalog.MetaReader;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HConnection;
-import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.junit.Test;
@@ -96,7 +94,9 @@ public class TestMergeTable {
     byte [] row_70001 = Bytes.toBytes("row_70001");
     byte [] row_80001 = Bytes.toBytes("row_80001");
 
-    // Create regions and populate them at same time.
+    // Create regions and populate them at same time.  Create the tabledir
+    // for them first.
+    FSUtils.createTableDescriptor(fs, rootdir, desc);
     HRegion [] regions = {
       createRegion(desc, null, row_70001, 1, 70000, rootdir),
       createRegion(desc, row_70001, row_80001, 70001, 10000, rootdir),



Mime
View raw message