Skip to content

Commit

Permalink
MDEV-20825 : Innodb does not start if GetDiskFreeSpace() fails.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vaintroub committed Oct 28, 2019
1 parent c135193 commit 2d82ae5
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2d82ae5

Please sign in to comment.