Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-23046

Remove compatibility case from truncate command

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0-alpha-1, 2.3.0
    • 3.0.0-alpha-1, 2.3.0
    • shell
    • None
    • Remove backward compatibility from `truncate` and `truncate_preserve` shell commands. This means that these commands from HBase Clients are not compatible with pre-0.99 HBase clusters.

    Description

      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.

      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
      

      Attachments

        Issue Links

          Activity

            People

              psomogyi Peter Somogyi
              psomogyi Peter Somogyi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: