[MDEV-30162] Fix occasional "Permission denied" on Windows causes by 3rd party software opening database files. Created: 2022-12-05 Updated: 2022-12-07 Resolved: 2022-12-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Platform Windows |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.11.2, 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
While it is not directly a bug of MariaDB, this is something that has affected us for a long time. A well-behaving antivirus (or backup, or whatever) would open file such that it does not interfere with other operations (i.e FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). Even a well behaving 3rd party software can sometimes be a problem, as in older Windows versions file does not go away after deletion, but only after the last open handle is closed, but we managed to work around it in most scenarios. A not-so-well behaving 3rd party opens a file with different share flags, causing one of While we recommend(or should recommend) excluding database directories from AV, we do not have control over it, and sometimes neither DBAs would not have this control. An example are the old buildbot boxes on Azure, where even a user with administrative rights can't turn off the AV scanning. Sometimes it is Windows Defender that misbehaves The purpose of this task is to minimize number user-visible "permission denied" errors. The idea is to retry the failing API in a loop, if the function is failing with ERROR_SHARING_VIOLATION (in case of MoveFile, if destination file exists and is open, also ERROR_ACCESS_DENIED). We assume that the errors like this are transient, and a short loop is going to fix them, in most cases. This work is going to be restricted to the mysys only, because currently we see errors there. Innodb has its own retry logic, so we won't touch it here. At the moment MoveFile has already implemented the retry logic for my_rename( |