Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25584

better file deletion on Windows (FILE_DISPOSITION_FLAG_POSIX_SEMANTICS)

    XMLWordPrintable

Details

    Description

      Currently, there are still problems in deletion of open files on Windows (which usually happens with 3rd party AV or backp software)

      How it works currently

      • if file was open by 3rd party, my_win_delete opens it with FILE_FLAG_DELETE_ON_CLOSE and renames the file to the unique name (in the same directory). Whenever 3rd party closes the file, and number of open handles goes down to 0, the file will finally disappear from the file system. The rename is necessary, otherwise attempt to recreate the deleted and not yet closed file would result in ERROR_SHARING_VIOLATION.

      The problem occurs during removing of the directory (DROP DATABASE), if the uniquely-named temporary files are still there. DROP DATABASE will fail.

      Windows 10 offers a better option with SetFileInformationByHandle with _FILE_DISPOSITION_INFO_EX with FILE_DISPOSITION_DELETE | FILE_DISPOSITION_POSIX_SEMANTICS; This option is even used in the STL (https://github.com/microsoft/STL/blob/62137922ab168f8e23ec1a95c946821e24bde230/stl/src/filesystem.cpp) , with fallback for downlevel systems.

      The posix semantics allow recreating a file, if it was deleted, but still opened in some program.

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            wlad Vladislav Vaintroub
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.