Thanks again, yep I am going to switch to just creating one column family with 30 qualifiers.

On Oct 19, 2009, at 10:38 AM, Jonathan Gray wrote:

There is a distinct difference between adding "columns" and adding "column families".

As you hinted at in a previous e-mail, you really wanted a single family with multiple qualifiers in it.

Creating a table, disabling it, modifying it (adding column _families_), enabling it, and repeating could certainly uncover some of the "issues" in those operations, this is what is meant by flaky. It does mostly work, but in a scenario like that where you are rapidly altering and modifying the table state, it could uncover some of the flakiness :)

Cleaning up this process is one of the major targets for 0.21, at which point doing what you did originally (however misguided it may have been) would work without issue.

JG

yz5od2 wrote:
OK, changing the way I create tables to the suggested way below (populating a table descriptor prior to table create, VS. adding columns to a pre-existing table) appears to have fixed this issue. (Thanks!) However i don't understand why adding columns to an existing table vs via the descriptor before table creation works vs. the latter does not. Why would adding columns to an existing table, have such an effect on failing to re-create a table on the 2nd run? Might this be a bug?
On Oct 19, 2009, at 9:11 AM, Tatsuya Kawano wrote:
Hi,

Could you please set the logging level to DEBUG and check the hbase
master log and region server log if they have some error or warning
messages? By default, those logs should be under $HBASE_HOME/logs/ and
you can set DEBUG logging by un-commenting the following line in
$HBASE_HOME/conf/log4j.properties

log4j.logger.org.apache.hadoop.hbase=DEBUG


Also, when you create a table, you can skip disabling and enabling
steps by adding HColumnDescriptor ***before*** creating the table. So
why don't you try this?

================================
HTableDescriptor tableDesc = new HTableDescriptor(tableName);

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

for (String column : columns) {
  tableDesc.addFamily(tableName, new HColumnDescriptor(column));
}

admin.createTable(tableDesc);
================================

Thanks,

--
Tatsuya Kawano (Mr.)
Tokyo, Japan



On Mon, Oct 19, 2009 at 9:53 AM, yz5od2 <[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