hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Daniel Cryans <jdcry...@apache.org>
Subject Re: Truncate tables
Date Mon, 14 Feb 2011 18:20:07 GMT
Can you enable DEBUG for HBase, run your code, and post the output in
a pastebin?

J-D

On Mon, Feb 14, 2011 at 10:14 AM, Peter Haidinyak <phaidinyak@local.com> wrote:
> Each table is taking 30 seconds. Without looking at the HBase code I assumed it was doing
the same process as I am. Just quicker.
>
> Thanks
>
> -Pete
>
> -----Original Message-----
> From: jdcryans@gmail.com [mailto:jdcryans@gmail.com] On Behalf Of Jean-Daniel Cryans
> Sent: Monday, February 14, 2011 10:12 AM
> To: user@hbase.apache.org
> Subject: Re: Truncate tables
>
> Erm well could it be that your script is truncating a bunch of tables
> whereas in the shell it only does one? Apart from that I can't think
> of anything obvious, the truncate command really does the same thing
> as you.
>
> J-D
>
> On Mon, Feb 14, 2011 at 9:43 AM, Peter Haidinyak <phaidinyak@local.com> wrote:
>> Hi,
>>        I've setup a little utility to truncate my tables during development but
I found that if I truncate a table from the HBase shell it takes 2.5 seconds, from my program
it take 30 seconds. The code to truncate is pretty simple. Any ideas on what I've done wrong?
>>
>> Thanks
>>
>> -Pete
>>
>>  private void truncateTables()
>>    throws IOException
>>  {
>>    m_hbaseConnection = new HbaseConnection();
>>    m_hbaseConnection.setupHBaseConnection();
>>    final HBaseAdmin hBaseAdmin = m_hbaseConnection.getAdmin();
>>
>>    int counter = 1;
>>    for (final String tableName : CLUSTER_TABLES)
>>    {
>>      final HTableDescriptor hTableDescriptor = hBaseAdmin.getTableDescriptor(tableName.getBytes());
>>      m_logger.info("Truncating Table {}.",tableName);
>>      hBaseAdmin.disableTable(tableName);
>>      hBaseAdmin.deleteTable(tableName);
>>      hBaseAdmin.createTable(hTableDescriptor);
>>      m_logger.info("Truncated Table {}.", tableName);
>>      m_logger.info("Finished {} of {} Tables.", counter++, CLUSTER_TABLES.length);
>>
>>    } // - End for each table.
>>
>>  } // - End truncateTables Method.
>>
>>
>>  public void setupHBaseConnection()
>>    throws IOException
>>  {
>>    m_hbaseConfiguration = HBaseConfiguration.create();
>>    m_hbaseConfiguration.clear();
>>
>> // - Get the m_hbaseConfiguration properties from the Command line -D parameters.
>>    m_hbaseConfiguration.set("hbase.zookeeper.quorum", System.getProperty("hbase.zookeeper.quorum"));
>>    m_hbaseConfiguration.set("hbase.zookeeper.property.clientPort", System.getProperty("hbase.zookeeper.property.clientPort"));
>>
>>    m_logger.info("Using hbase.zookeeper.quorum : {}", m_hbaseConfiguration.get("hbase.zookeeper.quorum"));
>>    m_logger.info("Using hbase.zookeeper.property.clientPort : {}", m_hbaseConfiguration.get("hbase.zookeeper.property.clientPort"));
>>
>>  } // - End setupHBaseConnection Method.
>>
>>
>

Mime
View raw message