Explorar el Código

HADOOP-1543 [base] Add HClient.tableExists
M src/java/org/apache/hadoop/hbase/HClient.java
(tableExists): Added
M CHANGES.txt
M src/java/org/apache/hadoop/hbase/package.html
Fix javadoc.


git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@551725 13f79535-47bb-0310-9956-ffa450edef68

Michael Stack hace 18 años
padre
commit
cd543c2b43

+ 1 - 1
src/contrib/hbase/CHANGES.txt

@@ -42,4 +42,4 @@ Trunk (unreleased changes)
  24. HADOOP-1534. [hbase] Memcache scanner fails if start key not present
  25. HADOOP-1537. Catch exceptions in testCleanRegionServerExit so we can see
      what is failing.
-
+ 26. HADOOP-1543 [hbase] Add HClient.tableExists

+ 17 - 0
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HClient.java

@@ -125,6 +125,23 @@ public class HClient implements HConstants {
     this.currentServer = null;
     this.rand = new Random();
   }
+
+  /**
+   * @param tableName Table to check.
+   * @return True if table exists already.
+   * @throws IOException
+   */
+  public boolean tableExists(final Text tableName) throws IOException {
+    HTableDescriptor [] tables = listTables();
+    boolean result = false;
+    for (int i = 0; i < tables.length; i++) {
+      if (tables[i].getName().equals(tableName)) {
+        result = true;
+        break;
+      }
+    }
+    return result;
+  }
   
   protected void handleRemoteException(RemoteException e) throws IOException {
     String msg = e.getMessage();

+ 1 - 1
src/contrib/hbase/src/java/org/apache/hadoop/hbase/package.html

@@ -18,7 +18,7 @@ Set <code>JAVA_HOME</code> to the root of your Java installation</li>
 <p>First, you need a working instance of Hadoop.  Download a recent release from
 <a href="http://www.apache.org/dyn/closer.cgi/lucene/hadoop/">Hadoop downloads</a>. 
 Unpack the release and connect to its top-level directory.  Let this be
-<code>${HADOOP_HOME}.  Edit the file <code>${HADOOP_HOME}/conf/hadoop-env.sh</code>
+<code>${HADOOP_HOME}</code>.  Edit the file <code>${HADOOP_HOME}/conf/hadoop-env.sh</code>
 to define at least <code>JAVA_HOME</code>.  Also, add site-particular
 customizations to the file <code>${HADOOP_HOME}/conf/hadoop-site.xml</code>.
 Try the following command: <pre>bin/hadoop