| 1 |
############## mysql-test\t\max_user_connections_basic.test ############### |
| 2 |
# # |
| 3 |
# Variable Name: max_user_connections # |
| 4 |
# Scope: GLOBAL | SESSION # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: numeric # |
| 7 |
# Default Value: - # |
| 8 |
# Range: 1-4294967295 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Salman # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable max_user_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_user_connections TESTS # |
| 30 |
#################################### |
| 31 |
|
| 32 |
|
| 33 |
############################################################# |
| 34 |
# Save initial value # |
| 35 |
############################################################# |
| 36 |
|
| 37 |
SET @start_global_value = @@global.max_user_connections; |
| 38 |
SELECT @start_global_value; |
| 39 |
SET @start_session_value = @@session.max_user_connections; |
| 40 |
SELECT @start_session_value; |
| 41 |
|
| 42 |
|
| 43 |
--echo '#--------------------FN_DYNVARS_087_01-------------------------#' |
| 44 |
###################################################### |
| 45 |
# Display the DEFAULT value of max_user_connections # |
| 46 |
###################################################### |
| 47 |
|
| 48 |
SET @@global.max_user_connections = 1000; |
| 49 |
SET @@global.max_user_connections = DEFAULT; |
| 50 |
SELECT @@global.max_user_connections; |
| 51 |
|
| 52 |
--Error ER_VARIABLE_IS_READONLY |
| 53 |
SET @@session.max_user_connections = 1000; |
| 54 |
|
| 55 |
|
| 56 |
--echo '#--------------------FN_DYNVARS_087_02-------------------------#' |
| 57 |
###################################################### |
| 58 |
# Check the DEFAULT value of max_user_connections # |
| 59 |
###################################################### |
| 60 |
|
| 61 |
SET @@global.max_user_connections = DEFAULT; |
| 62 |
SELECT @@global.max_user_connections = 0; |
| 63 |
|
| 64 |
--Error ER_VARIABLE_IS_READONLY |
| 65 |
SET @@session.max_user_connections = DEFAULT; |
| 66 |
SELECT @@session.max_user_connections; |
| 67 |
|
| 68 |
|
| 69 |
--echo '#--------------------FN_DYNVARS_087_03-------------------------#' |
| 70 |
######################################################################## |
| 71 |
# Change the value of max_user_connections to a valid value for GLOBAL Scope # |
| 72 |
######################################################################## |
| 73 |
|
| 74 |
SET @@global.max_user_connections = 1; |
| 75 |
SELECT @@global.max_user_connections; |
| 76 |
SET @@global.max_user_connections = 2; |
| 77 |
SELECT @@global.max_user_connections; |
| 78 |
SET @@global.max_user_connections = 65536; |
| 79 |
SELECT @@global.max_user_connections; |
| 80 |
SET @@global.max_user_connections = 4294967295; |
| 81 |
SELECT @@global.max_user_connections; |
| 82 |
SET @@global.max_user_connections = 4294967294; |
| 83 |
SELECT @@global.max_user_connections; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
--echo '#------------------FN_DYNVARS_087_05-----------------------#' |
| 88 |
########################################################## |
| 89 |
# Change the value of max_user_connections to an invalid value # |
| 90 |
########################################################## |
| 91 |
|
| 92 |
SET @@global.max_user_connections = -1024; |
| 93 |
SELECT @@global.max_user_connections; |
| 94 |
SET @@global.max_user_connections = 4294967296; |
| 95 |
SELECT @@global.max_user_connections; |
| 96 |
SET @@global.max_user_connections = -1; |
| 97 |
SELECT @@global.max_user_connections; |
| 98 |
SET @@global.max_user_connections = 429496729500; |
| 99 |
SELECT @@global.max_user_connections; |
| 100 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 101 |
SET @@global.max_user_connections = 65530.34; |
| 102 |
SELECT @@global.max_user_connections; |
| 103 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 104 |
SET @@global.max_user_connections = test; |
| 105 |
SELECT @@global.max_user_connections; |
| 106 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 107 |
SET @@global.max_user_connections = ' '; |
| 108 |
SELECT @@global.max_user_connections; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
--echo '#------------------FN_DYNVARS_087_06-----------------------#' |
| 113 |
#################################################################### |
| 114 |
# Check if the value in GLOBAL Table matches value in variable # |
| 115 |
#################################################################### |
| 116 |
|
| 117 |
|
| 118 |
--disable_warnings |
| 119 |
SELECT @@global.max_user_connections = VARIABLE_VALUE |
| 120 |
FROM performance_schema.global_variables |
| 121 |
WHERE VARIABLE_NAME='max_user_connections'; |
| 122 |
--enable_warnings |
| 123 |
|
| 124 |
|
| 125 |
--echo '#------------------FN_DYNVARS_087_08-----------------------#' |
| 126 |
#################################################################### |
| 127 |
# Check if TRUE and FALSE values can be used on variable # |
| 128 |
#################################################################### |
| 129 |
|
| 130 |
SET @@global.max_user_connections = TRUE; |
| 131 |
SELECT @@global.max_user_connections; |
| 132 |
SET @@global.max_user_connections = FALSE; |
| 133 |
SELECT @@global.max_user_connections; |
| 134 |
|
| 135 |
|
| 136 |
--echo '#---------------------FN_DYNVARS_087_09----------------------#' |
| 137 |
################################################################################# |
| 138 |
# Check if accessing variable with and without GLOBAL point to same variable # |
| 139 |
################################################################################# |
| 140 |
|
| 141 |
SET @@global.max_user_connections = 20; |
| 142 |
SELECT @@max_user_connections = @@global.max_user_connections; |
| 143 |
|
| 144 |
|
| 145 |
--echo '#---------------------FN_DYNVARS_087_11----------------------#' |
| 146 |
######################################################################### |
| 147 |
# Check if max_user_connections can be accessed with and without @@ sign # |
| 148 |
######################################################################### |
| 149 |
|
| 150 |
|
| 151 |
SET @@global.max_user_connections = 102; |
| 152 |
SELECT @@max_user_connections; |
| 153 |
--Error ER_UNKNOWN_TABLE |
| 154 |
SELECT local.max_user_connections; |
| 155 |
--Error ER_UNKNOWN_TABLE |
| 156 |
SELECT session.max_user_connections; |
| 157 |
--Error ER_BAD_FIELD_ERROR |
| 158 |
SELECT max_user_connections = @@session.max_user_connections; |
| 159 |
|
| 160 |
|
| 161 |
#################################### |
| 162 |
# Restore initial value # |
| 163 |
#################################### |
| 164 |
|
| 165 |
SET @@global.max_user_connections = @start_global_value; |
| 166 |
SELECT @@global.max_user_connections; |
| 167 |
|
| 168 |
|
| 169 |
################################################### |
| 170 |
# END OF max_user_connections TESTS # |
| 171 |
################################################### |
| 172 |
|