From cbf80b0de88734f81f5b3129a767ef4b0efb9d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Dec 2016 12:12:34 +0200 Subject: [PATCH 1/3] Fix tests that were forgotten to run after the merge. --- .../suite/encryption/r/innodb-discard-import-change.result | 2 +- .../encryption/r/innodb_encryption_discard_import.result | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb-discard-import-change.result b/mysql-test/suite/encryption/r/innodb-discard-import-change.result index 7071f9eaf2008..2505780b70cfb 100644 --- a/mysql-test/suite/encryption/r/innodb-discard-import-change.result +++ b/mysql-test/suite/encryption/r/innodb-discard-import-change.result @@ -72,7 +72,7 @@ t1 CREATE TABLE `t1` ( `c1` bigint(20) NOT NULL AUTO_INCREMENT, `b` char(200) DEFAULT NULL, PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=377 DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=4 +) ENGINE=InnoDB AUTO_INCREMENT=504 DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=4 SELECT COUNT(*) FROM t1; COUNT(*) 256 diff --git a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result index 9a4146767acdb..ae1fbdebcb3e4 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result +++ b/mysql-test/suite/encryption/r/innodb_encryption_discard_import.result @@ -1,8 +1,6 @@ call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); SET GLOBAL innodb_file_format = `Barracuda`; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html SET GLOBAL innodb_file_per_table = ON; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB encrypted=yes; CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY, a VARCHAR(255)) ENGINE=InnoDB; @@ -124,5 +122,3 @@ NOT FOUND /barfoo/ in t3.ibd # Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0 DROP PROCEDURE innodb_insert_proc; DROP TABLE t1, t2, t3; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html From d4342702bf6ddc4dd63b620fecd4e40881039ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Dec 2016 12:15:06 +0200 Subject: [PATCH 2/3] Remove dead references to NO_FALLOCATE. --- storage/innobase/fil/fil0fil.cc | 49 ++++++++++------------------ storage/innobase/fsp/fsp0space.cc | 16 +++------ storage/innobase/fsp/fsp0sysspace.cc | 20 +++++------- storage/innobase/include/fil0fil.h | 4 +-- storage/innobase/srv/srv0start.cc | 15 +++------ 5 files changed, 38 insertions(+), 66 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 972fc3d488958..a78a438d92ab3 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -484,7 +484,7 @@ fil_space_is_flushed( return(true); } -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX #include /** FusionIO atomic write control info */ @@ -511,7 +511,7 @@ fil_fusionio_enable_atomic_write(os_file_t file) return(false); } -#endif /* !NO_FALLOCATE && UNIV_LINUX */ +#endif /* UNIV_LINUX */ /** Append a file to the chain of files of a space. @param[in] name file name of a file that is not open @@ -3520,11 +3520,10 @@ fil_ibd_create( return(DB_ERROR); } - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (fil_fusionio_enable_atomic_write(file)) { +#ifdef UNIV_LINUX + const bool atomic_write = fil_fusionio_enable_atomic_write(file); + if (atomic_write) { /* This is required by FusionIO HW/Firmware */ int ret = posix_fallocate(file, 0, size * UNIV_PAGE_SIZE); @@ -3547,21 +3546,14 @@ fil_ibd_create( } else { success = true; } - - atomic_write = true; - } else { - atomic_write = false; - + } else +#else + const bool atomic_write = false; +#endif /* UNIV_LINUX */ + { success = os_file_set_size( path, file, size * UNIV_PAGE_SIZE, srv_read_only_mode); } -#else - atomic_write = false; - - success = os_file_set_size( - path, file, size * UNIV_PAGE_SIZE, srv_read_only_mode); - -#endif /* !NO_FALLOCATE && UNIV_LINUX */ if (!success) { os_file_close(file); @@ -3913,18 +3905,13 @@ fil_ibd_open( df_dict.close(); } - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (!srv_use_doublewrite_buf && df_default.is_open()) { - atomic_write = fil_fusionio_enable_atomic_write( - df_default.handle()); - } else { - atomic_write = false; - } +#ifdef UNIV_LINUX + const bool atomic_write = !srv_use_doublewrite_buf + && df_default.is_open() + && fil_fusionio_enable_atomic_write(df_default.handle()); #else - atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX */ + const bool atomic_write = false; +#endif /* UNIV_LINUX */ /* We have now checked all possible tablespace locations and have a count of how many unique files we found. If things are @@ -5052,7 +5039,7 @@ fil_space_extend( ut_ad(len > 0); const char* name = node->name == NULL ? space->name : node->name; -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX /* This is required by FusionIO HW/Firmware */ int ret = posix_fallocate(node->handle, node_start, len); @@ -5077,7 +5064,7 @@ fil_space_extend( err = DB_IO_ERROR; } -#endif /* NO_FALLOCATE || !UNIV_LINUX */ +#endif if (!node->atomic_write || err == DB_IO_ERROR) { diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index a26a7ae69b731..d50e35d0cbf91 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -122,18 +122,12 @@ Tablespace::open_or_create(bool is_temp) break; } - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (!srv_use_doublewrite_buf) { - atomic_write = fil_fusionio_enable_atomic_write( - it->m_handle); - } else { - atomic_write = false; - } +#ifdef UNIV_LINUX + const bool atomic_write = fil_fusionio_enable_atomic_write( + it->m_handle); #else - atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX */ + const bool atomic_write = false; +#endif /* We can close the handle now and open the tablespace the proper way. */ diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 9125a26b91276..37c641fffac42 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -909,28 +909,24 @@ SysTablespace::open_or_create( return(err); } -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX /* Note: This should really be per node and not per tablespace because a tablespace can contain multiple files (nodes). The implication is that all files of the tablespace should be on the same medium. */ - if (fil_fusionio_enable_atomic_write(it->m_handle)) { + it->m_atomic_write + = fil_fusionio_enable_atomic_write(it->m_handle); - if (srv_use_doublewrite_buf) { - ib::info() << "FusionIO atomic IO enabled," - " disabling the double write buffer"; + if (it->m_atomic_write && srv_use_doublewrite_buf) { + ib::info() << "FusionIO atomic IO enabled," + " disabling the double write buffer"; - srv_use_doublewrite_buf = false; - } - - it->m_atomic_write = true; - } else { - it->m_atomic_write = false; + srv_use_doublewrite_buf = false; } #else it->m_atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX*/ +#endif } if (!create_new_db && flush_lsn) { diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 65f73448c6ee2..6a4cc3f9d55f2 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1799,14 +1799,14 @@ fil_names_clear( lsn_t lsn, bool do_write); -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) +#ifdef UNIV_LINUX /** Try and enable FusionIO atomic writes. @param[in] file OS file handle @return true if successful */ bool fil_fusionio_enable_atomic_write(os_file_t file); -#endif /* !NO_FALLOCATE && UNIV_LINUX */ +#endif /* UNIV_LINUX */ /** Note that the file system where the file resides doesn't support PUNCH HOLE @param[in,out] node Node to set */ diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 7c2f675645bfe..86d821fd93511 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -681,17 +681,12 @@ srv_undo_tablespace_open( os_offset_t size; fil_space_t* space; - bool atomic_write; - -#if !defined(NO_FALLOCATE) && defined(UNIV_LINUX) - if (!srv_use_doublewrite_buf) { - atomic_write = fil_fusionio_enable_atomic_write(fh); - } else { - atomic_write = false; - } +#ifdef UNIV_LINUX + const bool atomic_write = !srv_use_doublewrite_buf + && fil_fusionio_enable_atomic_write(fh); #else - atomic_write = false; -#endif /* !NO_FALLOCATE && UNIV_LINUX */ + const bool atomic_write = false; +#endif size = os_file_get_size(fh); ut_a(size != (os_offset_t) -1); From 1ab3866de237fad4cb2cc6f532aa7750e15dd723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 30 Dec 2016 12:26:05 +0200 Subject: [PATCH 3/3] MDEV-11687 innodb_use_fallocate has no effect The configuration parameter innodb_use_fallocate, which is mapped to the variable srv_use_posix_fallocate, has no effect in MariaDB 10.2.2 or MariaDB 10.2.3. Thus the configuration parameter and the variable should be removed. --- .../r/innodb_use_fallocate_basic.result | 21 ------------------ .../suite/sys_vars/r/sysvars_innodb.result | 14 ------------ .../t/innodb_use_fallocate_basic.test | 22 ------------------- storage/innobase/handler/ha_innodb.cc | 17 -------------- storage/innobase/include/srv0srv.h | 5 ----- storage/innobase/srv/srv0srv.cc | 2 -- 6 files changed, 81 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result delete mode 100644 mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test diff --git a/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result deleted file mode 100644 index 57b4b9eb94cf3..0000000000000 --- a/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result +++ /dev/null @@ -1,21 +0,0 @@ -select @@global.innodb_use_fallocate; -@@global.innodb_use_fallocate -0 -select @@session.innodb_use_fallocate; -ERROR HY000: Variable 'innodb_use_fallocate' is a GLOBAL variable -show global variables like 'innodb_use_fallocate'; -Variable_name Value -innodb_use_fallocate OFF -show session variables like 'innodb_use_fallocate'; -Variable_name Value -innodb_use_fallocate OFF -select * from information_schema.global_variables where variable_name='innodb_use_fallocate'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_USE_FALLOCATE OFF -select * from information_schema.session_variables where variable_name='innodb_use_fallocate'; -VARIABLE_NAME VARIABLE_VALUE -INNODB_USE_FALLOCATE OFF -set global innodb_use_fallocate=1; -ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable -set session innodb_use_fallocate=1; -ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 51878fb1748f6..602bbc50f776c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -2581,20 +2581,6 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE -VARIABLE_NAME INNODB_USE_FALLOCATE -SESSION_VALUE NULL -GLOBAL_VALUE OFF -GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE OFF -VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used. -NUMERIC_MIN_VALUE NULL -NUMERIC_MAX_VALUE NULL -NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST OFF,ON -READ_ONLY YES -COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_MTFLUSH SESSION_VALUE NULL GLOBAL_VALUE OFF diff --git a/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test deleted file mode 100644 index 655893be98ed3..0000000000000 --- a/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test +++ /dev/null @@ -1,22 +0,0 @@ ---source include/have_innodb.inc -# bool readonly - -# -# show values; -# -select @@global.innodb_use_fallocate; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@session.innodb_use_fallocate; -show global variables like 'innodb_use_fallocate'; -show session variables like 'innodb_use_fallocate'; -select * from information_schema.global_variables where variable_name='innodb_use_fallocate'; -select * from information_schema.session_variables where variable_name='innodb_use_fallocate'; - -# -# show that it's read-only -# ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set global innodb_use_fallocate=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -set session innodb_use_fallocate=1; - diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 14b46e2851da4..db0aba33da73d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -250,7 +250,6 @@ values */ static ulong innobase_fast_shutdown = 1; static my_bool innobase_file_format_check = TRUE; static my_bool innobase_use_atomic_writes = FALSE; -static my_bool innobase_use_fallocate = TRUE; static my_bool innobase_use_doublewrite = TRUE; static my_bool innobase_use_checksums = TRUE; static my_bool innobase_locks_unsafe_for_binlog = FALSE; @@ -4637,9 +4636,6 @@ innobase_init( data_mysql_default_charset_coll = (ulint) default_charset_info->number; innobase_commit_concurrency_init_default(); -#ifdef HAVE_POSIX_FALLOCATE - srv_use_posix_fallocate = (ibool) innobase_use_fallocate; -#endif srv_use_atomic_writes = (ibool) innobase_use_atomic_writes; if (innobase_use_atomic_writes) { fprintf(stderr, "InnoDB: using atomic writes.\n"); @@ -4658,13 +4654,6 @@ innobase_init( srv_file_flush_method_str = (char*)"O_DIRECT"; fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n"); } -#endif -#ifdef HAVE_POSIX_FALLOCATE - /* Due to a bug in directFS, using atomics needs - * posix_fallocate to extend the file - * pwrite() past end of the file won't work - */ - srv_use_posix_fallocate = TRUE; #endif } @@ -21957,11 +21946,6 @@ static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes, "on Linux only with FusionIO device, and directFS filesystem.", NULL, NULL, FALSE); -static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate, - PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, - "Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.", - NULL, NULL, FALSE); - static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity, PLUGIN_VAR_RQCMDARG, "Number of IOPs the server can do. Tunes the background IO rate", @@ -23187,7 +23171,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(data_home_dir), MYSQL_SYSVAR(doublewrite), MYSQL_SYSVAR(use_atomic_writes), - MYSQL_SYSVAR(use_fallocate), MYSQL_SYSVAR(api_enable_binlog), MYSQL_SYSVAR(api_enable_mdl), MYSQL_SYSVAR(api_disable_rowlock), diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 5f68e435e9363..9d7b363cdd05e 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -293,11 +293,6 @@ extern my_bool srv_numa_interleave; /* Use trim operation */ extern my_bool srv_use_trim; -/* Use posix fallocate */ -#ifdef HAVE_POSIX_FALLOCATE -extern my_bool srv_use_posix_fallocate; -#endif - /* Use atomic writes i.e disable doublewrite buffer */ extern my_bool srv_use_atomic_writes; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 4ccbda718032b..0eda03f7fd7a2 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -190,8 +190,6 @@ my_bool srv_numa_interleave = FALSE; /* If this flag is TRUE, then we will use fallocate(PUCH_HOLE) to the pages */ UNIV_INTERN my_bool srv_use_trim = FALSE; -/* If this flag is TRUE, then we will use posix fallocate for file extentsion */ -UNIV_INTERN my_bool srv_use_posix_fallocate = FALSE; /* If this flag is TRUE, then we disable doublewrite buffer */ UNIV_INTERN my_bool srv_use_atomic_writes = FALSE; /* If this flag IS TRUE, then we use this algorithm for page compressing the pages */