Search code examples
hbase

HBase - difference between drop table and delete table?


I am learning HBase shell commands and getting confused by drop and delete table.

Could anyone comment on the difference between dropping a table and deleting a table?

thanks.


Solution

  • There's no difference. I speculate that the reason for the two names is because HBaseAdmin was created first, and it used "delete". Then when the shell was created folks realized that drop table tablename is the standard way to get rid of a table.*

    But I confirm (regardless of the speculation into its origin) that they are the same by looking at the HBase Admin source file admin.rb:

    # Drops a table
    def drop(table_name)
      tableExists(table_name)
      raise ArgumentError, "Table #{table_name} is enabled. Disable it first.'" if enabled?(table_name)
      @admin.deleteTable(table_name)
    end
    

    *But to be precise... they did not go with drop table tablename but rather drop 'tablename' in the HBase shell.