#
# Basic test for innodb_buffer_pool_load_now
#

-- source include/have_innodb.inc

# Check the default value
SET @orig = @@global.innodb_buffer_pool_load_now;
SELECT @orig;

# Do the dump
SET GLOBAL innodb_buffer_pool_dump_now = ON;

# Wait for the dump to complete
let $wait_condition =
  SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
  FROM information_schema.global_status
  WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
-- source include/wait_condition.inc

# Confirm the file is really created
-- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)`
-- file_exists $file

# Load the dump
SET GLOBAL innodb_buffer_pool_load_now = ON;

# Wait for the load to complete
let $wait_condition =
  SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
  FROM information_schema.global_status
  WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
-- source include/wait_condition.inc

# Show the status, interesting if the above timed out
-- replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/
SELECT variable_value
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
