| 1 |
############## mysql-test\t\max_connections_basic.test ############### |
| 2 |
# # |
| 3 |
# Variable Name: max_connections # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: numeric # |
| 7 |
# Default Value:151 # |
| 8 |
# Range: 1-100000 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Salman # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable max_connections # |
| 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 # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
|
| 28 |
############################################################### |
| 29 |
# START OF max_connections TESTS # |
| 30 |
############################################################### |
| 31 |
|
| 32 |
|
| 33 |
################################################################### |
| 34 |
# Saving initial value of max_connections in a temporary variable # |
| 35 |
################################################################### |
| 36 |
|
| 37 |
SET @start_value = @@global.max_connections; |
| 38 |
SELECT @start_value; |
| 39 |
|
| 40 |
|
| 41 |
--echo '#--------------------FN_DYNVARS_074_01------------------------#' |
| 42 |
################################################################## |
| 43 |
# Display the DEFAULT value of max_connections # |
| 44 |
################################################################## |
| 45 |
|
| 46 |
SET @@global.max_connections = 5000; |
| 47 |
SET @@global.max_connections = DEFAULT; |
| 48 |
SELECT @@global.max_connections; |
| 49 |
|
| 50 |
--echo '#---------------------FN_DYNVARS_074_02-------------------------#' |
| 51 |
############################################### |
| 52 |
# Verify default value of variable # |
| 53 |
############################################### |
| 54 |
|
| 55 |
SET @@global.max_connections = @start_value; |
| 56 |
SELECT @@global.max_connections = 151; |
| 57 |
|
| 58 |
|
| 59 |
--echo '#--------------------FN_DYNVARS_074_03------------------------#' |
| 60 |
################################################################## |
| 61 |
# Change the value of max_connections to a valid value # |
| 62 |
################################################################## |
| 63 |
|
| 64 |
SET @@global.max_connections = 100000; |
| 65 |
SELECT @@global.max_connections; |
| 66 |
SET @@global.max_connections = 99999; |
| 67 |
SELECT @@global.max_connections; |
| 68 |
SET @@global.max_connections = 65536; |
| 69 |
SELECT @@global.max_connections; |
| 70 |
SET @@global.max_connections = 1; |
| 71 |
SELECT @@global.max_connections; |
| 72 |
SET @@global.max_connections = 2; |
| 73 |
SELECT @@global.max_connections; |
| 74 |
|
| 75 |
|
| 76 |
--echo '#--------------------FN_DYNVARS_074_04-------------------------#' |
| 77 |
##################################################################### |
| 78 |
# Change the value of max_connections to invalid value # |
| 79 |
##################################################################### |
| 80 |
|
| 81 |
SET @@global.max_connections = -1; |
| 82 |
SELECT @@global.max_connections; |
| 83 |
SET @@global.max_connections = 100000000000; |
| 84 |
SELECT @@global.max_connections; |
| 85 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 86 |
SET @@global.max_connections = 10000.01; |
| 87 |
SELECT @@global.max_connections; |
| 88 |
SET @@global.max_connections = -1024; |
| 89 |
SELECT @@global.max_connections; |
| 90 |
SET @@global.max_connections = 0; |
| 91 |
SELECT @@global.max_connections; |
| 92 |
SET @@global.max_connections = 100001; |
| 93 |
SELECT @@global.max_connections; |
| 94 |
|
| 95 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 96 |
SET @@global.max_connections = ON; |
| 97 |
SELECT @@global.max_connections; |
| 98 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 99 |
SET @@global.max_connections = 'test'; |
| 100 |
SELECT @@global.max_connections; |
| 101 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 102 |
SET @@global.max_connections = ' '; |
| 103 |
SELECT @@global.max_connections; |
| 104 |
|
| 105 |
|
| 106 |
--echo '#-------------------FN_DYNVARS_074_05----------------------------#' |
| 107 |
##################################################################### |
| 108 |
# Test if accessing session max_connections gives error # |
| 109 |
##################################################################### |
| 110 |
|
| 111 |
--Error ER_GLOBAL_VARIABLE |
| 112 |
SET @@session.max_connections = 4096; |
| 113 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 114 |
SELECT @@session.max_connections; |
| 115 |
|
| 116 |
|
| 117 |
--echo '#----------------------FN_DYNVARS_074_06------------------------#' |
| 118 |
############################################################################## |
| 119 |
# Check if the value in GLOBAL & SESSION Tables matches values in variable # |
| 120 |
############################################################################## |
| 121 |
|
| 122 |
--disable_warnings |
| 123 |
SELECT @@global.max_connections = VARIABLE_VALUE |
| 124 |
FROM performance_schema.global_variables |
| 125 |
WHERE VARIABLE_NAME='max_connections'; |
| 126 |
|
| 127 |
SELECT @@max_connections = VARIABLE_VALUE |
| 128 |
FROM performance_schema.session_variables |
| 129 |
WHERE VARIABLE_NAME='max_connections'; |
| 130 |
--enable_warnings |
| 131 |
|
| 132 |
|
| 133 |
--echo '#---------------------FN_DYNVARS_074_07----------------------#' |
| 134 |
################################################################### |
| 135 |
# Check if TRUE and FALSE values can be used on variable # |
| 136 |
################################################################### |
| 137 |
|
| 138 |
SET @@global.max_connections = TRUE; |
| 139 |
SELECT @@global.max_connections; |
| 140 |
SET @@global.max_connections = FALSE; |
| 141 |
SELECT @@global.max_connections; |
| 142 |
|
| 143 |
|
| 144 |
--echo '#---------------------FN_DYNVARS_074_08----------------------#' |
| 145 |
######################################################################################################## |
| 146 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # |
| 147 |
######################################################################################################## |
| 148 |
|
| 149 |
SET @@global.max_connections = 5000; |
| 150 |
SELECT @@max_connections = @@global.max_connections; |
| 151 |
|
| 152 |
|
| 153 |
--echo '#---------------------FN_DYNVARS_074_09----------------------#' |
| 154 |
########################################################################## |
| 155 |
# Check if max_connections can be accessed with and without @@ sign # |
| 156 |
########################################################################## |
| 157 |
|
| 158 |
--Error ER_GLOBAL_VARIABLE |
| 159 |
SET max_connections = 6000; |
| 160 |
SELECT @@max_connections; |
| 161 |
--Error ER_PARSE_ERROR |
| 162 |
SET local.max_connections = 7000; |
| 163 |
--Error ER_UNKNOWN_TABLE |
| 164 |
SELECT local.max_connections; |
| 165 |
--Error ER_PARSE_ERROR |
| 166 |
SET global.max_connections = 8000; |
| 167 |
--Error ER_UNKNOWN_TABLE |
| 168 |
SELECT global.max_connections; |
| 169 |
--Error ER_BAD_FIELD_ERROR |
| 170 |
SELECT max_connections; |
| 171 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 172 |
SELECT @@session.max_connections; |
| 173 |
|
| 174 |
|
| 175 |
############################## |
| 176 |
# Restore initial value # |
| 177 |
############################## |
| 178 |
|
| 179 |
SET @@global.max_connections = @start_value; |
| 180 |
SELECT @@global.max_connections; |
| 181 |
|
| 182 |
|
| 183 |
################################################################## |
| 184 |
# END OF max_connections TESTS # |
| 185 |
################################################################## |
| 186 |
|