hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeff saremi <jeffsar...@hotmail.com>
Subject Re: Baffling situation with tableExists and createTable
Date Wed, 26 Apr 2017 19:50:40 GMT
i created this
https://issues.apache.org/jira/browse/HBASE-17966

to track this issue

Overall, none of this should have pushed out to the User. HBase should have transparently
take care of inconsistency in the zookeeper. However i didn't make this ticket as comprehensive
to include what I just said. Let's get tableExists and createTable the same for now

________________________________
From: jeff saremi <jeffsaremi@hotmail.com>
Sent: Wednesday, April 26, 2017 8:31:23 AM
To: user@hbase.apache.org
Subject: Re: Baffling situation with tableExists and createTable

yes i had to go to zookeeper and manually delete a node under Tables

my question is why there are multiple standards in how tables are handled

The same logic that is in tableExists() should exist in createTable() and vice versa


________________________________
From: ashish singhi <ashish.singhi@huawei.com>
Sent: Wednesday, April 26, 2017 2:29:49 AM
To: user@hbase.apache.org
Subject: RE: Baffling situation with tableExists and createTable

This is already handled through Procedure-V2 code in HBase 1.1+ versions.

Regards,
Ashish

-----Original Message-----
From: Anoop John [mailto:anoop.hbase@gmail.com]
Sent: 26 April 2017 15:31
To: user@hbase.apache.org
Subject: Re: Baffling situation with tableExists and createTable

Ur earlier attempt to create this table would have failed in btw..  So the status of the table
in zk and in master may be diff.. Table exist might be checking one and the next steps of
crate table another..
Sorry forgot that area of code.. But have seen this kind of situation.
  Not sure whether in some latest versions, these kind of probs are solved or not.

-Anoop-

On Wed, Apr 26, 2017 at 6:12 AM, Ted Yu <yuzhihong@gmail.com> wrote:
> Which hbase release are you using ?
>
> Can you check master log to see if there is some clue w.r.t. LoadTest ?
>
> Using "hbase zkcli", you can inspect the znode status. Below is a sample:
>
> [zk: cn011.x.com:2181,cn013.x.com:2181,cn012.x.com:2181(CONNECTED) 2]
> ls /hbase-unsecure/table [hbase:meta, hbase:namespace,
> IntegrationTestBigLinkedList, datatsv, usertable, hbase:backup,
> TestTable, t2]
> [zk: cn011.x.com:2181,cn013.x.com:2181,cn012.x.com:2181(CONNECTED) 3]
> ls
> /hbase-unsecure/table/2
> Node does not exist: /hbase-unsecure/table/2
> [zk: cn011.x.com:2181,cn013.x.com:2181,cn012.x.com:2181(CONNECTED) 4]
> ls
> /hbase-unsecure/table/t2
> []
> [zk: cn011.x.com:2181,cn013.x.com:2181,cn012.x.com:2181(CONNECTED) 5]
> get
> /hbase-unsecure/table/t2
>  master:16000K  W , PBUF
> cZxid = 0x1000a7f01
> ctime = Mon Mar 27 16:50:52 UTC 2017
> mZxid = 0x1000a7f17
> mtime = Mon Mar 27 16:50:52 UTC 2017
> pZxid = 0x1000a7f01
> cversion = 0
> dataVersion = 2
>
> On Tue, Apr 25, 2017 at 4:09 PM, jeff saremi <jeffsaremi@hotmail.com> wrote:
>
>> BTW on the page
>> http://localhost:16010/master-status#userTables
>> there is no sign of the supposedly existing table either
>>
>> ________________________________
>> From: jeff saremi <jeffsaremi@hotmail.com>
>> Sent: Tuesday, April 25, 2017 4:05:56 PM
>> To: user@hbase.apache.org
>> Subject: Baffling situation with tableExists and createTable
>>
>> I have a super simple piece of code which tries to create a test
>> table if it does not exist
>>
>> calling admin.tableExists(TableName.valueOf(table)) returns false
>> causing the control to be passed to the line that creates it admin.createTable(tableDescriptor).
>> Then i get an exception that the table exists!
>>
>> Exception in thread "main" org.apache.hadoop.hbase.TableExistsException:
>> LoadTest
>>
>>
>> String table = config.tableName;
>> ...
>> Connection conn = ConnectionFactory.createConnection(hbaseconf);
>> Admin admin = conn.getAdmin();
>> if(!admin.tableExists(TableName.valueOf(table))) {
>>     Log.info("table " + table + " does not exist. Creating it...");
>>     HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.
>> valueOf(table));
>>     tableDescriptor.addFamily(new HColumnDescriptor(config.FAMILY));
>>     admin.createTable(tableDescriptor);
>> }
>>
>> Jeff
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message