hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashish singhi <ashish.sin...@huawei.com>
Subject RE: Baffling situation with tableExists and createTable
Date Wed, 26 Apr 2017 09:29:49 GMT
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
View raw message