--source include/have_innodb.inc
--source include/have_debug.inc

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

#
# exists as global only
#
select @@global.innodb_log_checkpoint_now in (0, 1);
select @@global.innodb_log_checkpoint_now;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_log_checkpoint_now;
show global variables like 'innodb_log_checkpoint_now';
show session variables like 'innodb_log_checkpoint_now';
select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';

#
# show that it's writable
#
set global innodb_log_checkpoint_now=1;
# Should always be OFF
select @@global.innodb_log_checkpoint_now;
select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';

set @@global.innodb_log_checkpoint_now=0;
# Should always be OFF
select @@global.innodb_log_checkpoint_now;
select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';

set global innodb_log_checkpoint_now=ON;
# Should always be OFF
select @@global.innodb_log_checkpoint_now;
select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';

set global innodb_log_checkpoint_now=OFF;
# Should always be OFF
select @@global.innodb_log_checkpoint_now;
select * from information_schema.global_variables where variable_name='innodb_log_checkpoint_now';
select * from information_schema.session_variables where variable_name='innodb_log_checkpoint_now';

--error ER_GLOBAL_VARIABLE
set session innodb_log_checkpoint_now='some';

--error ER_GLOBAL_VARIABLE
set @@session.innodb_log_checkpoint_now='some';

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

#
# Cleanup
#

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