Commit 2d82ae5b authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-20825 : Innodb does not start if GetDiskFreeSpace() fails.

Ignore GetDiskFreeSpace() errors in os_file_get_status_win32
The call is only used to calculate filesystem block size, and this in
turn is only  shown in information_schema.sys_tablespaces.FS_BLOCK_SIZE.
There is no other use of this field, it does not affect any Innodb
functionality
parent c1351931
......@@ -4749,19 +4749,23 @@ os_file_get_status_win32(
CloseHandle(fh);
}
}
stat_info->block_size = 0;
/* What follows, is calculation of FS block size, which is not important
(it is just shown in I_S innodb tables). The error to calculate it will be ignored.*/
char volname[MAX_PATH];
BOOL result = GetVolumePathName(path, volname, MAX_PATH);
static bool warned_once = false;
if (!result) {
ib::error()
<< "os_file_get_status_win32: "
<< "Failed to get the volume path name for: "
<< path
<< "- OS error number " << GetLastError();
return(DB_FAIL);
if (!warned_once) {
ib::warn()
<< "os_file_get_status_win32: "
<< "Failed to get the volume path name for: "
<< path
<< "- OS error number " << GetLastError();
warned_once = true;
}
return(DB_SUCCESS);
}
DWORD sectorsPerCluster;
......@@ -4777,15 +4781,15 @@ os_file_get_status_win32(
&totalNumberOfClusters);
if (!result) {
ib::error()
<< "GetDiskFreeSpace(" << volname << ",...) "
<< "failed "
<< "- OS error number " << GetLastError();
return(DB_FAIL);
if (!warned_once) {
ib::warn()
<< "GetDiskFreeSpace(" << volname << ",...) "
<< "failed "
<< "- OS error number " << GetLastError();
warned_once = true;
}
return(DB_SUCCESS);
}
stat_info->block_size = bytesPerSector * sectorsPerCluster;
} else {
stat_info->type = OS_FILE_TYPE_UNKNOWN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment