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

innochecksum can't handle files larger than 4 GB on Windows

    Details

      Description

      A user noticed that when he tries to use innochecksum with some of his 4 GB or larger tablespace files on Windows, the tool reports that the file doesn't exist:

      X:\MySQL\Data>"c:\Program Files\MariaDB 10.1\bin\innochecksum.exe" .\ibdata1
      InnoDB offline file checksum utility.
      Error; .\ibdata1 cannot be found
      

      The error seems to be getting raised here: https://github.com/MariaDB/server/blob/ec5bd0d3855aa49afc3e356aa18b7edea3b7a18b/extra/innochecksum.cc#L709

      The user thinks that this check is probably failing on Windows for files larger than 4 GB, because MariaDB is probably using one of the Windows stat functions that uses 32-bit file sizes:

      Variations of these functions support 32- or 64-bit time types, and 32- or 64-bit file lengths. The first numerical suffix (32 or 64) indicates the size of the time type used; the second suffix is either i32 or i64, indicating whether the file size is represented as a 32-bit or 64-bit integer.
      _stat is equivalent to _stat64i32, and struct _stat contains a 64-bit time. This is true unless _USE_32BIT_TIME_T is defined, in which case the old behavior is in effect; _stat uses a 32-bit time, and struct _stat contains a 32-bit time. The same is true for _stati64.

      https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx

      Vladislav Vaintroub's analysis:

      struct stat has st_size member defined as _off_t , and _off_t is typedef to a long (not even unsigned), and long is 4 bytes on all Windows. So large file sizes would not fit. I never saw stat() failing in recent memory,
      but we're not using stat() elsewhere either. My guess, it is the culprit.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              GeoffMontee Geoff Montee
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: