| 1 |
############## mysql-test\t\table_open_cache_basic.test ####################### |
| 2 |
# # |
| 3 |
# Variable Name: table_open_cache # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: numeric # |
| 7 |
# Default Value: 400 # |
| 8 |
# Range: 64-524288 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-13 # |
| 12 |
# Author: Salman # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable table_open_cache # |
| 15 |
# that checks the behavior of this variable in the following ways# |
| 16 |
# * Default Value # |
| 17 |
# * Valid & Invalid values # |
| 18 |
# * Scope & Access method # |
| 19 |
# * Data Integrity # |
| 20 |
# # |
| 21 |
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # |
| 22 |
# server-system-variables.html#option_mysqld_table_open_cache # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
|
| 28 |
######################################################################## |
| 29 |
# START OF table_open_cache TESTS # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
|
| 33 |
########################################################################## |
| 34 |
# Saving initial value of table_open_cache in a temporary variable # |
| 35 |
########################################################################## |
| 36 |
|
| 37 |
SET @start_value = @@global.table_open_cache ; |
| 38 |
|
| 39 |
--echo '#---------------------FN_DYNVARS_001_02-------------------------#' |
| 40 |
############################################### |
| 41 |
# Verify default value of variable # |
| 42 |
############################################### |
| 43 |
|
| 44 |
SET @@global.table_open_cache = Default; |
| 45 |
SELECT @@global.table_open_cache > 0; |
| 46 |
|
| 47 |
--echo '#--------------------FN_DYNVARS_001_03------------------------#' |
| 48 |
######################################################################## |
| 49 |
# Change the value of table_open_cache to a valid value # |
| 50 |
######################################################################## |
| 51 |
|
| 52 |
|
| 53 |
SET @@global.table_open_cache = 8; |
| 54 |
SELECT @@global.table_open_cache ; |
| 55 |
|
| 56 |
SET @@global.table_open_cache = 1; |
| 57 |
SELECT @@global.table_open_cache ; |
| 58 |
|
| 59 |
SET @@global.table_open_cache = 1073741824; |
| 60 |
SELECT @@global.table_open_cache ; |
| 61 |
|
| 62 |
SET @@global.table_open_cache = 18000; |
| 63 |
SELECT @@global.table_open_cache ; |
| 64 |
SET @@global.table_open_cache = 65535; |
| 65 |
SELECT @@global.table_open_cache ; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
--echo '#--------------------FN_DYNVARS_001_04-------------------------#' |
| 70 |
####################################################################### |
| 71 |
# Change the value of table_open_cache to invalid value # |
| 72 |
####################################################################### |
| 73 |
|
| 74 |
SET @@global.table_open_cache = -1; |
| 75 |
SELECT @@global.table_open_cache ; |
| 76 |
|
| 77 |
SET @@global.table_open_cache = 100000000000; |
| 78 |
SELECT @@global.table_open_cache ; |
| 79 |
|
| 80 |
SET @@global.table_open_cache = -1024; |
| 81 |
SELECT @@global.table_open_cache ; |
| 82 |
|
| 83 |
SET @@global.table_open_cache = 0; |
| 84 |
SELECT @@global.table_open_cache ; |
| 85 |
|
| 86 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 87 |
SET @@global.table_open_cache = 10000.01; |
| 88 |
|
| 89 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 90 |
SET @@global.table_open_cache = ON; |
| 91 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 92 |
SET @@global.table_open_cache= 'test'; |
| 93 |
|
| 94 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 95 |
SET @@global.table_open_cache = ''; |
| 96 |
|
| 97 |
|
| 98 |
--echo '#-------------------FN_DYNVARS_001_05----------------------------#' |
| 99 |
########################################################################### |
| 100 |
# Test if accessing session table_open_cache gives error # |
| 101 |
########################################################################### |
| 102 |
|
| 103 |
--Error ER_GLOBAL_VARIABLE |
| 104 |
SET @@session.table_open_cache = 0; |
| 105 |
|
| 106 |
|
| 107 |
--echo '#----------------------FN_DYNVARS_001_06------------------------#' |
| 108 |
#################################################################### |
| 109 |
# Check if the value in GLOBAL Tables matches values in variable # |
| 110 |
#################################################################### |
| 111 |
|
| 112 |
SELECT @@global.table_open_cache = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='table_open_cache '; |
| 113 |
|
| 114 |
|
| 115 |
--echo '#---------------------FN_DYNVARS_001_09----------------------#' |
| 116 |
################################################################### |
| 117 |
# Check if TRUE and FALSE values can be used on variable # |
| 118 |
################################################################### |
| 119 |
|
| 120 |
SET @@global.table_open_cache = TRUE; |
| 121 |
SELECT @@global.table_open_cache ; |
| 122 |
|
| 123 |
SET @@global.table_open_cache = FALSE; |
| 124 |
SELECT @@global.table_open_cache ; |
| 125 |
|
| 126 |
|
| 127 |
--echo '#---------------------FN_DYNVARS_001_10----------------------#' |
| 128 |
############################################################################## |
| 129 |
# Check if accessing variable without SCOPE points to same session variable # |
| 130 |
############################################################################## |
| 131 |
|
| 132 |
SET @@global.table_open_cache = 10; |
| 133 |
SELECT @@table_open_cache = @@global.table_open_cache ; |
| 134 |
|
| 135 |
|
| 136 |
--echo '#---------------------FN_DYNVARS_001_11----------------------#' |
| 137 |
########################################################################## |
| 138 |
# Check if table_open_cache can be accessed with and without @@ sign # |
| 139 |
########################################################################## |
| 140 |
|
| 141 |
--Error ER_GLOBAL_VARIABLE |
| 142 |
SET table_open_cache = 8; |
| 143 |
--Error ER_UNKNOWN_TABLE |
| 144 |
SELECT global.table_open_cache ; |
| 145 |
--Error ER_BAD_FIELD_ERROR |
| 146 |
SELECT table_open_cache = @@session.table_open_cache ; |
| 147 |
|
| 148 |
|
| 149 |
############################## |
| 150 |
# Restore initial value # |
| 151 |
############################## |
| 152 |
|
| 153 |
SET @@global.table_open_cache = @start_value; |
| 154 |
|
| 155 |
################################################################## |
| 156 |
# END OF table_open_cache TESTS # |
| 157 |
################################################################## |