mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
provide maria* aliases for aria* command-line options,
status and system variables
This commit is contained in:
@ -21,12 +21,9 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#ifndef _my_base_h
|
|
||||||
#include <my_base.h>
|
#include <my_base.h>
|
||||||
#endif
|
#include <my_sys.h>
|
||||||
#ifndef _m_ctype_h
|
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
#endif
|
|
||||||
#include "../storage/maria/ma_pagecache.h"
|
#include "../storage/maria/ma_pagecache.h"
|
||||||
#include "my_handler.h"
|
#include "my_handler.h"
|
||||||
#include "ft_global.h"
|
#include "ft_global.h"
|
||||||
@ -334,6 +331,12 @@ extern int maria_begin(MARIA_HA *info);
|
|||||||
extern void maria_disable_logging(MARIA_HA *info);
|
extern void maria_disable_logging(MARIA_HA *info);
|
||||||
extern void maria_enable_logging(MARIA_HA *info);
|
extern void maria_enable_logging(MARIA_HA *info);
|
||||||
|
|
||||||
|
#define HA_RECOVER_NONE 0 /* No automatic recover */
|
||||||
|
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
|
||||||
|
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
|
||||||
|
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
|
||||||
|
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
|
||||||
|
|
||||||
/* this is used to pass to mysql_mariachk_table */
|
/* this is used to pass to mysql_mariachk_table */
|
||||||
|
|
||||||
#define MARIA_CHK_REPAIR 1 /* equivalent to mariachk -r */
|
#define MARIA_CHK_REPAIR 1 /* equivalent to mariachk -r */
|
||||||
|
@ -257,7 +257,7 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd,
|
|||||||
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
|
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
|
||||||
MYSQL_PLUGIN_VAR_HEADER; \
|
MYSQL_PLUGIN_VAR_HEADER; \
|
||||||
type *value; \
|
type *value; \
|
||||||
const type def_val; \
|
type def_val; \
|
||||||
} MYSQL_SYSVAR_NAME(name)
|
} MYSQL_SYSVAR_NAME(name)
|
||||||
|
|
||||||
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
|
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
|
||||||
@ -279,7 +279,7 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd,
|
|||||||
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
|
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
|
||||||
MYSQL_PLUGIN_VAR_HEADER; \
|
MYSQL_PLUGIN_VAR_HEADER; \
|
||||||
int offset; \
|
int offset; \
|
||||||
const type def_val; \
|
type def_val; \
|
||||||
DECLARE_THDVAR_FUNC(type); \
|
DECLARE_THDVAR_FUNC(type); \
|
||||||
} MYSQL_SYSVAR_NAME(name)
|
} MYSQL_SYSVAR_NAME(name)
|
||||||
|
|
||||||
|
58
mysql-test/suite/maria/r/compat_aliases.result
Normal file
58
mysql-test/suite/maria/r/compat_aliases.result
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
select * from information_schema.plugins where plugin_name like '%aria';
|
||||||
|
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE PLUGIN_MATURITY PLUGIN_AUTH_VERSION
|
||||||
|
Maria 1.5 ACTIVE DAEMON 50202.0 NULL NULL Monty Program Ab Compatibility aliases for the Aria engine GPL Gamma 1.5
|
||||||
|
Aria 1.5 ACTIVE STORAGE ENGINE 50202.0 NULL NULL Monty Program Ab Crash-safe tables with MyISAM heritage GPL Gamma 1.5
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_variables as maria_vars left join
|
||||||
|
information_schema.session_variables as aria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where maria_vars.variable_name like 'maria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
variable_name variable_name
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_status as maria_vars left join
|
||||||
|
information_schema.session_status as aria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where maria_vars.variable_name like 'maria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
variable_name variable_name
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_variables as aria_vars left join
|
||||||
|
information_schema.session_variables as maria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where aria_vars.variable_name like 'aria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
variable_name variable_name
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_status as aria_vars left join
|
||||||
|
information_schema.session_status as maria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where aria_vars.variable_name like 'aria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
variable_name variable_name
|
||||||
|
set @old_checkpoint_interval=@@global.aria_checkpoint_interval;
|
||||||
|
set global maria_checkpoint_interval=10;
|
||||||
|
select @@global.aria_checkpoint_interval;
|
||||||
|
@@global.aria_checkpoint_interval
|
||||||
|
10
|
||||||
|
set global maria_checkpoint_interval=@old_checkpoint_interval;
|
||||||
|
set @old_sort_buffer_size=@@global.maria_sort_buffer_size;
|
||||||
|
set global aria_sort_buffer_size=1024;
|
||||||
|
select @@global.maria_sort_buffer_size;
|
||||||
|
@@global.maria_sort_buffer_size
|
||||||
|
1024
|
||||||
|
set global aria_sort_buffer_size=@old_sort_buffer_size;
|
||||||
|
set @old_sort_buffer_size=@@session.maria_sort_buffer_size;
|
||||||
|
set session aria_sort_buffer_size=2048;
|
||||||
|
select @@session.maria_sort_buffer_size;
|
||||||
|
@@session.maria_sort_buffer_size
|
||||||
|
2048
|
||||||
|
set session aria_sort_buffer_size=@old_sort_buffer_size;
|
||||||
|
set @old_max_sort_file_size=@@global.maria_max_sort_file_size,
|
||||||
|
@old_repair_threads=@@global.aria_repair_threads;
|
||||||
|
set @@global.maria_max_sort_file_size=default, @@global.aria_repair_threads=default;
|
||||||
|
select @@global.maria_max_sort_file_size, @@global.aria_repair_threads;
|
||||||
|
@@global.maria_max_sort_file_size @@global.aria_repair_threads
|
||||||
|
9223372036853727232 1
|
||||||
|
set @@global.aria_max_sort_file_size=@old_max_sort_file_size,
|
||||||
|
@@global.maria_repair_threads=@old_repair_threads;
|
8
mysql-test/suite/maria/suite.pm
Normal file
8
mysql-test/suite/maria/suite.pm
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package My::Suite::Maria;
|
||||||
|
|
||||||
|
@ISA = qw(My::Suite);
|
||||||
|
|
||||||
|
return "Need Aria engine" unless $::mysqld_variables{'aria'} eq "ON";
|
||||||
|
|
||||||
|
bless { };
|
||||||
|
|
1
mysql-test/suite/maria/t/compat_aliases-master.opt
Normal file
1
mysql-test/suite/maria/t/compat_aliases-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--maria-max-sort-file-size=100M --aria-repair-threads=10000
|
57
mysql-test/suite/maria/t/compat_aliases.test
Normal file
57
mysql-test/suite/maria/t/compat_aliases.test
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#
|
||||||
|
# test for maria* aliases (system variables, status variables,
|
||||||
|
# command-line options). They should match aria* variables.
|
||||||
|
#
|
||||||
|
|
||||||
|
select * from information_schema.plugins where plugin_name like '%aria';
|
||||||
|
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_variables as maria_vars left join
|
||||||
|
information_schema.session_variables as aria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where maria_vars.variable_name like 'maria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_status as maria_vars left join
|
||||||
|
information_schema.session_status as aria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where maria_vars.variable_name like 'maria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_variables as aria_vars left join
|
||||||
|
information_schema.session_variables as maria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where aria_vars.variable_name like 'aria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
|
||||||
|
select maria_vars.variable_name, aria_vars.variable_name from
|
||||||
|
information_schema.session_status as aria_vars left join
|
||||||
|
information_schema.session_status as maria_vars
|
||||||
|
on (maria_vars.variable_name = concat('m', aria_vars.variable_name))
|
||||||
|
where aria_vars.variable_name like 'aria_%'
|
||||||
|
and not (maria_vars.variable_value <=> aria_vars.variable_value);
|
||||||
|
|
||||||
|
set @old_checkpoint_interval=@@global.aria_checkpoint_interval;
|
||||||
|
set global maria_checkpoint_interval=10;
|
||||||
|
select @@global.aria_checkpoint_interval;
|
||||||
|
set global maria_checkpoint_interval=@old_checkpoint_interval;
|
||||||
|
|
||||||
|
set @old_sort_buffer_size=@@global.maria_sort_buffer_size;
|
||||||
|
set global aria_sort_buffer_size=1024;
|
||||||
|
select @@global.maria_sort_buffer_size;
|
||||||
|
set global aria_sort_buffer_size=@old_sort_buffer_size;
|
||||||
|
|
||||||
|
set @old_sort_buffer_size=@@session.maria_sort_buffer_size;
|
||||||
|
set session aria_sort_buffer_size=2048;
|
||||||
|
select @@session.maria_sort_buffer_size;
|
||||||
|
set session aria_sort_buffer_size=@old_sort_buffer_size;
|
||||||
|
|
||||||
|
set @old_max_sort_file_size=@@global.maria_max_sort_file_size,
|
||||||
|
@old_repair_threads=@@global.aria_repair_threads;
|
||||||
|
set @@global.maria_max_sort_file_size=default, @@global.aria_repair_threads=default;
|
||||||
|
select @@global.maria_max_sort_file_size, @@global.aria_repair_threads;
|
||||||
|
set @@global.aria_max_sort_file_size=@old_max_sort_file_size,
|
||||||
|
@@global.maria_repair_threads=@old_repair_threads;
|
||||||
|
|
@ -77,7 +77,7 @@ noinst_HEADERS = maria_def.h ma_rt_index.h ma_rt_key.h ma_rt_mbr.h \
|
|||||||
ma_checkpoint.h ma_recovery.h ma_commit.h ma_state.h \
|
ma_checkpoint.h ma_recovery.h ma_commit.h ma_state.h \
|
||||||
trnman_public.h ma_check_standalone.h \
|
trnman_public.h ma_check_standalone.h \
|
||||||
ma_key_recover.h ma_recovery_util.h \
|
ma_key_recover.h ma_recovery_util.h \
|
||||||
ma_servicethread.h
|
ma_servicethread.h compat_aliases.h
|
||||||
ma_test1_DEPENDENCIES= $(LIBRARIES)
|
ma_test1_DEPENDENCIES= $(LIBRARIES)
|
||||||
ma_test1_LDADD= @CLIENT_EXTRA_LDFLAGS@ libaria.a \
|
ma_test1_LDADD= @CLIENT_EXTRA_LDFLAGS@ libaria.a \
|
||||||
$(top_builddir)/storage/myisam/libmyisam.a \
|
$(top_builddir)/storage/myisam/libmyisam.a \
|
||||||
@ -140,7 +140,7 @@ libaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \
|
|||||||
ma_pagecache.c ma_pagecaches.c \
|
ma_pagecache.c ma_pagecaches.c \
|
||||||
ma_checkpoint.c ma_recovery.c ma_commit.c \
|
ma_checkpoint.c ma_recovery.c ma_commit.c \
|
||||||
ma_pagecrc.c ma_recovery_util.c \
|
ma_pagecrc.c ma_recovery_util.c \
|
||||||
ha_maria.cc ma_servicethread.c
|
ha_maria.cc compat_aliases.cc ma_servicethread.c
|
||||||
CLEANFILES = test?.MA? FT?.MA? isam.log ma_test_all ma_rt_test.MA? sp_test.MA? aria_log_control aria_log.0000*
|
CLEANFILES = test?.MA? FT?.MA? isam.log ma_test_all ma_rt_test.MA? sp_test.MA? aria_log_control aria_log.0000*
|
||||||
|
|
||||||
SUFFIXES = .sh
|
SUFFIXES = .sh
|
||||||
|
245
storage/maria/compat_aliases.cc
Normal file
245
storage/maria/compat_aliases.cc
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
/* Copyright (C) 2010 Monty Program Ab
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
/*
|
||||||
|
compatibility aliases for system and static variables
|
||||||
|
*/
|
||||||
|
#include <my_global.h>
|
||||||
|
#include <maria.h>
|
||||||
|
#include <mysql/plugin.h>
|
||||||
|
#include "ma_loghandler.h"
|
||||||
|
#include "compat_aliases.h"
|
||||||
|
|
||||||
|
ulong block_size_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(block_size, block_size_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
|
||||||
|
"Deprecated, use --aria-block-size instead", 0, 0,
|
||||||
|
MARIA_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH,
|
||||||
|
MARIA_MAX_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH);
|
||||||
|
|
||||||
|
ulong checkpoint_interval_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(checkpoint_interval, checkpoint_interval_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-checkpoint-interval instead",
|
||||||
|
NULL, NULL, 30, 0, UINT_MAX, 1);
|
||||||
|
|
||||||
|
ulong force_start_after_recovery_failures_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(force_start_after_recovery_failures, force_start_after_recovery_failures_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
|
||||||
|
"Deprecated, use --aria-force-start-after-recovery-failures instead",
|
||||||
|
NULL, NULL, 0, 0, UINT_MAX8, 1);
|
||||||
|
|
||||||
|
my_bool page_checksum_alias;
|
||||||
|
static MYSQL_SYSVAR_BOOL(page_checksum, page_checksum_alias, 0,
|
||||||
|
"Deprecated, use --aria-page-checksum instead", 0, 0, 1);
|
||||||
|
|
||||||
|
char *log_dir_path_alias;
|
||||||
|
static MYSQL_SYSVAR_STR(log_dir_path, log_dir_path_alias,
|
||||||
|
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
|
||||||
|
"Deprecated, use --aria-log-dir-path instead",
|
||||||
|
NULL, NULL, mysql_real_data_home);
|
||||||
|
|
||||||
|
ulong log_file_size_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(log_file_size, log_file_size_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-log-file-size instead",
|
||||||
|
NULL, NULL, TRANSLOG_FILE_SIZE,
|
||||||
|
TRANSLOG_MIN_FILE_SIZE, 0xffffffffL, TRANSLOG_PAGE_SIZE);
|
||||||
|
|
||||||
|
ulong group_commit_alias;
|
||||||
|
static MYSQL_SYSVAR_ENUM(group_commit, group_commit_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-group-commit instead",
|
||||||
|
NULL, NULL,
|
||||||
|
TRANSLOG_GCOMMIT_NONE, &maria_group_commit_typelib);
|
||||||
|
|
||||||
|
ulong group_commit_interval_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(group_commit_interval, group_commit_interval_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-group-commit-interval instead",
|
||||||
|
NULL, NULL, 0, 0, UINT_MAX, 1);
|
||||||
|
|
||||||
|
ulong log_purge_type_alias;
|
||||||
|
static MYSQL_SYSVAR_ENUM(log_purge_type, log_purge_type_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-log-purge-type instead",
|
||||||
|
NULL, NULL, TRANSLOG_PURGE_IMMIDIATE,
|
||||||
|
&maria_translog_purge_type_typelib);
|
||||||
|
|
||||||
|
ulonglong max_sort_file_size_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONGLONG(max_sort_file_size, max_sort_file_size_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-max-temp-length instead",
|
||||||
|
0, 0, MAX_FILE_SIZE, 0, MAX_FILE_SIZE, 1024*1024);
|
||||||
|
|
||||||
|
ulong pagecache_age_threshold_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(pagecache_age_threshold, pagecache_age_threshold_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-pagecache-age-threshold instead",
|
||||||
|
0, 0, 300, 100, ~0L, 100);
|
||||||
|
|
||||||
|
ulonglong pagecache_buffer_size_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONGLONG(pagecache_buffer_size, pagecache_buffer_size_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
|
||||||
|
"Deprecated, use --aria-pagecache-buffer-size instead",
|
||||||
|
0, 0, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~0UL, IO_SIZE);
|
||||||
|
|
||||||
|
ulong pagecache_division_limit_alias;
|
||||||
|
static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-pagecache-division-limit instead",
|
||||||
|
0, 0, 100, 1, 100, 1);
|
||||||
|
|
||||||
|
ulong recover_alias;
|
||||||
|
static MYSQL_SYSVAR_ENUM(recover, recover_alias, PLUGIN_VAR_OPCMDARG,
|
||||||
|
"Deprecated, use --aria-recover instead",
|
||||||
|
NULL, NULL, HA_RECOVER_DEFAULT, &maria_recover_typelib);
|
||||||
|
|
||||||
|
ulong repair_threads_alias;
|
||||||
|
static MYSQL_THDVAR_ULONG(repair_threads, PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-repair-threads instead",
|
||||||
|
0, 0, 1, 1, ~0L, 1);
|
||||||
|
|
||||||
|
ulong sort_buffer_size_alias;
|
||||||
|
static MYSQL_THDVAR_ULONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-sort-buffer-size instead",
|
||||||
|
0, 0, 128L*1024L*1024L, 4, ~0L, 1);
|
||||||
|
|
||||||
|
ulong stats_method_alias;
|
||||||
|
static MYSQL_THDVAR_ENUM(stats_method, PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-stats-method instead",
|
||||||
|
0, 0, 0, &maria_stats_method_typelib);
|
||||||
|
|
||||||
|
ulong sync_log_dir_alias;
|
||||||
|
static MYSQL_SYSVAR_ENUM(sync_log_dir, sync_log_dir_alias,
|
||||||
|
PLUGIN_VAR_RQCMDARG,
|
||||||
|
"Deprecated, use --aria-sync-log-dir instead",
|
||||||
|
NULL, NULL, TRANSLOG_SYNC_DIR_NEWFILE,
|
||||||
|
&maria_sync_log_dir_typelib);
|
||||||
|
|
||||||
|
my_bool used_for_temp_tables_alias= 1;
|
||||||
|
static MYSQL_SYSVAR_BOOL(used_for_temp_tables,
|
||||||
|
used_for_temp_tables_alias, PLUGIN_VAR_READONLY | PLUGIN_VAR_NOCMDOPT,
|
||||||
|
NULL, 0, 0, 1);
|
||||||
|
|
||||||
|
static struct st_mysql_show_var status_variables_aliases[]= {
|
||||||
|
{"Maria", (char*) &status_variables, SHOW_ARRAY},
|
||||||
|
{NullS, NullS, SHOW_LONG}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
There is one problem with aliases for command-line options.
|
||||||
|
Plugin initialization works like this
|
||||||
|
|
||||||
|
for all plugins:
|
||||||
|
prepare command-line options
|
||||||
|
initialize command-line option variables to the default values
|
||||||
|
parse command line, assign values as necessary
|
||||||
|
|
||||||
|
for all plugins:
|
||||||
|
call the plugin initialization function
|
||||||
|
|
||||||
|
it means, we cannot have maria* and aria* command-line options to use
|
||||||
|
the same underlying variables - because after assigning maria* values,
|
||||||
|
MySQL will put there default values again preparing for parsing aria*
|
||||||
|
values. So, maria* values will be lost.
|
||||||
|
|
||||||
|
So, we create separate set of variables for maria* options,
|
||||||
|
and take both values into account in ha_maria_init().
|
||||||
|
|
||||||
|
When the command line was parsed, we patch maria* options
|
||||||
|
to use the same variables as aria* options so that
|
||||||
|
set @@maria_some_var would have the same value as @@aria_some_var
|
||||||
|
without forcing us to copy the values around all the time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static struct st_mysql_sys_var* system_variables_aliases[]= {
|
||||||
|
MYSQL_SYSVAR(block_size),
|
||||||
|
MYSQL_SYSVAR(checkpoint_interval),
|
||||||
|
MYSQL_SYSVAR(force_start_after_recovery_failures),
|
||||||
|
MYSQL_SYSVAR(group_commit),
|
||||||
|
MYSQL_SYSVAR(group_commit_interval),
|
||||||
|
MYSQL_SYSVAR(log_dir_path),
|
||||||
|
MYSQL_SYSVAR(log_file_size),
|
||||||
|
MYSQL_SYSVAR(log_purge_type),
|
||||||
|
MYSQL_SYSVAR(max_sort_file_size),
|
||||||
|
MYSQL_SYSVAR(page_checksum),
|
||||||
|
MYSQL_SYSVAR(pagecache_age_threshold),
|
||||||
|
MYSQL_SYSVAR(pagecache_buffer_size),
|
||||||
|
MYSQL_SYSVAR(pagecache_division_limit),
|
||||||
|
MYSQL_SYSVAR(recover),
|
||||||
|
MYSQL_SYSVAR(repair_threads),
|
||||||
|
MYSQL_SYSVAR(sort_buffer_size),
|
||||||
|
MYSQL_SYSVAR(stats_method),
|
||||||
|
MYSQL_SYSVAR(sync_log_dir),
|
||||||
|
MYSQL_SYSVAR(used_for_temp_tables),
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#define COPY_SYSVAR(name) \
|
||||||
|
memcpy(&MYSQL_SYSVAR_NAME(name), system_variables[i++], \
|
||||||
|
sizeof(MYSQL_SYSVAR_NAME(name))); \
|
||||||
|
if (name ## _alias != MYSQL_SYSVAR_NAME(name).def_val && \
|
||||||
|
*MYSQL_SYSVAR_NAME(name).value == MYSQL_SYSVAR_NAME(name).def_val) \
|
||||||
|
*MYSQL_SYSVAR_NAME(name).value= name ## _alias;
|
||||||
|
|
||||||
|
#define COPY_THDVAR(name) \
|
||||||
|
name ## _alias= THDVAR(0, name); \
|
||||||
|
memcpy(&MYSQL_SYSVAR_NAME(name), system_variables[i++], \
|
||||||
|
sizeof(MYSQL_SYSVAR_NAME(name))); \
|
||||||
|
if (name ## _alias != MYSQL_SYSVAR_NAME(name).def_val && \
|
||||||
|
THDVAR(0, name) == MYSQL_SYSVAR_NAME(name).def_val) \
|
||||||
|
THDVAR(0, name)= name ## _alias;
|
||||||
|
|
||||||
|
void copy_variable_aliases()
|
||||||
|
{
|
||||||
|
int i= 0;
|
||||||
|
COPY_SYSVAR(block_size);
|
||||||
|
COPY_SYSVAR(checkpoint_interval);
|
||||||
|
COPY_SYSVAR(force_start_after_recovery_failures);
|
||||||
|
COPY_SYSVAR(group_commit);
|
||||||
|
COPY_SYSVAR(group_commit_interval);
|
||||||
|
COPY_SYSVAR(log_dir_path);
|
||||||
|
COPY_SYSVAR(log_file_size);
|
||||||
|
COPY_SYSVAR(log_purge_type);
|
||||||
|
COPY_SYSVAR(max_sort_file_size);
|
||||||
|
COPY_SYSVAR(page_checksum);
|
||||||
|
COPY_SYSVAR(pagecache_age_threshold);
|
||||||
|
COPY_SYSVAR(pagecache_buffer_size);
|
||||||
|
COPY_SYSVAR(pagecache_division_limit);
|
||||||
|
COPY_SYSVAR(recover);
|
||||||
|
COPY_THDVAR(repair_threads);
|
||||||
|
COPY_THDVAR(sort_buffer_size);
|
||||||
|
COPY_THDVAR(stats_method);
|
||||||
|
COPY_SYSVAR(sync_log_dir);
|
||||||
|
COPY_SYSVAR(used_for_temp_tables);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct st_maria_plugin compat_aliases= {
|
||||||
|
MYSQL_DAEMON_PLUGIN,
|
||||||
|
&maria_storage_engine,
|
||||||
|
"Maria",
|
||||||
|
"Monty Program Ab",
|
||||||
|
"Compatibility aliases for the Aria engine",
|
||||||
|
PLUGIN_LICENSE_GPL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0x0105,
|
||||||
|
status_variables_aliases,
|
||||||
|
system_variables_aliases,
|
||||||
|
"1.5",
|
||||||
|
MariaDB_PLUGIN_MATURITY_GAMMA
|
||||||
|
};
|
||||||
|
|
27
storage/maria/compat_aliases.h
Normal file
27
storage/maria/compat_aliases.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* Copyright (C) 2010 Monty Program Ab
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
extern struct st_maria_plugin compat_aliases;
|
||||||
|
extern char mysql_real_data_home[FN_REFLEN];
|
||||||
|
extern TYPELIB maria_recover_typelib;
|
||||||
|
extern TYPELIB maria_stats_method_typelib;
|
||||||
|
extern TYPELIB maria_translog_purge_type_typelib;
|
||||||
|
extern TYPELIB maria_sync_log_dir_typelib;
|
||||||
|
extern TYPELIB maria_group_commit_typelib;
|
||||||
|
extern struct st_mysql_storage_engine maria_storage_engine;
|
||||||
|
extern my_bool use_maria_for_temp_tables;
|
||||||
|
extern struct st_mysql_sys_var* system_variables[];
|
||||||
|
extern st_mysql_show_var status_variables[];
|
||||||
|
void copy_variable_aliases();
|
@ -29,6 +29,7 @@
|
|||||||
#include "ha_maria.h"
|
#include "ha_maria.h"
|
||||||
#include "trnman_public.h"
|
#include "trnman_public.h"
|
||||||
#include "trnman.h"
|
#include "trnman.h"
|
||||||
|
#include "compat_aliases.h"
|
||||||
|
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
#include "maria_def.h"
|
#include "maria_def.h"
|
||||||
@ -202,7 +203,7 @@ static MYSQL_SYSVAR_ULONG(group_commit_interval, maria_group_commit_interval,
|
|||||||
|
|
||||||
static MYSQL_SYSVAR_ENUM(log_purge_type, log_purge_type,
|
static MYSQL_SYSVAR_ENUM(log_purge_type, log_purge_type,
|
||||||
PLUGIN_VAR_RQCMDARG,
|
PLUGIN_VAR_RQCMDARG,
|
||||||
"Specifies how aria transactional log will be purged. "
|
"Specifies how Aria transactional log will be purged. "
|
||||||
"Possible values of name are \"immediate\", \"external\" "
|
"Possible values of name are \"immediate\", \"external\" "
|
||||||
"and \"at_flush\"",
|
"and \"at_flush\"",
|
||||||
NULL, NULL, TRANSLOG_PURGE_IMMIDIATE,
|
NULL, NULL, TRANSLOG_PURGE_IMMIDIATE,
|
||||||
@ -212,7 +213,7 @@ static MYSQL_SYSVAR_ULONGLONG(max_sort_file_size,
|
|||||||
maria_max_temp_length, PLUGIN_VAR_RQCMDARG,
|
maria_max_temp_length, PLUGIN_VAR_RQCMDARG,
|
||||||
"Don't use the fast sort index method to created index if the "
|
"Don't use the fast sort index method to created index if the "
|
||||||
"temporary file would get bigger than this.",
|
"temporary file would get bigger than this.",
|
||||||
0, 0, MAX_FILE_SIZE, 0, MAX_FILE_SIZE, 1024*1024);
|
0, 0, MAX_FILE_SIZE & ~(1*MB-1), 0, MAX_FILE_SIZE, 1*MB);
|
||||||
|
|
||||||
static MYSQL_SYSVAR_ULONG(pagecache_age_threshold,
|
static MYSQL_SYSVAR_ULONG(pagecache_age_threshold,
|
||||||
pagecache_age_threshold, PLUGIN_VAR_RQCMDARG,
|
pagecache_age_threshold, PLUGIN_VAR_RQCMDARG,
|
||||||
@ -227,7 +228,7 @@ static MYSQL_SYSVAR_ULONGLONG(pagecache_buffer_size, pagecache_buffer_size,
|
|||||||
"The size of the buffer used for index blocks for Aria tables. "
|
"The size of the buffer used for index blocks for Aria tables. "
|
||||||
"Increase this to get better index handling (for all reads and "
|
"Increase this to get better index handling (for all reads and "
|
||||||
"multiple writes) to as much as you can afford.", 0, 0,
|
"multiple writes) to as much as you can afford.", 0, 0,
|
||||||
KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, IO_SIZE);
|
KEY_CACHE_SIZE, 0, ~(ulong) 0, 1);
|
||||||
|
|
||||||
static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit,
|
static MYSQL_SYSVAR_ULONG(pagecache_division_limit, pagecache_division_limit,
|
||||||
PLUGIN_VAR_RQCMDARG,
|
PLUGIN_VAR_RQCMDARG,
|
||||||
@ -262,10 +263,11 @@ static MYSQL_SYSVAR_ENUM(sync_log_dir, sync_log_dir, PLUGIN_VAR_RQCMDARG,
|
|||||||
&maria_sync_log_dir_typelib);
|
&maria_sync_log_dir_typelib);
|
||||||
|
|
||||||
#ifdef USE_MARIA_FOR_TMP_TABLES
|
#ifdef USE_MARIA_FOR_TMP_TABLES
|
||||||
static my_bool use_maria_for_temp_tables= 1;
|
#define USE_MARIA_FOR_TMP_TABLES_VAL 1
|
||||||
#else
|
#else
|
||||||
static my_bool use_maria_for_temp_tables= 0;
|
#define USE_MARIA_FOR_TMP_TABLES_VAL 0
|
||||||
#endif
|
#endif
|
||||||
|
my_bool use_maria_for_temp_tables= USE_MARIA_FOR_TMP_TABLES_VAL;
|
||||||
|
|
||||||
static MYSQL_SYSVAR_BOOL(used_for_temp_tables,
|
static MYSQL_SYSVAR_BOOL(used_for_temp_tables,
|
||||||
use_maria_for_temp_tables, PLUGIN_VAR_READONLY | PLUGIN_VAR_NOCMDOPT,
|
use_maria_for_temp_tables, PLUGIN_VAR_READONLY | PLUGIN_VAR_NOCMDOPT,
|
||||||
@ -3272,6 +3274,7 @@ bool ha_maria::is_changed() const
|
|||||||
static int ha_maria_init(void *p)
|
static int ha_maria_init(void *p)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
copy_variable_aliases();
|
||||||
const char *log_dir= maria_data_root;
|
const char *log_dir= maria_data_root;
|
||||||
maria_hton= (handlerton *)p;
|
maria_hton= (handlerton *)p;
|
||||||
maria_hton->state= SHOW_OPTION_YES;
|
maria_hton->state= SHOW_OPTION_YES;
|
||||||
@ -3388,7 +3391,7 @@ my_bool ha_maria::register_query_cache_table(THD *thd, char *table_name,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct st_mysql_sys_var* system_variables[]= {
|
struct st_mysql_sys_var* system_variables[]= {
|
||||||
MYSQL_SYSVAR(block_size),
|
MYSQL_SYSVAR(block_size),
|
||||||
MYSQL_SYSVAR(checkpoint_interval),
|
MYSQL_SYSVAR(checkpoint_interval),
|
||||||
MYSQL_SYSVAR(force_start_after_recovery_failures),
|
MYSQL_SYSVAR(force_start_after_recovery_failures),
|
||||||
@ -3524,38 +3527,28 @@ static void update_log_file_size(MYSQL_THD thd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SHOW_VAR status_variables[]= {
|
SHOW_VAR status_variables[]= {
|
||||||
{"Aria_pagecache_blocks_not_flushed", (char*) &maria_pagecache_var.global_blocks_changed, SHOW_LONG_NOFLUSH},
|
{"pagecache_blocks_not_flushed", (char*) &maria_pagecache_var.global_blocks_changed, SHOW_LONG_NOFLUSH},
|
||||||
{"Aria_pagecache_blocks_unused", (char*) &maria_pagecache_var.blocks_unused, SHOW_LONG_NOFLUSH},
|
{"pagecache_blocks_unused", (char*) &maria_pagecache_var.blocks_unused, SHOW_LONG_NOFLUSH},
|
||||||
{"Aria_pagecache_blocks_used", (char*) &maria_pagecache_var.blocks_used, SHOW_LONG_NOFLUSH},
|
{"pagecache_blocks_used", (char*) &maria_pagecache_var.blocks_used, SHOW_LONG_NOFLUSH},
|
||||||
{"Aria_pagecache_read_requests", (char*) &maria_pagecache_var.global_cache_r_requests, SHOW_LONGLONG},
|
{"pagecache_read_requests", (char*) &maria_pagecache_var.global_cache_r_requests, SHOW_LONGLONG},
|
||||||
{"Aria_pagecache_reads", (char*) &maria_pagecache_var.global_cache_read, SHOW_LONGLONG},
|
{"pagecache_reads", (char*) &maria_pagecache_var.global_cache_read, SHOW_LONGLONG},
|
||||||
{"Aria_pagecache_write_requests", (char*) &maria_pagecache_var.global_cache_w_requests, SHOW_LONGLONG},
|
{"pagecache_write_requests", (char*) &maria_pagecache_var.global_cache_w_requests, SHOW_LONGLONG},
|
||||||
{"Aria_pagecache_writes", (char*) &maria_pagecache_var.global_cache_write, SHOW_LONGLONG},
|
{"pagecache_writes", (char*) &maria_pagecache_var.global_cache_write, SHOW_LONGLONG},
|
||||||
{"Aria_transaction_log_syncs", (char*) &translog_syncs, SHOW_LONGLONG},
|
{"transaction_log_syncs", (char*) &translog_syncs, SHOW_LONGLONG},
|
||||||
|
{NullS, NullS, SHOW_LONG}
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct st_mysql_show_var aria_status_variables[]= {
|
||||||
|
{"Aria", (char*) &status_variables, SHOW_ARRAY},
|
||||||
{NullS, NullS, SHOW_LONG}
|
{NullS, NullS, SHOW_LONG}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct st_mysql_storage_engine maria_storage_engine=
|
struct st_mysql_storage_engine maria_storage_engine=
|
||||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
||||||
|
|
||||||
mysql_declare_plugin(aria)
|
|
||||||
{
|
|
||||||
MYSQL_STORAGE_ENGINE_PLUGIN,
|
|
||||||
&maria_storage_engine,
|
|
||||||
"Aria",
|
|
||||||
"Monty Program Ab",
|
|
||||||
"Crash-safe tables with MyISAM heritage",
|
|
||||||
PLUGIN_LICENSE_GPL,
|
|
||||||
ha_maria_init, /* Plugin Init */
|
|
||||||
NULL, /* Plugin Deinit */
|
|
||||||
0x0105, /* 1.5 */
|
|
||||||
status_variables, /* status variables */
|
|
||||||
system_variables, /* system variables */
|
|
||||||
NULL
|
|
||||||
}
|
|
||||||
mysql_declare_plugin_end;
|
|
||||||
maria_declare_plugin(aria)
|
maria_declare_plugin(aria)
|
||||||
|
compat_aliases,
|
||||||
{
|
{
|
||||||
MYSQL_STORAGE_ENGINE_PLUGIN,
|
MYSQL_STORAGE_ENGINE_PLUGIN,
|
||||||
&maria_storage_engine,
|
&maria_storage_engine,
|
||||||
@ -3563,12 +3556,12 @@ maria_declare_plugin(aria)
|
|||||||
"Monty Program Ab",
|
"Monty Program Ab",
|
||||||
"Crash-safe tables with MyISAM heritage",
|
"Crash-safe tables with MyISAM heritage",
|
||||||
PLUGIN_LICENSE_GPL,
|
PLUGIN_LICENSE_GPL,
|
||||||
ha_maria_init, /* Plugin Init */
|
ha_maria_init, /* Plugin Init */
|
||||||
NULL, /* Plugin Deinit */
|
NULL, /* Plugin Deinit */
|
||||||
0x0105, /* 1.5 */
|
0x0105, /* 1.5 */
|
||||||
status_variables, /* status variables */
|
aria_status_variables, /* status variables */
|
||||||
system_variables, /* system variables */
|
system_variables, /* system variables */
|
||||||
"1.5", /* string version */
|
"1.5", /* string version */
|
||||||
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
||||||
}
|
}
|
||||||
maria_declare_plugin_end;
|
maria_declare_plugin_end;
|
||||||
|
@ -22,12 +22,6 @@
|
|||||||
|
|
||||||
#include <maria.h>
|
#include <maria.h>
|
||||||
|
|
||||||
#define HA_RECOVER_NONE 0 /* No automatic recover */
|
|
||||||
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
|
|
||||||
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
|
|
||||||
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
|
|
||||||
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
|
|
||||||
|
|
||||||
extern ulong maria_sort_buffer_size;
|
extern ulong maria_sort_buffer_size;
|
||||||
extern TYPELIB maria_recover_typelib;
|
extern TYPELIB maria_recover_typelib;
|
||||||
extern ulong maria_recover_options;
|
extern ulong maria_recover_options;
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
#ifndef _ma_loghandler_h
|
#ifndef _ma_loghandler_h
|
||||||
#define _ma_loghandler_h
|
#define _ma_loghandler_h
|
||||||
|
|
||||||
|
#define MB (1024UL*1024)
|
||||||
|
|
||||||
/* transaction log default cache size (TODO: make it global variable) */
|
/* transaction log default cache size (TODO: make it global variable) */
|
||||||
#define TRANSLOG_PAGECACHE_SIZE (1024U*1024*2)
|
#define TRANSLOG_PAGECACHE_SIZE (2*MB)
|
||||||
/* transaction log default file size */
|
/* transaction log default file size */
|
||||||
#define TRANSLOG_FILE_SIZE (1024U*1024*1024)
|
#define TRANSLOG_FILE_SIZE (1024U*MB)
|
||||||
/* minimum possible transaction log size */
|
/* minimum possible transaction log size */
|
||||||
#define TRANSLOG_MIN_FILE_SIZE (1024U*1024*8)
|
#define TRANSLOG_MIN_FILE_SIZE (8*MB)
|
||||||
/* transaction log default flags (TODO: make it global variable) */
|
/* transaction log default flags (TODO: make it global variable) */
|
||||||
#define TRANSLOG_DEFAULT_FLAGS 0
|
#define TRANSLOG_DEFAULT_FLAGS 0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user