Commit 3304004a authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-21260 Innodb/Wjndows do not report error when trying open volumes on UNC paths

fil_node_t::find_metadata() tries to find out whether file
is on an SSD, and the disk sector size.
On Windows, it opens the corresponding volume for finding this data.

This does not go well, if datadir is on network path/UNC. The volume name
is invalid, CreateFile() function fails, and a cryptic (from the end user
perspective) error is reported. Like this

[ERROR] InnoDB: File \\.\\\workpc\work: 'CreateFile()' returned OS error 203.

The fix is not to report error if open volume failed, and the path was not
on fixed disk, i.e not on HDD or SSD. This is not a fatal error, there is
a fallback anyway.
parent 71e47f34
...@@ -7676,9 +7676,14 @@ void fil_node_t::find_metadata(os_file_t file ...@@ -7676,9 +7676,14 @@ void fil_node_t::find_metadata(os_file_t file
on_ssd = win32_is_ssd(volume_handle); on_ssd = win32_is_ssd(volume_handle);
CloseHandle(volume_handle); CloseHandle(volume_handle);
} else { } else {
if (GetLastError() != ERROR_ACCESS_DENIED) { /*
os_file_handle_error_no_exit(volume, Report error, unless it is expected, e.g
"CreateFile()", FALSE); missing permissions, or error when trying to
open volume for UNC share.
*/
if (GetLastError() != ERROR_ACCESS_DENIED
&& GetDriveType(volume) == DRIVE_FIXED) {
os_file_handle_error_no_exit(volume, "CreateFile()", FALSE);
} }
} }
......
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