Commit e479829a authored by Jan Lindström's avatar Jan Lindström

MDEV-5742: Assertion failure node->n_pending on fil0fil.c line 5039

on debug build when innodb_use_fallocate=1

Analysis: There was merge error that caused additional call to 
fil_node_complete_io.

Fixed by removing incorrect call and fixed calculation of extended
file size.
parent 222e73c7
...@@ -4117,11 +4117,14 @@ fil_extend_space_to_desired_size( ...@@ -4117,11 +4117,14 @@ fil_extend_space_to_desired_size(
success = os_file_set_size(node->name, node->handle, success = os_file_set_size(node->name, node->handle,
offset_low, offset_high); offset_low, offset_high);
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system->mutex);
if (success) { if (success) {
node->size += (size_after_extend - start_page_no); node->size += (size_after_extend - start_page_no);
space->size += (size_after_extend - start_page_no); space->size += (size_after_extend - start_page_no);
os_has_said_disk_full = FALSE; os_has_said_disk_full = FALSE;
} }
fil_node_complete_io(node, fil_system, OS_FILE_READ);
goto complete_io; goto complete_io;
} }
#endif #endif
...@@ -4178,12 +4181,10 @@ fil_extend_space_to_desired_size( ...@@ -4178,12 +4181,10 @@ fil_extend_space_to_desired_size(
mem_free(buf2); mem_free(buf2);
#ifdef HAVE_POSIX_FALLOCATE
complete_io:
#endif
fil_node_complete_io(node, fil_system, OS_FILE_WRITE); fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
complete_io:
*actual_size = space->size; *actual_size = space->size;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
......
...@@ -4953,20 +4953,20 @@ fil_extend_space_to_desired_size( ...@@ -4953,20 +4953,20 @@ fil_extend_space_to_desired_size(
#ifdef HAVE_POSIX_FALLOCATE #ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) { if (srv_use_posix_fallocate) {
offset_high = (size_after_extend - file_start_page_no) offset_high = size_after_extend * page_size / (4ULL*1024*1024*1024);
* page_size / (4ULL * 1024 * 1024 * 1024); offset_low = size_after_extend * page_size % (4ULL*1024*1024*1024);
offset_low = (size_after_extend - file_start_page_no)
* page_size % (4ULL * 1024 * 1024 * 1024);
mutex_exit(&fil_system->mutex); mutex_exit(&fil_system->mutex);
success = os_file_set_size(node->name, node->handle, success = os_file_set_size(node->name, node->handle,
offset_low, offset_high); offset_low, offset_high);
mutex_enter(&fil_system->mutex); mutex_enter(&fil_system->mutex);
if (success) { if (success) {
node->size += (size_after_extend - start_page_no); node->size += (size_after_extend - start_page_no);
space->size += (size_after_extend - start_page_no); space->size += (size_after_extend - start_page_no);
os_has_said_disk_full = FALSE; os_has_said_disk_full = FALSE;
} }
fil_node_complete_io(node, fil_system, OS_FILE_READ); fil_node_complete_io(node, fil_system, OS_FILE_READ);
goto complete_io; goto complete_io;
} }
...@@ -5028,21 +5028,9 @@ fil_extend_space_to_desired_size( ...@@ -5028,21 +5028,9 @@ fil_extend_space_to_desired_size(
mem_free(buf2); mem_free(buf2);
#ifdef HAVE_POSIX_FALLOCATE
complete_io:
/* If posix_fallocate was used to extent the file space
we need to complete the io. Because no actual writes were
dispatched read operation is enough here. Without this
there will be assertion at shutdown indicating that
all IO is not completed. */
if (srv_use_posix_fallocate) {
fil_node_complete_io(node, fil_system, OS_FILE_READ);
} else {
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
}
#else
fil_node_complete_io(node, fil_system, OS_FILE_WRITE); fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
#endif
complete_io:
*actual_size = space->size; *actual_size = space->size;
......
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