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

MaterializedView refresh check might return incorrect result when Compaction is run

Log workAgile BoardRank to TopRank to BottomVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0
    • Component/s: Materialized views
    • Labels:
      None

      Description

      Reading the code of TxnHandler.getMaterializationInvalidationInfo I see that we decide on the freshness of the view based on the COMPLETED_TXN_COMPONENTS table. 
      See: https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java#L2021
      On the other hand if we run a major compaction we clean up COMPLETED_TXN_COMPONENTS table, so we lose all previous information. We do it in CompactionTxnHandler.markCleaned.
      See: https://github.com/apache/hive/blob/master/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java#L382
       
      When the following sequence of events happen we do not refresh the materialized view:

      • Create Table
      • Create MV
      • Refresh MV
      • Update Table
      • Start major compaction
      • Wait until compacted, and cleaned
      • Select Table

        Attachments

        Issue Links

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

            • Assignee:
              jcamachorodriguez Jesus Camacho Rodriguez Assign to me
              Reporter:
              pvary Peter Vary

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment