Commit 437da7bc authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-19534 Make innodb_checksum_algorithm=full_crc32 by default, and remove innodb_checksums

parent 424dc49d
# Work around MDEV-19541
SET GLOBAL innodb_checksum_algorithm=crc32;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
......
......@@ -12,6 +12,8 @@ call mtr.add_suppression("InnoDB: Table in tablespace \\d+ encrypted. However ke
--enable_query_log
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
--echo # Work around MDEV-19541
SET GLOBAL innodb_checksum_algorithm=crc32;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
INSERT INTO t1 VALUES(1);
# Force a redo log checkpoint.
......
--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:6M;ibdata_second:1M:autoextend
--innodb-undo-tablespaces=2
--innodb-checksum-algorithm=crc32
SET @orig = @@global.innodb_checksum_algorithm;
SELECT @orig;
@orig
crc32
full_crc32
SET GLOBAL innodb_checksum_algorithm = 'crc32';
SELECT @@global.innodb_checksum_algorithm;
@@global.innodb_checksum_algorithm
......@@ -52,4 +52,4 @@ strict_full_crc32
SET GLOBAL innodb_checksum_algorithm = @orig;
SELECT @@global.innodb_checksum_algorithm;
@@global.innodb_checksum_algorithm
crc32
full_crc32
'#---------------------BS_STVARS_023_01----------------------#'
SELECT COUNT(@@GLOBAL.innodb_checksums);
COUNT(@@GLOBAL.innodb_checksums)
1
1 Expected
'#---------------------BS_STVARS_023_02----------------------#'
SET @@GLOBAL.innodb_checksums=1;
ERROR HY000: Variable 'innodb_checksums' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_checksums);
COUNT(@@GLOBAL.innodb_checksums)
1
1 Expected
'#---------------------BS_STVARS_023_03----------------------#'
SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_checksums';
IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_checksums);
COUNT(@@GLOBAL.innodb_checksums)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_checksums';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_023_04----------------------#'
SELECT @@innodb_checksums = @@GLOBAL.innodb_checksums;
@@innodb_checksums = @@GLOBAL.innodb_checksums
1
1 Expected
'#---------------------BS_STVARS_023_05----------------------#'
SELECT COUNT(@@innodb_checksums);
COUNT(@@innodb_checksums)
1
1 Expected
SELECT COUNT(@@local.innodb_checksums);
ERROR HY000: Variable 'innodb_checksums' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.innodb_checksums);
ERROR HY000: Variable 'innodb_checksums' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_checksums);
COUNT(@@GLOBAL.innodb_checksums)
1
1 Expected
SELECT innodb_checksums = @@SESSION.innodb_checksums;
ERROR 42S22: Unknown column 'innodb_checksums' in 'field list'
Expected error 'Readonly variable'
......@@ -400,25 +400,11 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_CHECKSUMS
SESSION_VALUE NULL
GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting this to OFF. Enable InnoDB checksums validation (enabled by default). Disable with --skip-innodb-checksums.
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_CHECKSUM_ALGORITHM
SESSION_VALUE NULL
GLOBAL_VALUE crc32
GLOBAL_VALUE full_crc32
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE crc32
DEFAULT_VALUE full_crc32
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are FULL_CRC32 for new files, always use CRC-32C; for old, see CRC32 below; STRICT_FULL_CRC32 for new files, always use CRC-32C; for old, see STRICT_CRC32 below; CRC32 write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by MariaDB versions older than 10.0.4; new files created with full_crc32 are readable by MariaDB 10.4.3+
......
################## mysql-test\t\innodb_checksums_basic.test ###################
# #
# Variable Name: innodb_checksums #
# Scope: Global #
# Access Type: Static #
# Data Type: boolean #
# #
# #
# Creation Date: 2008-02-07 #
# Author : Sharique Abdullah #
# #
# #
# Description:Test Cases of Dynamic System Variable innodb_checksums #
# that checks the behavior of this variable in the following ways #
# * Value Check #
# * Scope Check #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
# server-system-variables.html #
# #
###############################################################################
--source include/have_innodb.inc
--echo '#---------------------BS_STVARS_023_01----------------------#'
####################################################################
# Displaying default value #
####################################################################
SELECT COUNT(@@GLOBAL.innodb_checksums);
--echo 1 Expected
--echo '#---------------------BS_STVARS_023_02----------------------#'
####################################################################
# Check if Value can set #
####################################################################
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.innodb_checksums=1;
--echo Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_checksums);
--echo 1 Expected
--echo '#---------------------BS_STVARS_023_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
--disable_warnings
SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_checksums';
--enable_warnings
--echo 1 Expected
SELECT COUNT(@@GLOBAL.innodb_checksums);
--echo 1 Expected
--disable_warnings
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_checksums';
--enable_warnings
--echo 1 Expected
--echo '#---------------------BS_STVARS_023_04----------------------#'
################################################################################
# Check if accessing variable with and without GLOBAL point to same variable #
################################################################################
SELECT @@innodb_checksums = @@GLOBAL.innodb_checksums;
--echo 1 Expected
--echo '#---------------------BS_STVARS_023_05----------------------#'
################################################################################
# Check if innodb_checksums can be accessed with and without @@ sign #
################################################################################
SELECT COUNT(@@innodb_checksums);
--echo 1 Expected
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.innodb_checksums);
--echo Expected error 'Variable is a GLOBAL variable'
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.innodb_checksums);
--echo Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_checksums);
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR
SELECT innodb_checksums = @@SESSION.innodb_checksums;
--echo Expected error 'Readonly variable'
......@@ -33,11 +33,8 @@ Created Aug 11, 2011 Vasil Dimov
#include "srv0srv.h"
#endif /* !UNIV_INNOCHECKSUM */
/** the macro MYSQL_SYSVAR_ENUM() requires "long unsigned int" and if we
use srv_checksum_algorithm_t here then we get a compiler error:
ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to
'long unsigned int*' in initialization */
ulong srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
/** the value of innodb_checksum_algorithm */
ulong srv_checksum_algorithm;
/** Calculate the CRC32 checksum of a page. The value is stored to the page
when it is written to a file and also checked for a match when reading from
......
......@@ -200,7 +200,6 @@ static char* innobase_server_stopword_table;
values */
static my_bool innobase_use_atomic_writes;
static my_bool innobase_use_checksums;
static my_bool innobase_locks_unsafe_for_binlog;
static my_bool innobase_rollback_on_timeout;
static my_bool innobase_create_status_file;
......@@ -4007,13 +4006,6 @@ static int innodb_init_params()
srv_buf_pool_size = ulint(innobase_buffer_pool_size);
if (!innobase_use_checksums) {
ib::warn() << "Setting innodb_checksums to OFF is DEPRECATED."
" This option may be removed in future releases. You"
" should set innodb_checksum_algorithm=NONE instead.";
srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_NONE;
}
innodb_log_checksums = innodb_log_checksums_func_update(
NULL, innodb_log_checksums);
......@@ -18798,7 +18790,7 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
" Files updated when this option is set to crc32 or strict_crc32 will"
" not be readable by MariaDB versions older than 10.0.4;"
" new files created with full_crc32 are readable by MariaDB 10.4.3+",
NULL, NULL, SRV_CHECKSUM_ALGORITHM_CRC32,
NULL, NULL, SRV_CHECKSUM_ALGORITHM_FULL_CRC32,
&innodb_checksum_algorithm_typelib);
static MYSQL_SYSVAR_BOOL(log_checksums, innodb_log_checksums,
......@@ -18806,14 +18798,6 @@ static MYSQL_SYSVAR_BOOL(log_checksums, innodb_log_checksums,
"Whether to compute and require checksums for InnoDB redo log blocks",
NULL, innodb_log_checksums_update, TRUE);
static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
"DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting"
" this to OFF."
" Enable InnoDB checksums validation (enabled by default)."
" Disable with --skip-innodb-checksums.",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
"The common part for InnoDB table spaces.",
......@@ -19990,7 +19974,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flush_neighbors),
MYSQL_SYSVAR(checksum_algorithm),
MYSQL_SYSVAR(log_checksums),
MYSQL_SYSVAR(checksums),
MYSQL_SYSVAR(commit_concurrency),
MYSQL_SYSVAR(concurrency_tickets),
MYSQL_SYSVAR(compression_level),
......
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