You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by jeff saremi <je...@hotmail.com> on 2017/04/25 23:05:56 UTC
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
Re: Baffling situation with tableExists and createTable
Posted by jeff saremi <je...@hotmail.com>.
sorry about that. I missed this post
Ted
This is version 1.2.2 of HBase. zkcli was used to remove a stale node with the tablename. Prior to that i ran hbck which didn't do anything
As i mentioned i opened a new Issue in Jira for this.
thanks
Jeff
________________________________
From: Ted Yu <yu...@gmail.com>
Sent: Tuesday, April 25, 2017 5:42:24 PM
To: user@hbase.apache.org
Subject: Re: Baffling situation with tableExists and createTable
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 <je...@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 <je...@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
>
Re: Baffling situation with tableExists and createTable
Posted by Sean Busbey <se...@gmail.com>.
Jeff,
Apologies, but I don't see an answer to Ted's earlier question about
what version of HBase you're making use of?
On Wed, Apr 26, 2017 at 2:50 PM, jeff saremi <je...@hotmail.com> wrote:
> 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 <je...@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 <as...@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 <yu...@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 <je...@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 <je...@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
>>>
--
Sean
Re: Baffling situation with tableExists and createTable
Posted by jeff saremi <je...@hotmail.com>.
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 <je...@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 <as...@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 <yu...@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 <je...@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 <je...@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
>>
Re: Baffling situation with tableExists and createTable
Posted by jeff saremi <je...@hotmail.com>.
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 <as...@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 <yu...@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 <je...@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 <je...@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
>>
RE: Baffling situation with tableExists and createTable
Posted by ashish singhi <as...@huawei.com>.
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 <yu...@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 <je...@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 <je...@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
>>
Re: Baffling situation with tableExists and createTable
Posted by Anoop John <an...@gmail.com>.
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 <yu...@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 <je...@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 <je...@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
>>
Re: Baffling situation with tableExists and createTable
Posted by Ted Yu <yu...@gmail.com>.
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 <je...@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 <je...@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
>
Re: Baffling situation with tableExists and createTable
Posted by jeff saremi <je...@hotmail.com>.
BTW on the page
http://localhost:16010/master-status#userTables
there is no sign of the supposedly existing table either
________________________________
From: jeff saremi <je...@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