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/src/contrib/hbase@551725 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2fa16d4fdf
commit
96c64712e6
|
@ -42,4 +42,4 @@ Trunk (unreleased changes)
|
||||||
24. HADOOP-1534. [hbase] Memcache scanner fails if start key not present
|
24. HADOOP-1534. [hbase] Memcache scanner fails if start key not present
|
||||||
25. HADOOP-1537. Catch exceptions in testCleanRegionServerExit so we can see
|
25. HADOOP-1537. Catch exceptions in testCleanRegionServerExit so we can see
|
||||||
what is failing.
|
what is failing.
|
||||||
|
26. HADOOP-1543 [hbase] Add HClient.tableExists
|
||||||
|
|
|
@ -126,6 +126,23 @@ public class HClient implements HConstants {
|
||||||
this.rand = new Random();
|
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 {
|
protected void handleRemoteException(RemoteException e) throws IOException {
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
if(e.getClassName().equals("org.apache.hadoop.hbase.InvalidColumnNameException")) {
|
if(e.getClassName().equals("org.apache.hadoop.hbase.InvalidColumnNameException")) {
|
||||||
|
|
|
@ -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
|
<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>.
|
<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
|
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
|
to define at least <code>JAVA_HOME</code>. Also, add site-particular
|
||||||
customizations to the file <code>${HADOOP_HOME}/conf/hadoop-site.xml</code>.
|
customizations to the file <code>${HADOOP_HOME}/conf/hadoop-site.xml</code>.
|
||||||
Try the following command: <pre>bin/hadoop
|
Try the following command: <pre>bin/hadoop
|
||||||
|
|
Loading…
Reference in New Issue