Commit f3063299 authored by Sergei Golubchik's avatar Sergei Golubchik

apply mysql fix for bug#58421 to XtraDB

parent c9780ba3
...@@ -3464,12 +3464,6 @@ sub mysql_install_db { ...@@ -3464,12 +3464,6 @@ sub mysql_install_db {
mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang); mtr_add_arg($args, "--lc-messages-dir=%s", $install_lang);
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir); mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
# On some old linux kernels, aio on tmpfs is not supported
# Remove this if/when Bug #58421 fixes this in the server
if ($^O eq "linux" && $opt_mem) {
mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
}
# InnoDB arguments that affect file location and sizes may # InnoDB arguments that affect file location and sizes may
# need to be given to the bootstrap process as well as the # need to be given to the bootstrap process as well as the
# server process. # server process.
...@@ -4743,6 +4737,7 @@ sub extract_warning_lines ($$) { ...@@ -4743,6 +4737,7 @@ sub extract_warning_lines ($$) {
qr|Access denied for user|, qr|Access denied for user|,
qr|Aborted connection|, qr|Aborted connection|,
qr|table.*is full|, qr|table.*is full|,
qr|Linux Native AIO|, # warning that aio does not work on /dev/shm
); );
my $matched_lines= []; my $matched_lines= [];
...@@ -5246,13 +5241,6 @@ sub mysqld_arguments ($$$) { ...@@ -5246,13 +5241,6 @@ sub mysqld_arguments ($$$) {
mtr_add_arg($args, "--user=root"); mtr_add_arg($args, "--user=root");
} }
# On some old linux kernels, aio on tmpfs is not supported
# Remove this if/when Bug #58421 fixes this in the server
if ($^O eq "linux" && $opt_mem)
{
mtr_add_arg($args, "--loose-skip-innodb-use-native-aio");
}
if (!using_extern() and !$opt_user_args) if (!using_extern() and !$opt_user_args)
{ {
# Turn on logging to file # Turn on logging to file
......
...@@ -3318,7 +3318,91 @@ os_aio_linux_create_io_ctx( ...@@ -3318,7 +3318,91 @@ os_aio_linux_create_io_ctx(
fprintf(stderr, fprintf(stderr,
"InnoDB: You can disable Linux Native AIO by" "InnoDB: You can disable Linux Native AIO by"
" setting innodb_native_aio = off in my.cnf\n"); " setting innodb_use_native_aio = 0 in my.cnf\n");
return(FALSE);
}
/******************************************************************//**
Checks if the system supports native linux aio. On some kernel
versions where native aio is supported it won't work on tmpfs. In such
cases we can't use native aio as it is not possible to mix simulated
and native aio.
@return: TRUE if supported, FALSE otherwise. */
static
ibool
os_aio_native_aio_supported(void)
/*=============================*/
{
int fd;
byte* buf;
byte* ptr;
struct io_event io_event;
io_context_t io_ctx;
struct iocb iocb;
struct iocb* p_iocb;
int err;
if (!os_aio_linux_create_io_ctx(1, &io_ctx)) {
/* The platform does not support native aio. */
return(FALSE);
}
/* Now check if tmpdir supports native aio ops. */
fd = innobase_mysql_tmpfile();
if (fd < 0) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error: unable to create "
"temp file to check native AIO support.\n");
return(FALSE);
}
memset(&io_event, 0x0, sizeof(io_event));
buf = (byte*) ut_malloc(UNIV_PAGE_SIZE * 2);
ptr = (byte*) ut_align(buf, UNIV_PAGE_SIZE);
/* Suppress valgrind warning. */
memset(buf, 0x00, UNIV_PAGE_SIZE * 2);
memset(&iocb, 0x0, sizeof(iocb));
p_iocb = &iocb;
io_prep_pwrite(p_iocb, fd, ptr, UNIV_PAGE_SIZE, 0);
err = io_submit(io_ctx, 1, &p_iocb);
if (err >= 1) {
/* Now collect the submitted IO request. */
err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
}
ut_free(buf);
close(fd);
switch (err) {
case 1:
return(TRUE);
case -EINVAL:
case -ENOSYS:
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: Linux Native AIO is not"
" supported on tmpdir.\n"
"InnoDB: You can either move tmpdir to a"
" file system that supports native AIO\n"
"InnoDB: or you can set"
" innodb_use_native_aio to FALSE to avoid"
" this message.\n");
/* fall through. */
default:
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: Linux Native AIO check"
" on tmpdir returned error[%d]\n", -err);
}
return(FALSE); return(FALSE);
} }
#endif /* LINUX_NATIVE_AIO */ #endif /* LINUX_NATIVE_AIO */
...@@ -3458,6 +3542,19 @@ os_aio_init( ...@@ -3458,6 +3542,19 @@ os_aio_init(
os_io_init_simple(); os_io_init_simple();
#if defined(LINUX_NATIVE_AIO)
/* Check if native aio is supported on this system and tmpfs */
if (srv_use_native_aio
&& !os_aio_native_aio_supported()) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: Linux Native AIO"
" disabled.\n");
srv_use_native_aio = FALSE;
}
#endif /* LINUX_NATIVE_AIO */
for (i = 0; i < n_segments; i++) { for (i = 0; i < n_segments; i++) {
srv_set_io_thread_op_info(i, "not started yet"); srv_set_io_thread_op_info(i, "not started yet");
} }
......
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