[MDEV-11127] innochecksum can't handle files larger than 4 GB on Windows Created: 2016-10-24  Updated: 2016-10-25  Resolved: 2016-10-25

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.1.18
Fix Version/s: 10.0.28

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: innochecksum, windows


 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

wlad'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.



 Comments   
Comment by Vladislav Vaintroub [ 2016-10-25 ]

Fixed in 10.0.28

Generated at Thu Feb 08 07:47:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.