Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-22255

Hive don't trigger Major Compaction automatically if table contains only base files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.2
    • None
    • Hive, Transactions
    • None
    • Hive-3.1.1

    Description

      user may run into the issue if the table consists of all base files but no delta, then the following condition will yield false and automatic major compaction will be skipped.

      https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java#L313

       

      Steps to Reproduce:

      1. create Acid table 
        //  create table myacid(id int);
        
      1. Run multiple insert table 
        // insert overwrite table myacid values(1);insert overwrite table myacid values(2),(3),(4)
      1. DFS ls output
        // dfs -ls -R /warehouse/tablespace/managed/hive/myacid;
        +----------------------------------------------------+
        |                     DFS Output                     |
        +----------------------------------------------------+
        | drwxrwx---+  - hive hadoop          0 2019-09-27 16:42 /warehouse/tablespace/managed/hive/myacid/base_0000001 |
        | -rw-rw----+  3 hive hadoop          1 2019-09-27 16:42 /warehouse/tablespace/managed/hive/myacid/base_0000001/_orc_acid_version |
        | -rw-rw----+  3 hive hadoop        610 2019-09-27 16:42 /warehouse/tablespace/managed/hive/myacid/base_0000001/bucket_00000 |
        | drwxrwx---+  - hive hadoop          0 2019-09-27 16:43 /warehouse/tablespace/managed/hive/myacid/base_0000002 |
        | -rw-rw----+  3 hive hadoop          1 2019-09-27 16:43 /warehouse/tablespace/managed/hive/myacid/base_0000002/_orc_acid_version |
        | -rw-rw----+  3 hive hadoop        633 2019-09-27 16:43 /warehouse/tablespace/managed/hive/myacid/base_0000002/bucket_00000 |
        +----------------------------------------------------+

         
        you will see that Major compaction will not be trigger until you run alter table compact MAJOR.

      Attachments

        1. HIVE-22255.01.patch
          7 kB
          Rajkumar Singh
        2. HIVE-22255.02.patch
          7 kB
          Rajkumar Singh
        3. HIVE-22255.patch
          1 kB
          Rajkumar Singh

        Issue Links

          Activity

            People

              Rajkumar Singh Rajkumar Singh
              Rajkumar Singh Rajkumar Singh
              Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: