--source include/have_innodb.inc

SET @start_global_value = @@global.innodb_online_alter_log_max_size;
SELECT @start_global_value;

#
# exists as global only
#
select @@global.innodb_online_alter_log_max_size >= 524288;
select @@global.innodb_online_alter_log_max_size;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_online_alter_log_max_size;
show global variables like 'innodb_online_alter_log_max_size';
show session variables like 'innodb_online_alter_log_max_size';
select * from information_schema.global_variables where variable_name='innodb_online_alter_log_max_size';
select * from information_schema.session_variables where variable_name='innodb_online_alter_log_max_size';

#
# show that it's writable
#
set global innodb_online_alter_log_max_size=1048576;
select @@global.innodb_online_alter_log_max_size;
select * from information_schema.global_variables where variable_name='innodb_online_alter_log_max_size';
select * from information_schema.session_variables where variable_name='innodb_online_alter_log_max_size';
set @@global.innodb_online_alter_log_max_size=524288;
select @@global.innodb_online_alter_log_max_size;
select * from information_schema.global_variables where variable_name='innodb_online_alter_log_max_size';
select * from information_schema.session_variables where variable_name='innodb_online_alter_log_max_size';
--error ER_GLOBAL_VARIABLE
set session innodb_online_alter_log_max_size='some';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_online_alter_log_max_size='some';

#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_online_alter_log_max_size=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_online_alter_log_max_size='foo';
set global innodb_online_alter_log_max_size=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_online_alter_log_max_size=1e1;
set global innodb_online_alter_log_max_size=2;

#
# Cleanup
#

SET @@global.innodb_online_alter_log_max_size = @start_global_value;
SELECT @@global.innodb_online_alter_log_max_size;
