HADOOP-2198 HTable should have method to return table metadata

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@599534 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2007-11-29 18:25:39 +00:00
parent 7102265285
commit 6f14e60b7f
3 changed files with 44 additions and 21 deletions

View File

@ -41,27 +41,29 @@ Trunk (unreleased changes)
(Bryan Duxbury via Stack)
IMPROVEMENTS
HADOOP-2401 Add convenience put method that takes writable
(Johan Oskarsson via Stack)
HADOOP-2074 Simple switch to enable DEBUG level-logging in hbase
HADOOP-2088 Make hbase runnable in $HADOOP_HOME/build(/contrib/hbase)
HADOOP-2126 Use Bob Jenkins' hash for bloom filters
HADOOP-2157 Make Scanners implement Iterable
HADOOP-2176 Htable.deleteAll documentation is ambiguous
HADOOP-2139 (phase 1) Increase parallelism in region servers.
HADOOP-2267 [Hbase Shell] Change the prompt's title from 'hbase' to 'hql'.
(Edward Yoon via Stack)
HADOOP-2139 (phase 2) Make region server more event driven
HADOOP-2289 Useless efforts of looking for the non-existant table in select
command.
(Edward Yoon via Stack)
HADOOP-2257 Show a total of all requests and regions on the web ui
(Paul Saab via Stack)
HADOOP-2261 HTable.abort no longer throws exception if there is no active update.
HADOOP-2287 Make hbase unit tests take less time to complete.
HADOOP-2262 Retry n times instead of n**2 times.
HADOOP-1608 Relational Algrebra Operators
(Edward Yoon via Stack)
HADOOP-2401 Add convenience put method that takes writable
(Johan Oskarsson via Stack)
HADOOP-2074 Simple switch to enable DEBUG level-logging in hbase
HADOOP-2088 Make hbase runnable in $HADOOP_HOME/build(/contrib/hbase)
HADOOP-2126 Use Bob Jenkins' hash for bloom filters
HADOOP-2157 Make Scanners implement Iterable
HADOOP-2176 Htable.deleteAll documentation is ambiguous
HADOOP-2139 (phase 1) Increase parallelism in region servers.
HADOOP-2267 [Hbase Shell] Change the prompt's title from 'hbase' to 'hql'.
(Edward Yoon via Stack)
HADOOP-2139 (phase 2) Make region server more event driven
HADOOP-2289 Useless efforts of looking for the non-existant table in select
command.
(Edward Yoon via Stack)
HADOOP-2257 Show a total of all requests and regions on the web ui
(Paul Saab via Stack)
HADOOP-2261 HTable.abort no longer throws exception if there is no active update.
HADOOP-2287 Make hbase unit tests take less time to complete.
HADOOP-2262 Retry n times instead of n**2 times.
HADOOP-1608 Relational Algrebra Operators
(Edward Yoon via Stack)
HADOOP-2198 HTable should have method to return table metadata
Release 0.15.1
Branch 0.15

View File

@ -163,6 +163,22 @@ public class HTable implements HConstants {
return this.tableName;
}
/**
* @return table metadata
* @throws IOException
*/
public HTableDescriptor getMetadata() throws IOException {
HTableDescriptor [] metas = this.connection.listTables();
HTableDescriptor result = null;
for (int i = 0; i < metas.length; i++) {
if (metas[i].getName().equals(this.tableName)) {
result = metas[i];
break;
}
}
return result;
}
/**
* Gets the starting row key for every region in the currently open table
* @return Array of region starting row keys

View File

@ -71,6 +71,11 @@ public class TestHTable extends HBaseClusterTestCase implements HConstants {
// put some data into table A
HTable a = new HTable(conf, tableAname);
// Assert the metadata is good.
HTableDescriptor meta = a.getMetadata();
assertTrue(meta.equals(tableAdesc));
long lockid = a.startUpdate(row);
a.put(lockid, COLUMN_FAMILY, value);
a.commit(lockid);