diff options
author | Alexander Barkov <bar@mariadb.com> | 2023-03-31 05:41:00 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2023-04-04 16:05:55 +0400 |
commit | 8f9bb82640578054feeb67a775410989d28626a3 (patch) | |
tree | 55504bc900f8283418c5987dcc7fe3580737656c | |
parent | 8020b1bd735c686818f1563e2c2317e263d5bd3a (diff) | |
download | mariadb-git-8f9bb82640578054feeb67a775410989d28626a3.tar.gz |
MDEV-30971 Add a new system variable aria_data_home_dir
-rw-r--r-- | mysql-test/suite/maria/aria_log_dir_path.result | 29 | ||||
-rw-r--r-- | mysql-test/suite/maria/aria_log_dir_path.test | 65 | ||||
-rw-r--r-- | mysql-test/suite/maria/maria3.result | 1 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result | 36 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/sysvars_aria.result | 12 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/sysvars_server_embedded.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test | 35 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/sysvars_aria.test | 4 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 2 |
10 files changed, 203 insertions, 1 deletions
diff --git a/mysql-test/suite/maria/aria_log_dir_path.result b/mysql-test/suite/maria/aria_log_dir_path.result new file mode 100644 index 00000000000..0a4201544a5 --- /dev/null +++ b/mysql-test/suite/maria/aria_log_dir_path.result @@ -0,0 +1,29 @@ +# +# 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 diff --git a/mysql-test/suite/maria/aria_log_dir_path.test b/mysql-test/suite/maria/aria_log_dir_path.test new file mode 100644 index 00000000000..bc0a31a76b9 --- /dev/null +++ b/mysql-test/suite/maria/aria_log_dir_path.test @@ -0,0 +1,65 @@ +--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 diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result index 47a6ecaf4bb..4d64033a9c9 100644 --- a/mysql-test/suite/maria/maria3.result +++ b/mysql-test/suite/maria/maria3.result @@ -311,6 +311,7 @@ aria_encrypt_tables # aria_force_start_after_recovery_failures # aria_group_commit # aria_group_commit_interval # +aria_log_dir_path # aria_log_file_size # aria_log_purge_type # aria_max_sort_file_size # diff --git a/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result b/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result new file mode 100644 index 00000000000..8563b024a75 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/aria_log_dir_path_basic.result @@ -0,0 +1,36 @@ +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' diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result index 7b74c85b6da..9f5585668b6 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria.result +++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result @@ -85,6 +85,18 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO 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 SESSION_VALUE NULL DEFAULT_VALUE 1073741824 diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 9e562426291..9454f1b9d96 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO 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_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index b9e4aac3288..27e5daf7615 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -102,6 +102,16 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO 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_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED diff --git a/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test new file mode 100644 index 00000000000..f09705e6f0d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/aria_log_dir_path_basic.test @@ -0,0 +1,35 @@ +--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; diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.test b/mysql-test/suite/sys_vars/t/sysvars_aria.test index b01e39eebf5..b042f1010f4 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_aria.test +++ b/mysql-test/suite/sys_vars/t/sysvars_aria.test @@ -2,7 +2,11 @@ --source include/have_aria_used_for_temp_tables.inc --source include/word_size.inc +let datadir=`select @@datadir`; + --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 where variable_name like 'aria%' order by variable_name; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 0c9db691ca5..2d6c8f85fe4 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -188,7 +188,7 @@ static MYSQL_SYSVAR_BOOL(page_checksum, maria_page_checksums, 0, /* It is only command line argument */ 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", NULL, NULL, mysql_real_data_home); |