[ 
https://issues.apache.org/jira/browse/HADOOP-2579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bryan Duxbury updated HADOOP-2579:
----------------------------------

    Attachment: 2579.patch

This patch includes Peter's new test cases and some fixes to HTable, 
HConnectionManager, HRegionServer, HRegion, and HStore to correctly handle the 
case when there's no tables at all in .META.

> initializing a new HTable object against a nonexistent table throws a 
> NoServerForRegionException instead of a TableNotFoundException when a 
> different table has been created previously
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-2579
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2579
>             Project: Hadoop
>          Issue Type: Bug
>          Components: contrib/hbase
>            Reporter: Peter Dolan
>         Attachments: 2579.patch
>
>
> When a table has been created, initializing a new HTable object for that 
> table works properly, as expected, but initializing a new HTable against a 
> nonexistent table in the same context (a table exists), a 
> NoServerForRegionException is thrown instead of TableNotFoundException, as 
> would be expected.
> If there haven't been any tables created, initializing a new HTable object 
> against 'nosuchTable' throws TableNotFoundException, as expected.
> Running the following TestCase exposes the issue on my machine.
> {code:title=TestHTable.java|borderStyle=solid}
> package org.apache.hadoop.hbase;
> import java.io.IOException;
> import org.apache.hadoop.io.Text;
> /**
>  * Tests HTable
>  */
> public class TestHTable extends HBaseClusterTestCase implements HConstants {
>   public void testTableNotFoundExceptionWithoutAnyTables() {
>     try {
>       new HTable(conf, new Text("notATable"));
>       fail("Should have thrown a TableNotFoundException");
>     } catch (TableNotFoundException e) {
>       // expected
>     } catch (IOException e) {
>       e.printStackTrace();
>       fail("Should have thrown a TableNotFoundException instead of a " +
>           e.getClass());
>     }
>   }
>   
>   public void testTableNotFoundExceptionWithATable() {
>     try {
>       HColumnDescriptor column =
>         new HColumnDescriptor(COLUMN_FAMILY.toString());
>       HBaseAdmin admin = new HBaseAdmin(conf);
>       HTableDescriptor testTableADesc =
>         new HTableDescriptor("table");
>       testTableADesc.addFamily(column);
>       admin.createTable(testTableADesc);
>       // This should throw a TableNotFoundException, it has not been created
>       new HTable(conf, new Text("notATable"));
>       
>       fail("Should have thrown a TableNotFoundException");
>     } catch (TableNotFoundException e) {
>       // expected
>     } catch (IOException e) {
>       e.printStackTrace();
>       fail("Should have thrown a TableNotFoundException instead of a " +
>           e.getClass());
>     }
>   }
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to