diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2022-03-28 09:42:26 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2022-03-28 12:46:35 +0200 |
commit | 739002eec90efa73a3b77db1cc46b313e8ac1bfd (patch) | |
tree | d47621f59e0866c9349ee746155aa09248f01486 /mysys/my_rename.c | |
parent | e048289e557315b068a15083267329c443faadd3 (diff) | |
download | mariadb-git-739002eec90efa73a3b77db1cc46b313e8ac1bfd.tar.gz |
MDEV-28178 Windows : sporadic ER_ERROR_ON_RENAME .. (errno: 13 "Permission denied")
On affected machine, the error happens sporadically in
innodb.instant_alter_limit.
Procmon shows SetRenameInformationFile failing with ERROR_ACCESS_DENIED.
In this case, the destination file was previously opened rsp oplocked by
Windows defender antivirus.
The fix is to retry MoveFileEx on ERROR_ACCESS_DENIED.
Diffstat (limited to 'mysys/my_rename.c')
-rw-r--r-- | mysys/my_rename.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mysys/my_rename.c b/mysys/my_rename.c index 5702af94272..23dbec2d7ff 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -46,12 +46,15 @@ static BOOL win_rename_with_retries(const char *from, const char *to) for (int retry= RENAME_MAX_RETRIES; retry--;) { - DWORD ret = MoveFileEx(from, to, + BOOL ret= MoveFileEx(from, to, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); - DBUG_ASSERT(fp == NULL || (ret == FALSE && GetLastError() == ERROR_SHARING_VIOLATION)); + if (ret) + return ret; - if (!ret && (GetLastError() == ERROR_SHARING_VIOLATION)) + DWORD last_error= GetLastError(); + if (last_error == ERROR_SHARING_VIOLATION || + last_error == ERROR_ACCESS_DENIED) { #ifndef DBUG_OFF /* |