Commit 2d2d11f0 authored by Jan Lindström's avatar Jan Lindström

MDEV-6968: CREATE TABLE crashes with InnoDB plugin

Analysis: fil_extend_space_to_desired_size() does not provide file
node to os_aio(). This failed on Windows only because on Windows
we do not use posix_fallocate() to extend file space.

Fix: Add file node to os_aio() function call and make sure that
we do not use NULL pointer at os_aio_array_reserve_slot(). Additionally,
make sure that we do not use 0 as file_block_size (512 is the minimum).
parent b96697d2
......@@ -5255,7 +5255,7 @@ retry:
success = os_aio(OS_FILE_WRITE, OS_AIO_SYNC,
node->name, node->handle, buf,
offset, page_size * n_pages,
NULL, NULL, 0, FALSE, 0);
node, NULL, 0, FALSE, 0);
#endif /* UNIV_HOTBACKUP */
if (success) {
os_has_said_disk_full = FALSE;
......
......@@ -4618,7 +4618,10 @@ found:
slot->write_size = write_size;
slot->page_compression_level = page_compression_level;
slot->page_compression = page_compression;
slot->file_block_size = fil_node_get_block_size(message1);
if (message1) {
slot->file_block_size = fil_node_get_block_size(message1);
}
/* If the space is page compressed and this is write operation
then we compress the page */
......@@ -6556,7 +6559,6 @@ os_file_get_block_size(
if (GetFreeSpace((LPCTSTR)name, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters)) {
fblock_size = BytesPerSector;
fprintf(stderr, "InnoDB: [Note]: Using %ld file block size\n", fblock_size);
} else {
fprintf(stderr, "InnoDB: Warning: GetFreeSpace() failed on file %s\n", name);
os_file_handle_error_no_exit(name, "GetFreeSpace()", FALSE, __FILE__, __LINE__);
......@@ -6564,11 +6566,17 @@ os_file_get_block_size(
}
#endif /* __WIN__*/
if (fblock_size > UNIV_PAGE_SIZE/2) {
fprintf(stderr, "InnoDB: Warning: File system for file %s has "
if (fblock_size > UNIV_PAGE_SIZE/2 || fblock_size < 512) {
fprintf(stderr, "InnoDB: Note: File system for file %s has "
"file block size %lu not supported for page_size %lu\n",
name, fblock_size, UNIV_PAGE_SIZE);
fblock_size = UNIV_PAGE_SIZE/2;
if (fblock_size < 512) {
fblock_size = 512;
} else {
fblock_size = UNIV_PAGE_SIZE/2;
}
fprintf(stderr, "InnoDB: Note: Using file block size %ld for file %s\n",
fblock_size, name);
}
......
......@@ -5290,7 +5290,7 @@ retry:
success = os_aio(OS_FILE_WRITE, OS_AIO_SYNC,
node->name, node->handle, buf,
offset, page_size * n_pages,
NULL, NULL, space_id, NULL, 0, 0, 0);
node, NULL, space_id, NULL, 0, 0, 0);
#endif /* UNIV_HOTBACKUP */
if (success) {
os_has_said_disk_full = FALSE;
......
......@@ -4737,7 +4737,10 @@ found:
slot->write_size = write_size;
slot->page_compression_level = page_compression_level;
slot->page_compression = page_compression;
slot->file_block_size = fil_node_get_block_size(message1);
if (message1) {
slot->file_block_size = fil_node_get_block_size(message1);
}
/* If the space is page compressed and this is write operation
then we compress the page */
......@@ -6658,7 +6661,6 @@ os_file_get_block_size(
if (GetFreeSpace((LPCTSTR)name, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters)) {
fblock_size = BytesPerSector;
fprintf(stderr, "InnoDB: [Note]: Using %ld file block size\n", fblock_size);
} else {
fprintf(stderr, "InnoDB: Warning: GetFreeSpace() failed on file %s\n", name);
os_file_handle_error_no_exit(name, "GetFreeSpace()", FALSE, __FILE__, __LINE__);
......@@ -6666,11 +6668,17 @@ os_file_get_block_size(
}
#endif /* __WIN__*/
if (fblock_size > UNIV_PAGE_SIZE/2) {
fprintf(stderr, "InnoDB: Warning: File system for file %s has "
if (fblock_size > UNIV_PAGE_SIZE/2 || fblock_size < 512) {
fprintf(stderr, "InnoDB: Note: File system for file %s has "
"file block size %lu not supported for page_size %lu\n",
name, fblock_size, UNIV_PAGE_SIZE);
fblock_size = UNIV_PAGE_SIZE/2;
if (fblock_size < 512) {
fblock_size = 512;
} else {
fblock_size = UNIV_PAGE_SIZE/2;
}
fprintf(stderr, "InnoDB: Note: Using file block size %ld for file %s\n",
fblock_size, name);
}
......
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