Uploaded image for project: 'Apache Hudi'
  1. Apache Hudi
  2. HUDI-2925

Cleaner may attempt to delete the same file twice when metadata table is enabled

    XMLWordPrintableJSON

Details

    Description

      This issue happens only when TimelineServer is disabled (reason in next comment). Our pipelines execute a write (insert or upsert) along with an asynchronous clean. Metadata table is enabled.

       

      Assume the timelines are as follows:

      Dataset:   100.commit        101.commit   102.clean.inflight
      Metadata: 100.deltacomit  

      (this happened as the pipeline failed due to non-HUDI  issues which executing 101 and 102)

       

      In the next run of the pipeline some more data is available  so a commit will take place (103.commit.requested). Along with it, an asynchronous clean starts (104.clean.requested). The BaseCleanActionExecutor detected previously unfinished clean (102.clean.inflight) and attempts to do it first. So the order of cleans will be 102.clean followed by 104.clean.

       

      102.clean => Suppose this deletes files from 90.commit

      104.clean  => This should delete files from 91.commit

       

      The issue is that while executing 104.clean, the filesystemview is still the one which was used during 102.clean (i.e. post clean the file system view is not synced). When metadata table is enabled, HoodieMetadataFileSystemView is used which has the metadata reader inside it. This metadata reader opens the metadata table at a particular time instant (will be 101.commit as that was the last completed action). Even after 102.clean is completed, the HoodieMetadataFileSystemView is still using the cached metadata reader. Hence, the reader still returns files from 90.commit which have already been deleted by 102.clean.  

       

      Attachments

        Issue Links

          Activity

            People

              pwason Prashant Wason
              pwason Prashant Wason
              Ethan Guo, sivabalan narayanan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4h
                  4h
                  Remaining:
                  Remaining Estimate - 4h
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified