hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: Baffling situation with tableExists and createTable
Date Wed, 26 Apr 2017 00:42:24 GMT
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