You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "rajeshbabu (JIRA)" <ji...@apache.org> on 2013/02/28 05:51:13 UTC

[jira] [Created] (HBASE-7961) truncate on disabled table should throw TableNotEnabledException.

rajeshbabu created HBASE-7961:
---------------------------------

             Summary: truncate on disabled table should throw TableNotEnabledException.
                 Key: HBASE-7961
                 URL: https://issues.apache.org/jira/browse/HBASE-7961
             Project: HBase
          Issue Type: Bug
          Components: Admin
            Reporter: rajeshbabu
            Assignee: rajeshbabu
             Fix For: 0.98.0, 0.94.7


presently truncate on disabled table is deleting existing table and recreating(ENABLED)
disable(table_name) call in truncate returing if table is disabled without nofifying to user.
{code}
    def disable(table_name)
      tableExists(table_name)
      return if disabled?(table_name)
      @admin.disableTable(table_name)
    end
{code}

one more thing is we are calling tableExists in disable(table_name) as well as drop(table_name) which is un necessary.
Any way below HTable object creation will check whether table exists or not.
{code}
h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name)
{code}

We can change it to 
{code}
      h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name)
      table_description = h_table.getTableDescriptor()
      yield 'Disabling table...' if block_given?
      disable(table_name)

      yield 'Dropping table...' if block_given?
      drop(table_name)

      yield 'Creating table...' if block_given?
      @admin.createTable(table_description)
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira