You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Peter Somogyi (Jira)" <ji...@apache.org> on 2019/09/18 11:54:00 UTC

[jira] [Created] (HBASE-23046) Remove compatibility case from truncate command

Peter Somogyi created HBASE-23046:
-------------------------------------

             Summary: Remove compatibility case from truncate command
                 Key: HBASE-23046
                 URL: https://issues.apache.org/jira/browse/HBASE-23046
             Project: HBase
          Issue Type: Bug
          Components: shell
    Affects Versions: 3.0.0, 2.3.0
            Reporter: Peter Somogyi
            Assignee: Peter Somogyi


The truncate and truncate_preserve commands in shell have a compatibility block to handle the case when Master does not have truncate command.

This was added in HBASE-8332 for HBase 0.99 so it is safe to remove it now.

The current compatibility block catches DoNotRetryIOException which can hide different kind of errors and just drops and recreates the table.
{code:ruby}
begin
  puts 'Truncating table...'
  @admin.truncateTable(table_name, false)
rescue => e
  # Handle the compatibility case, where the truncate method doesn't exists on the Master
  raise e unless e.respond_to?(:cause) && !e.cause.nil?
  rootCause = e.cause
  if rootCause.is_a?(org.apache.hadoop.hbase.DoNotRetryIOException)
    # Handle the compatibility case, where the truncate method doesn't exists on the Master
    puts 'Dropping table...'
    @admin.deleteTable(table_name)

    puts 'Creating table...'
    @admin.createTable(table_description)
  else
    raise e
  end
end
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)