

################## mysql-test\t\innodb_buffer_pool_size_basic.test ############
#                                                                             #
# Variable Name: innodb_buffer_pool_size                                      #
# Scope: Global                                                               #
# Access Type: Static                                                         #
# Data Type: numeric                                                          #
#                                                                             #
#                                                                             #
# Creation Date: 2008-02-07                                                   #
# Author : Sharique Abdullah                                                  #
#                                                                             #
#                                                                             #
# Description:Test Cases of Dynamic System Variable innodb_buffer_pool_size   #
#             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

SET @start_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size;

--echo '#---------------------BS_STVARS_022_02----------------------#'
####################################################################
#   Check if Value can set                                         #
####################################################################

--enable_warnings
SELECT @@GLOBAL.innodb_buffer_pool_size_max;
SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max;
SET GLOBAL innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max + 1048576;
SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max;
--disable_warnings

--echo '#---------------------BS_STVARS_022_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable  #
#################################################################

--disable_warnings
SELECT @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_buffer_pool_size';
--enable_warnings
--echo 1 Expected

--disable_warnings
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
WHERE VARIABLE_NAME='innodb_buffer_pool_size';
--enable_warnings
--echo 1 Expected

--echo '#---------------------BS_STVARS_022_04----------------------#'
################################################################################
#  Check if accessing variable with and without GLOBAL point to same variable  #
################################################################################
SELECT @@innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size;
--echo 1 Expected



--echo '#---------------------BS_STVARS_022_05----------------------#'
################################################################################
#   Check if innodb_buffer_pool_size can be accessed with and without @@ sign  #
################################################################################

SELECT COUNT(@@innodb_buffer_pool_size);
--echo 1 Expected

--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.innodb_buffer_pool_size);
--echo Expected error 'Variable is a GLOBAL variable'

--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.innodb_buffer_pool_size);
--echo Expected error 'Variable is a GLOBAL variable'

SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
--echo 1 Expected

--Error ER_BAD_FIELD_ERROR
SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;


# Restore the original buffer pool size.
SET GLOBAL innodb_buffer_pool_size = @start_buffer_pool_size;

SELECT @@innodb_buffer_pool_size = @start_buffer_pool_size;
