| 1 |
################ mysql-test\t\binlog_cache_size_basic.test #################### |
| 2 |
# |
| 3 |
# Variable Name: binlog_cache_size # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: Numeric # |
| 7 |
# Default Value: 32768 # |
| 8 |
# Range: 4096 - 4294967295 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-04-28 # |
| 12 |
# Author: Salman Rawala/Horst Hunger # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable "binlog_cache_size" # |
| 15 |
# that checks 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_binlog_cache_size # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
################################################################# |
| 27 |
# START OF binlog_cache_size TESTS # |
| 28 |
################################################################# |
| 29 |
|
| 30 |
######################################################################### |
| 31 |
# Saving initial value of binlog_cache_size in a temporary variable # |
| 32 |
######################################################################### |
| 33 |
|
| 34 |
SET @start_value = @@global.binlog_cache_size; |
| 35 |
set @@global.binlog_cache_size= default; |
| 36 |
SELECT @@global.binlog_cache_size; |
| 37 |
|
| 38 |
--echo '#--------------------FN_DYNVARS_006_01------------------------#' |
| 39 |
######################################################################### |
| 40 |
# Display the DEFAULT value of binlog_cache_size # |
| 41 |
######################################################################### |
| 42 |
|
| 43 |
SET @@global.binlog_cache_size = 100; |
| 44 |
SET @@global.binlog_cache_size = DEFAULT; |
| 45 |
SELECT @@global.binlog_cache_size; |
| 46 |
|
| 47 |
|
| 48 |
--echo '#---------------------FN_DYNVARS_006_02-------------------------#' |
| 49 |
############################################### |
| 50 |
# Verify default value of variable # |
| 51 |
############################################### |
| 52 |
|
| 53 |
SET @@global.binlog_cache_size = default; |
| 54 |
SELECT @@global.binlog_cache_size = 32768; |
| 55 |
|
| 56 |
|
| 57 |
--echo '#--------------------FN_DYNVARS_006_03------------------------#' |
| 58 |
######################################################################### |
| 59 |
# Change the value of binlog_cache_size to a valid value # |
| 60 |
######################################################################### |
| 61 |
|
| 62 |
SET @@global.binlog_cache_size = 4096; |
| 63 |
SELECT @@global.binlog_cache_size; |
| 64 |
SET @@global.binlog_cache_size = 4294967295; |
| 65 |
SELECT @@global.binlog_cache_size; |
| 66 |
SET @@global.binlog_cache_size = 10000; |
| 67 |
SELECT @@global.binlog_cache_size; |
| 68 |
SET @@global.binlog_cache_size = 21221204; |
| 69 |
SELECT @@global.binlog_cache_size; |
| 70 |
echo 'Bug: Invalid values are coming in variable on assigning valid values'; |
| 71 |
|
| 72 |
|
| 73 |
--echo '#--------------------FN_DYNVARS_006_04-------------------------#' |
| 74 |
############################################################################ |
| 75 |
# Change the value of binlog_cache_size to invalid value # |
| 76 |
############################################################################ |
| 77 |
|
| 78 |
SET @@global.binlog_cache_size = 1024; |
| 79 |
SELECT @@global.binlog_cache_size; |
| 80 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 81 |
SET @@global.binlog_cache_size = 10000.01; |
| 82 |
SET @@global.binlog_cache_size = -1024; |
| 83 |
SELECT @@global.binlog_cache_size; |
| 84 |
SET @@global.binlog_cache_size = 42949672950; |
| 85 |
--replace_result 4294963200 max_binlog_cache_size 42949668864 max_binlog_cache_size |
| 86 |
SELECT @@global.binlog_cache_size; |
| 87 |
echo 'Bug: Errors are not coming on assigning invalid values to variable'; |
| 88 |
|
| 89 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 90 |
SET @@global.binlog_cache_size = ON; |
| 91 |
|
| 92 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 93 |
SET @@global.binlog_cache_size = 'test'; |
| 94 |
|
| 95 |
|
| 96 |
--echo '#-------------------FN_DYNVARS_006_05----------------------------#' |
| 97 |
############################################################################ |
| 98 |
# Test if accessing session binlog_cache_size gives error # |
| 99 |
############################################################################ |
| 100 |
|
| 101 |
--Error ER_GLOBAL_VARIABLE |
| 102 |
SET @@session.binlog_cache_size = 0; |
| 103 |
|
| 104 |
|
| 105 |
--echo '#----------------------FN_DYNVARS_006_06------------------------#' |
| 106 |
############################################################################## |
| 107 |
# Check if the value in GLOBAL Tables matches values in variable # |
| 108 |
############################################################################## |
| 109 |
|
| 110 |
SELECT @@global.binlog_cache_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_cache_size'; |
| 111 |
|
| 112 |
--echo '#---------------------FN_DYNVARS_006_07----------------------#' |
| 113 |
################################################################### |
| 114 |
# Check if TRUE and FALSE values can be used on variable # |
| 115 |
################################################################### |
| 116 |
|
| 117 |
SET @@global.binlog_cache_size = TRUE; |
| 118 |
SELECT @@global.binlog_cache_size; |
| 119 |
SET @@global.binlog_cache_size = FALSE; |
| 120 |
SELECT @@global.binlog_cache_size; |
| 121 |
echo 'Bug: Errors are not coming on assigning TRUE/FALSE to variable'; |
| 122 |
|
| 123 |
--echo '#---------------------FN_DYNVARS_006_08----------------------#' |
| 124 |
############################################################################### |
| 125 |
# Check if accessing variable without SCOPE points to same global variable # |
| 126 |
############################################################################### |
| 127 |
|
| 128 |
SET @@global.binlog_cache_size = 1; |
| 129 |
SELECT @@binlog_cache_size = @@global.binlog_cache_size; |
| 130 |
|
| 131 |
--echo '#---------------------FN_DYNVARS_006_09----------------------#' |
| 132 |
########################################################################### |
| 133 |
# Check if binlog_cache_size can be accessed with and without @@ sign # |
| 134 |
########################################################################### |
| 135 |
|
| 136 |
--Error ER_GLOBAL_VARIABLE |
| 137 |
SET binlog_cache_size = 1; |
| 138 |
--Error ER_UNKNOWN_TABLE |
| 139 |
SELECT global.binlog_cache_size; |
| 140 |
--Error ER_BAD_FIELD_ERROR |
| 141 |
SELECT binlog_cache_size = @@session.binlog_cache_size; |
| 142 |
|
| 143 |
|
| 144 |
############################## |
| 145 |
# Restore initial value # |
| 146 |
############################## |
| 147 |
|
| 148 |
SET @@global.binlog_cache_size = @start_value; |
| 149 |
|
| 150 |
########################################################### |
| 151 |
# END OF binlog_cache_size TESTS # |
| 152 |
########################################################### |