Commit 7abcb1dd authored by Jimmy Yang's avatar Jimmy Yang

Add two tests for "innodb_large_prefix" and "innodb_force_load_corrupted" in

sys_vars test suite.
parent 95fa7fab
...@@ -102,23 +102,8 @@ drop index idxā on corrupt_bit_test_ā; ...@@ -102,23 +102,8 @@ drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā; check table corrupt_bit_test_ā;
# Shut down the server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 20
-- source include/wait_until_disconnected.inc
# Restart the server
-- disable_query_log
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
-- enable_query_log
set names utf8; set names utf8;
# The index is marked as suspect in Sys_indexes too, so after server
# reboot, the attempt to use the index will fail too.
-- error ER_NOT_KEYFILE -- error ER_NOT_KEYFILE
select z from corrupt_bit_test_ā; select z from corrupt_bit_test_ā;
......
...@@ -11,9 +11,5 @@ There should be *no* long test name listed below: ...@@ -11,9 +11,5 @@ There should be *no* long test name listed below:
select variable_name as `There should be *no* variables listed below:` from t2 select variable_name as `There should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null; left join t1 on variable_name=test_name where test_name is null;
There should be *no* variables listed below: There should be *no* variables listed below:
INNODB_FORCE_LOAD_CORRUPTED
INNODB_LARGE_PREFIX
INNODB_FORCE_LOAD_CORRUPTED
INNODB_LARGE_PREFIX
drop table t1; drop table t1;
drop table t2; drop table t2;
'#---------------------BS_STVARS_031_01----------------------#'
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
COUNT(@@GLOBAL.innodb_force_load_corrupted)
1
1 Expected
'#---------------------BS_STVARS_031_02----------------------#'
SET @@GLOBAL.innodb_force_load_corrupted=1;
ERROR HY000: Variable 'innodb_force_load_corrupted' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
COUNT(@@GLOBAL.innodb_force_load_corrupted)
1
1 Expected
'#---------------------BS_STVARS_031_03----------------------#'
SELECT IF(@@GLOBAL.innodb_force_load_corrupted, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_force_load_corrupted';
IF(@@GLOBAL.innodb_force_load_corrupted, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
COUNT(@@GLOBAL.innodb_force_load_corrupted)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_force_load_corrupted';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_031_04----------------------#'
SELECT @@innodb_force_load_corrupted = @@GLOBAL.innodb_force_load_corrupted;
@@innodb_force_load_corrupted = @@GLOBAL.innodb_force_load_corrupted
1
1 Expected
'#---------------------BS_STVARS_031_05----------------------#'
SELECT COUNT(@@innodb_force_load_corrupted);
COUNT(@@innodb_force_load_corrupted)
1
1 Expected
SELECT COUNT(@@local.innodb_force_load_corrupted);
ERROR HY000: Variable 'innodb_force_load_corrupted' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.innodb_force_load_corrupted);
ERROR HY000: Variable 'innodb_force_load_corrupted' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
COUNT(@@GLOBAL.innodb_force_load_corrupted)
1
1 Expected
SELECT innodb_force_load_corrupted = @@SESSION.innodb_force_load_corrupted;
ERROR 42S22: Unknown column 'innodb_force_load_corrupted' in 'field list'
Expected error 'Readonly variable'
SET @start_global_value = @@global.innodb_large_prefix;
SELECT @start_global_value;
@start_global_value
0
Valid values are 'ON' and 'OFF'
select @@global.innodb_large_prefix in (0, 1);
@@global.innodb_large_prefix in (0, 1)
1
select @@global.innodb_large_prefix;
@@global.innodb_large_prefix
0
select @@session.innodb_large_prefix;
ERROR HY000: Variable 'innodb_large_prefix' is a GLOBAL variable
show global variables like 'innodb_large_prefix';
Variable_name Value
innodb_large_prefix OFF
show session variables like 'innodb_large_prefix';
Variable_name Value
innodb_large_prefix OFF
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX OFF
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX OFF
set global innodb_large_prefix='OFF';
select @@global.innodb_large_prefix;
@@global.innodb_large_prefix
0
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX OFF
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX OFF
set @@global.innodb_large_prefix=1;
select @@global.innodb_large_prefix;
@@global.innodb_large_prefix
1
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX ON
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX ON
set global innodb_large_prefix=0;
select @@global.innodb_large_prefix;
@@global.innodb_large_prefix
0
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX OFF
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX OFF
set @@global.innodb_large_prefix='ON';
select @@global.innodb_large_prefix;
@@global.innodb_large_prefix
1
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX ON
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX ON
set session innodb_large_prefix='OFF';
ERROR HY000: Variable 'innodb_large_prefix' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_large_prefix='ON';
ERROR HY000: Variable 'innodb_large_prefix' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_large_prefix=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_large_prefix'
set global innodb_large_prefix=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_large_prefix'
set global innodb_large_prefix=2;
ERROR 42000: Variable 'innodb_large_prefix' can't be set to the value of '2'
NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643)
set global innodb_large_prefix=-3;
select @@global.innodb_large_prefix;
@@global.innodb_large_prefix
1
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX ON
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
VARIABLE_NAME VARIABLE_VALUE
INNODB_LARGE_PREFIX ON
set global innodb_large_prefix='AUTO';
ERROR 42000: Variable 'innodb_large_prefix' can't be set to the value of 'AUTO'
SET @@global.innodb_large_prefix = @start_global_value;
SELECT @@global.innodb_large_prefix;
@@global.innodb_large_prefix
0
################## mysql-test\t\innodb_force_load_corrupted_basic.test #####
# #
# Variable Name: innodb_force_load_corrupted #
# Scope: Global #
# Access Type: Static #
# Data Type: boolean #
# #
# #
# Creation Date: 2008-02-07 #
# Author : Sharique Abdullah #
# #
# #
# Description:Test Cases of Dynamic System Variable innodb_force_load_corrupted#
# 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_031_01----------------------#'
####################################################################
# Displaying default value #
####################################################################
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
--echo 1 Expected
--echo '#---------------------BS_STVARS_031_02----------------------#'
####################################################################
# Check if Value can set #
####################################################################
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.innodb_force_load_corrupted=1;
--echo Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
--echo 1 Expected
--echo '#---------------------BS_STVARS_031_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT IF(@@GLOBAL.innodb_force_load_corrupted, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_force_load_corrupted';
--echo 1 Expected
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_force_load_corrupted';
--echo 1 Expected
--echo '#---------------------BS_STVARS_031_04----------------------#'
################################################################################
# Check if accessing variable with and without GLOBAL point to same variable #
################################################################################
SELECT @@innodb_force_load_corrupted = @@GLOBAL.innodb_force_load_corrupted;
--echo 1 Expected
--echo '#---------------------BS_STVARS_031_05----------------------#'
################################################################################
# Check if innodb_force_load_corrupted can be accessed with and without @@ sign #
################################################################################
SELECT COUNT(@@innodb_force_load_corrupted);
--echo 1 Expected
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.innodb_force_load_corrupted);
--echo Expected error 'Variable is a GLOBAL variable'
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.innodb_force_load_corrupted);
--echo Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_force_load_corrupted);
--echo 1 Expected
--Error ER_BAD_FIELD_ERROR
SELECT innodb_force_load_corrupted = @@SESSION.innodb_force_load_corrupted;
--echo Expected error 'Readonly variable'
# 2010-01-25 - Added
#
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_large_prefix;
SELECT @start_global_value;
#
# exists as global only
#
--echo Valid values are 'ON' and 'OFF'
select @@global.innodb_large_prefix in (0, 1);
select @@global.innodb_large_prefix;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_large_prefix;
show global variables like 'innodb_large_prefix';
show session variables like 'innodb_large_prefix';
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
#
# show that it's writable
#
set global innodb_large_prefix='OFF';
select @@global.innodb_large_prefix;
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
set @@global.innodb_large_prefix=1;
select @@global.innodb_large_prefix;
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
set global innodb_large_prefix=0;
select @@global.innodb_large_prefix;
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
set @@global.innodb_large_prefix='ON';
select @@global.innodb_large_prefix;
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
--error ER_GLOBAL_VARIABLE
set session innodb_large_prefix='OFF';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_large_prefix='ON';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_large_prefix=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_large_prefix=1e1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_large_prefix=2;
--echo NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643)
set global innodb_large_prefix=-3;
select @@global.innodb_large_prefix;
select * from information_schema.global_variables where variable_name='innodb_large_prefix';
select * from information_schema.session_variables where variable_name='innodb_large_prefix';
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_large_prefix='AUTO';
#
# Cleanup
#
SET @@global.innodb_large_prefix = @start_global_value;
SELECT @@global.innodb_large_prefix;
...@@ -3487,7 +3487,6 @@ buf_mark_space_corrupt( ...@@ -3487,7 +3487,6 @@ buf_mark_space_corrupt(
const ibool uncompressed = (buf_page_get_state(bpage) const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE); == BUF_BLOCK_FILE_PAGE);
ulint space = bpage->space; ulint space = bpage->space;
ulint offset = bpage->offset;
ibool ret = TRUE; ibool ret = TRUE;
/* First unfix and release lock on the bpage */ /* First unfix and release lock on the bpage */
...@@ -3507,7 +3506,6 @@ buf_mark_space_corrupt( ...@@ -3507,7 +3506,6 @@ buf_mark_space_corrupt(
/* Find the table with specified space id, and mark it corrupted */ /* Find the table with specified space id, and mark it corrupted */
if (dict_set_corrupted_by_space(space)) { if (dict_set_corrupted_by_space(space)) {
ut_ad(bpage->space == space && bpage->offset == offset);
buf_LRU_free_one_page(bpage); buf_LRU_free_one_page(bpage);
} else { } else {
ret = FALSE; ret = FALSE;
......
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