Thanks for the reply, my responses:

>Enable/Disable is kinda flakey in hbase 0.20.

a) i am using 0.20.1. I mean so is my code incorrect in the way it creates/enables, disables deletes the tables. Should that work or no? By flakey does that mean it doesn't work all the time etc?

b) What is TestAdmin? I don't see that in the 0.20.1 docs

>> You might also change your test code so you add the columns to the table

c) I will try this and report back


>>Are you making a table of 30 column families?  Try less.

d) Yes, for each column I was creating it as a unique family/qualifier combo. But that was likely due to my newbie misunderstanding. I should probobly create ONE column family per table, then just add all 30 of my columns as unique qualifiers within that?



On Oct 19, 2009, at 9:09 AM, stack wrote:

Enable/Disable is kinda flakey in hbase 0.20. If on 0.20.1, it should be a
bit better.  This'll be fixed in 0.21.

Meantime, see TestAdmin.  It hangs around till its sure table is
enabled/disabled.  Can you add this to your tests?

You might also change your test code so you add the columns to the table descriptor so on creation it has all column families rather than create,
disable and then add.

There are no restrictions regards column names, etc., regards enable/ disable
that I'm aware of.

Are you making a table of 30 column families?  Try less.

Why not just let out this exception?

this.config = new HBaseConfiguration();
try {
      admin = new HBaseAdmin(config);
} catch(MasterNotRunningException e) {
      throw new Exception("Could not setup HBaseAdmin as no master is
running...");
}


Yours,
St.Ack

On Sun, Oct 18, 2009 at 5:53 PM, yz5od2 <woods5242- [email protected]>wrote:

And another followup.

One of the table's has around 30 columns (MyTable1). If I do not create any
of the columns in this table on the 2nd run of the test, the table is
created, disabled, enabled, then dropped successfully.

Are there any restrictions in column names or anything related to inserting data into that table, then dropping it that I would need to be aware of?

On Oct 18, 2009, at 11:48 AM, yz5od2 wrote:

Hi,
I am running the latest version of Hbase in standalone mode.

I have a Junit test which connects to the local Hbase process, creates 2 tables, inserts some records, reads those records, then deletes the records. When the test is done, it disables both tables and then deletes the tables. All of these actions complete successfully. When I bring up the Hbase shell,
I verify that the tables do not exist. (code below)

-----------------
1st run
-----------------
Here is the console output when it creates the new tables before inserting
data

[18/10/09 11:35:57:057 MDT] INFO client.HBaseAdmin: Disabled MyTable1 [18/10/09 11:35:57:057 MDT] INFO client.HBaseAdmin: Disabled MyTable1
[18/10/09 11:35:58:058 MDT]  INFO client.HBaseAdmin: Enabled table
MyTable1
[18/10/09 11:35:58:058 MDT]  INFO client.HBaseAdmin: Enabled table
MyTable1
[18/10/09 11:36:10:010 MDT] INFO client.HBaseAdmin: Disabled MyTable2 [18/10/09 11:36:10:010 MDT] INFO client.HBaseAdmin: Disabled MyTable2
[18/10/09 11:36:10:010 MDT]  INFO client.HBaseAdmin: Enabled table
MyTable2
[18/10/09 11:36:10:010 MDT]  INFO client.HBaseAdmin: Enabled table
MyTable2

DATA IS PUT, GET and DELETEd here.....

[18/10/09 11:37:27:027 MDT] INFO client.HBaseAdmin: Disabled MyTable1 [18/10/09 11:37:27:027 MDT] INFO client.HBaseAdmin: Disabled MyTable1 [18/10/09 11:37:27:027 MDT] INFO client.HBaseAdmin: Deleted MyTable1 [18/10/09 11:37:27:027 MDT] INFO client.HBaseAdmin: Deleted MyTable1 [18/10/09 11:37:33:033 MDT] INFO client.HBaseAdmin: Disabled MyTable2 [18/10/09 11:37:33:033 MDT] INFO client.HBaseAdmin: Disabled MyTable2 [18/10/09 11:37:33:033 MDT] INFO client.HBaseAdmin: Deleted MyTable2 [18/10/09 11:37:33:033 MDT] INFO client.HBaseAdmin: Deleted MyTable2

After the process completes, I verify in Hbase shell that the tables in
fact do not exist.


-------------------
2nd run
-------------------

However when I run the same test the 2nd time, it fails on trying to
enable the first table it re-creates, with the following error.

[18/10/09 11:39:42:042 MDT] INFO zookeeper.ClientCnxn: Server connection
successful
[18/10/09 11:39:55:055 MDT] INFO client.HBaseAdmin: Disabled MyTable1 [18/10/09 11:39:55:055 MDT] INFO client.HBaseAdmin: Disabled MyTable1

At this point it seems to sit there, and fails with the following error. When I go to Hbase shell, I see that the MyTable1 does in fact exist. However it looks like my code fails on enabling it. What might be the
problem?


Caused by: java.io.IOException: Unable to enable table MyTable1
      at
org .apache.hadoop.hbase.client.HBaseAdmin.enableTable(HBaseAdmin.java: 356)
      at
org .apache.hadoop.hbase.client.HBaseAdmin.enableTable(HBaseAdmin.java: 315)


I really don't follow why this error is occurring. here is my code that
creates the tables and deletes them:


this.config = new HBaseConfiguration();
try {
      admin = new HBaseAdmin(config);
} catch(MasterNotRunningException e) {
throw new Exception("Could not setup HBaseAdmin as no master is
running...");
}

// FOR EACH of my tables (MyTable1 and MyTable2)
...

String tableName = clazz.getSimpleName();

if (!admin.tableExists(tableName)) {
      admin.createTable(new HTableDescriptor(tableName));
      admin.disableTable(tableName);

      String[] columns = this.getColumns(clazz);

      for (String column : columns) {
admin.addColumn(tableName, new HColumnDescriptor(column));
      }

}

if (!admin.isTableEnabled(tableName)) {
      admin.enableTable(tableName);
}

.....


// MY CODE TO DELETE THE TABLES (for each ... MyTable1 etc..)
if (admin.tableExists(tableName)) {
      admin.disableTable(tableName);
      admin.deleteTable(tableName);
}






Reply via email to