diff options
Diffstat (limited to 'storage/innobase/fsp/fsp0sysspace.cc')
-rw-r--r-- | storage/innobase/fsp/fsp0sysspace.cc | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 6aa0f5edb9a..72fa8c28ebd 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2021, MariaDB Corporation. +Copyright (c) 2021, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -445,12 +445,27 @@ SysTablespace::create_file( case SRV_NOT_RAW: err = file.open_or_create( - m_ignore_read_only ? false : srv_read_only_mode); + !m_ignore_read_only && srv_read_only_mode); break; } + if (err != DB_SUCCESS) { + return err; + } - if (err == DB_SUCCESS && file.m_type != SRV_OLD_RAW) { + switch (file.m_type) { + case SRV_OLD_RAW: + break; + case SRV_NOT_RAW: +#ifndef _WIN32 + if (!space_id() && my_disable_locking + && os_file_lock(file.m_handle, file.m_filepath)) { + err = DB_ERROR; + break; + } +#endif + /* fall through */ + case SRV_NEW_RAW: err = set_size(file); } @@ -491,7 +506,7 @@ SysTablespace::open_file( case SRV_NOT_RAW: err = file.open_or_create( - m_ignore_read_only ? false : srv_read_only_mode); + !m_ignore_read_only && srv_read_only_mode); if (err != DB_SUCCESS) { return(err); @@ -506,6 +521,14 @@ SysTablespace::open_file( break; case SRV_NOT_RAW: +#ifndef _WIN32 + if (!space_id() && (m_ignore_read_only || !srv_read_only_mode) + && my_disable_locking + && os_file_lock(file.m_handle, file.m_filepath)) { + err = DB_ERROR; + break; + } +#endif /* Check file size for existing file. */ err = check_size(file); break; |