Commit 8f9bb826 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-30971 Add a new system variable aria_data_home_dir

parent 8020b1bd
#
# MDEV-30971 Add a new system variable aria_data_home_dir
#
# restart: --loose-aria-log-file-size=8388608 --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1
SET @@global.aria_log_purge_type=external;
SHOW VARIABLES LIKE 'aria_log_file_size';
Variable_name Value
aria_log_file_size 8388608
SELECT @@aria_log_dir_path;
@@aria_log_dir_path
MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
SHOW ENGINE aria logs;
Type Name Status
Aria aria_log.00000001 in use
CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
BEGIN NOT ATOMIC
FOR id IN 0..9 DO
INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
END FOR;
END;
$$
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
SHOW ENGINE aria logs;
Type Name Status
Aria aria_log.00000001 free
Aria aria_log.00000002 in use
DROP TABLE t1;
# restart
--source include/have_maria.inc
--let $datadir= `SELECT @@datadir`
--echo #
--echo # MDEV-30971 Add a new system variable aria_data_home_dir
--echo #
--let $ARIA_LOGDIR=$MYSQLTEST_VARDIR/tmp/aria_log_dir_path_1
--mkdir $ARIA_LOGDIR
--let $restart_parameters=--loose-aria-log-file-size=8388608 --loose-aria-log-dir-path=$ARIA_LOGDIR
--source include/restart_mysqld.inc
#
# Test that:
# - aria_log_dir_path is set to a non-default directory.
# - New Aria log files are created in the non-default directory.
# - The contents of the log directory (according to "file_exists" commands)
# is in sync with the "SHOW ENGINE aria logs" ouput.
#
# Prevent automatic purge
SET @@global.aria_log_purge_type=external;
SHOW VARIABLES LIKE 'aria_log_file_size';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SELECT @@aria_log_dir_path;
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
--file_exists $ARIA_LOGDIR/aria_log_control
--file_exists $ARIA_LOGDIR/aria_log.00000001
--error 1
--file_exists $ARIA_LOGDIR/aria_log.00000002
--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/
SHOW ENGINE aria logs;
CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria;
DELIMITER $$;
BEGIN NOT ATOMIC
FOR id IN 0..9 DO
INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024));
END FOR;
END;
$$
DELIMITER ;$$
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/;
--file_exists $ARIA_LOGDIR/aria_log_control
--file_exists $ARIA_LOGDIR/aria_log.00000001
--file_exists $ARIA_LOGDIR/aria_log.00000002
--error 1
--file_exists $ARIA_LOGDIR/aria_log.00000003
--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/
SHOW ENGINE aria logs;
DROP TABLE t1;
--let $restart_parameters=
--source include/restart_mysqld.inc
--remove_file $ARIA_LOGDIR/aria_log_control
--remove_file $ARIA_LOGDIR/aria_log.00000001
--remove_file $ARIA_LOGDIR/aria_log.00000002
--rmdir $ARIA_LOGDIR
...@@ -311,6 +311,7 @@ aria_encrypt_tables # ...@@ -311,6 +311,7 @@ aria_encrypt_tables #
aria_force_start_after_recovery_failures # aria_force_start_after_recovery_failures #
aria_group_commit # aria_group_commit #
aria_group_commit_interval # aria_group_commit_interval #
aria_log_dir_path #
aria_log_file_size # aria_log_file_size #
aria_log_purge_type # aria_log_purge_type #
aria_max_sort_file_size # aria_max_sort_file_size #
......
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
COUNT(@@GLOBAL.aria_log_dir_path)
1
SET @@GLOBAL.aria_log_dir_path=1;
ERROR HY000: Variable 'aria_log_dir_path' is a read only variable
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
COUNT(@@GLOBAL.aria_log_dir_path)
1
SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='aria_log_dir_path';
@@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
1
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
COUNT(@@GLOBAL.aria_log_dir_path)
1
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='aria_log_dir_path';
COUNT(VARIABLE_VALUE)
1
SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path;
@@aria_log_dir_path = @@GLOBAL.aria_log_dir_path
1
SELECT COUNT(@@aria_log_dir_path);
COUNT(@@aria_log_dir_path)
1
SELECT COUNT(@@local.aria_log_dir_path);
ERROR HY000: Variable 'aria_log_dir_path' is a GLOBAL variable
SELECT COUNT(@@SESSION.aria_log_dir_path);
ERROR HY000: Variable 'aria_log_dir_path' is a GLOBAL variable
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
COUNT(@@GLOBAL.aria_log_dir_path)
1
SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path;
ERROR 42S22: Unknown column 'aria_log_dir_path' in 'field list'
...@@ -85,6 +85,18 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -85,6 +85,18 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_DIR_PATH
SESSION_VALUE NULL
DEFAULT_VALUE DATADIR
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Path to the directory where to store transactional log
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_NAME ARIA_LOG_FILE_SIZE
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE 1073741824 DEFAULT_VALUE 1073741824
......
...@@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_DIR_PATH
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Path to the directory where to store transactional log
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_NAME ARIA_LOG_FILE_SIZE
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE BIGINT UNSIGNED
......
...@@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1 ...@@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_DIR_PATH
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Path to the directory where to store transactional log
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_LOG_FILE_SIZE VARIABLE_NAME ARIA_LOG_FILE_SIZE
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE BIGINT UNSIGNED
......
--source include/have_maria.inc
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.aria_log_dir_path=1;
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
SELECT @@GLOBAL.aria_log_dir_path = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='aria_log_dir_path';
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='aria_log_dir_path';
SELECT @@aria_log_dir_path = @@GLOBAL.aria_log_dir_path;
SELECT COUNT(@@aria_log_dir_path);
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@local.aria_log_dir_path);
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT COUNT(@@SESSION.aria_log_dir_path);
SELECT COUNT(@@GLOBAL.aria_log_dir_path);
--Error ER_BAD_FIELD_ERROR
SELECT aria_log_dir_path = @@SESSION.aria_log_dir_path;
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
--source include/have_aria_used_for_temp_tables.inc --source include/have_aria_used_for_temp_tables.inc
--source include/word_size.inc --source include/word_size.inc
let datadir=`select @@datadir`;
--vertical_results --vertical_results
--replace_result $datadir DATADIR
select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables
where variable_name like 'aria%' where variable_name like 'aria%'
order by variable_name; order by variable_name;
...@@ -188,7 +188,7 @@ static MYSQL_SYSVAR_BOOL(page_checksum, maria_page_checksums, 0, ...@@ -188,7 +188,7 @@ static MYSQL_SYSVAR_BOOL(page_checksum, maria_page_checksums, 0,
/* It is only command line argument */ /* It is only command line argument */
static MYSQL_SYSVAR_STR(log_dir_path, maria_data_root, static MYSQL_SYSVAR_STR(log_dir_path, maria_data_root,
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to the directory where to store transactional log", "Path to the directory where to store transactional log",
NULL, NULL, mysql_real_data_home); NULL, NULL, mysql_real_data_home);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment