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

deleteColumn/modifyTable don't delete all family's StoreFile from file system

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 1.2.3
    • None
    • Admin
    • None

    Description

      The method deleteColumn(TableName tableName, byte[] columnName) of the class org.apache.hadoop.hbase.client.Admin shoud delete specified column family from specified table. (Despite of its name the method removes the family, not a column - view the issue.)
      This method changes the table's schema, but it doesn't delete column family's Store File from a file system. To be precise - I run this code:

      import java.io.IOException;
      
      import org.apache.hadoop.conf.Configuration;
      import org.apache.hadoop.hbase.HBaseConfiguration;
      import org.apache.hadoop.hbase.HColumnDescriptor;
      import org.apache.hadoop.hbase.HTableDescriptor;
      import org.apache.hadoop.hbase.TableName;
      import org.apache.hadoop.hbase.client.*;
      import org.apache.hadoop.hbase.util.Bytes;
      
      public class ToHBaseIssueTracker {
      
          public static void main(String[] args) throws IOException {
              TableName tableName = TableName.valueOf("test_table");
              HTableDescriptor desc = new HTableDescriptor(tableName);
              desc.addFamily(new HColumnDescriptor("cf1"));
              desc.addFamily(new HColumnDescriptor("cf2"));
      
              Configuration conf = HBaseConfiguration.create();
              Connection connection = ConnectionFactory.createConnection(conf);
              Admin admin = connection.getAdmin();
      
              admin.createTable(desc);
      
              HTable table = new HTable(conf, "test_table");
              for (int i = 0; i < 4; i++) {
                  Put put = new Put(Bytes.toBytes(i)); // Use i as row key.
                  put.addColumn(Bytes.toBytes("cf1"), Bytes.toBytes("a"), Bytes.toBytes("value"));
                  put.addColumn(Bytes.toBytes("cf2"), Bytes.toBytes("a"), Bytes.toBytes("value"));
                  table.put(put);
              }
      
              admin.deleteColumn(tableName, Bytes.toBytes("cf2"));
              admin.majorCompact(tableName);
              admin.close();
          }
      }
      

      Then I see that the store file for the "cf2" family persists in file system.
      I observe this effect in standalone hbase installation and in pseudo-distributed mode.

      Attachments

        1. Selection_008.png
          35 kB
          Mikhail Zvagelsky

        Activity

          People

            Unassigned Unassigned
            Mikhail_Zvagelsky Mikhail Zvagelsky
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: