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( ...@@ -4749,19 +4749,23 @@ os_file_get_status_win32(
CloseHandle(fh); 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]; char volname[MAX_PATH];
BOOL result = GetVolumePathName(path, volname, MAX_PATH); BOOL result = GetVolumePathName(path, volname, MAX_PATH);
static bool warned_once = false;
if (!result) { if (!result) {
if (!warned_once) {
ib::error() ib::warn()
<< "os_file_get_status_win32: " << "os_file_get_status_win32: "
<< "Failed to get the volume path name for: " << "Failed to get the volume path name for: "
<< path << path
<< "- OS error number " << GetLastError(); << "- OS error number " << GetLastError();
warned_once = true;
return(DB_FAIL); }
return(DB_SUCCESS);
} }
DWORD sectorsPerCluster; DWORD sectorsPerCluster;
...@@ -4777,15 +4781,15 @@ os_file_get_status_win32( ...@@ -4777,15 +4781,15 @@ os_file_get_status_win32(
&totalNumberOfClusters); &totalNumberOfClusters);
if (!result) { if (!result) {
if (!warned_once) {
ib::error() ib::warn()
<< "GetDiskFreeSpace(" << volname << ",...) " << "GetDiskFreeSpace(" << volname << ",...) "
<< "failed " << "failed "
<< "- OS error number " << GetLastError(); << "- OS error number " << GetLastError();
warned_once = true;
return(DB_FAIL); }
return(DB_SUCCESS);
} }
stat_info->block_size = bytesPerSector * sectorsPerCluster; stat_info->block_size = bytesPerSector * sectorsPerCluster;
} else { } else {
stat_info->type = OS_FILE_TYPE_UNKNOWN; 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