Commit bd7908e6 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-31568 InnoDB protection against dual processes accessing data insufficient

fil_node_open_file_low(): Always acquire an advisory lock on
the system tablespace. Originally, we already did this in
SysTablespace::open_file(), but SysTablespace::open_or_create()
would release those locks when it is closing the file handles.

This is a 10.5+ specific follow up to
commit 0ee1082b (MDEV-28495).

Thanks to Daniel Black for verifying this bug.
parent 5f2a77ce
...@@ -391,8 +391,16 @@ static bool fil_node_open_file_low(fil_node_t *node) ...@@ -391,8 +391,16 @@ static bool fil_node_open_file_low(fil_node_t *node)
: OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT, : OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
OS_FILE_AIO, type, OS_FILE_AIO, type,
srv_read_only_mode, &success); srv_read_only_mode, &success);
if (success) if (node->is_open())
{
ut_ad(success);
#ifndef _WIN32
if (!node->space->id && !srv_read_only_mode && my_disable_locking &&
os_file_lock(node->handle, node->name))
goto fail;
#endif
break; break;
}
/* The following call prints an error message */ /* The following call prints an error message */
if (os_file_get_last_error(true) == EMFILE + 100 && if (os_file_get_last_error(true) == EMFILE + 100 &&
...@@ -406,6 +414,9 @@ static bool fil_node_open_file_low(fil_node_t *node) ...@@ -406,6 +414,9 @@ static bool fil_node_open_file_low(fil_node_t *node)
if (node->size); if (node->size);
else if (!node->read_page0() || !fil_comp_algo_validate(node->space)) else if (!node->read_page0() || !fil_comp_algo_validate(node->space))
{ {
#ifndef _WIN32
fail:
#endif
os_file_close(node->handle); os_file_close(node->handle);
node->handle= OS_FILE_CLOSED; node->handle= OS_FILE_CLOSED;
return false; return 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