Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-739

HBaseAdmin.createTable() using old HTableDescription doesn't work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.2.0
    • 0.2.0
    • Client
    • None

    Description

      The following test case (see below) illustrate what used to work in branch 0.1 and that doesn't anymore. testTruncateInTrunk() shows how I got it to work again. I get this error now when trying the old code but using trunk:

      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.openplaces.test.fixture.FixtureLoader.truncateHbaseTable(FixtureLoader.java:105)
      at com.openplaces.test.fixture.FixtureLoader.loadHbaseFixtures(FixtureLoader.java:63)
      at com.openplaces.test.fixture.TestCaseWithFixtures.hbaseFixtures(TestCaseWithFixtures.java:34)
      at com.openplaces.test.isolated.TestSearchSRFIEF.setUp(TestSearchSRFIEF.java:37)
      at junit.framework.TestCase.runBare(TestCase.java:125)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.net.SocketTimeoutException: timed out waiting for rpc response
      at org.apache.hadoop.ipc.Client.call(Client.java:559)
      at org.apache.hadoop.hbase.ipc.HbaseRPC$Invoker.invoke(HbaseRPC.java:211)
      at $Proxy5.createTable(Unknown Source)
      at org.apache.hadoop.hbase.client.HBaseAdmin.createTableAsync(HBaseAdmin.java:184)
      at org.apache.hadoop.hbase.client.HBaseAdmin.createTable(HBaseAdmin.java:144)
      at com.openplaces.util.hbaserecord.connectionadapters.HbaseAdapter.truncateTable(HbaseAdapter.java:502)
      at com.openplaces.util.hbaserecord.Base$Singleton.truncate(Base.java:609)
      ... 21 more

      import java.io.IOException;
      import java.util.Collection;

      import org.apache.hadoop.hbase.HBaseConfiguration;
      import org.apache.hadoop.hbase.HColumnDescriptor;
      import org.apache.hadoop.hbase.HTableDescriptor;
      import org.apache.hadoop.hbase.client.HBaseAdmin;
      import org.apache.hadoop.hbase.client.HTable;

      import junit.framework.TestCase;

      @SuppressWarnings("deprecation")
      public class TestTruncate extends TestCase {

      public void testTruncateInBranch_0_1() throws IOException

      { HTable table = new HTable("mytable"); HBaseAdmin admin = new HBaseAdmin(new HBaseConfiguration()); HTableDescriptor tableDesc = table.getMetadata(); admin.deleteTable(table.getTableName()); admin.createTable(tableDesc); }

      public void testTruncateInTrunk() throws IOException{
      HTable table = new HTable("mytable");
      HBaseAdmin admin = new HBaseAdmin(new HBaseConfiguration());
      Collection<HColumnDescriptor> families = table.getMetadata().getFamilies();

      HTableDescriptor tableDesc = new HTableDescriptor(table.getTableName());
      for(HColumnDescriptor family : families)

      { tableDesc.addFamily(family); }

      admin.deleteTable(table.getTableName());
      admin.createTable(tableDesc);
      }
      }

      Attachments

        1. hbase-739.patch
          0.8 kB
          Izaak Rubin
        2. TestHbase739.java
          1 kB
          Izaak Rubin
        3. TEST-org.apache.hadoop.hbase.TestTruncateIsaak.txt
          7 kB
          Sebastien Rainville
        4. TestTruncate2.java
          2 kB
          Sebastien Rainville
        5. master.log
          13 kB
          Sebastien Rainville
        6. hbase-739_v2.patch
          0.6 kB
          Izaak Rubin

        Activity

          People

            irubin Izaak Rubin
            srainville Sebastien Rainville
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: