summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-02-24 17:38:14 +0200
committerMonty <monty@mariadb.org>2020-03-24 21:00:04 +0200
commit8eba777c2bbad7721c818936a3a0ced3b2fcd59c (patch)
tree72863d1d5715c7d3963cce154d78129eb43e2532
parent324e42fbdc0d9d976788498ab242cb3fd60ef803 (diff)
downloadmariadb-git-8eba777c2bbad7721c818936a3a0ced3b2fcd59c.tar.gz
mysqld --help will now load mysqld.options table
Changes: - Initalize Aria early to allow it to load mysql.plugin table with --help - Don't print 'aborting' when doing --help - Don't write 'loose' error messages on log_warning < 2 (2 is default) - Don't write warnings about disabled plugings when doing --help - Don't write aria_log_control or aria log files when doing --help - When using --help, open all Aria tables in read only mode (safety) - If aria_init() fails, do a cleanup(). (Frees used memory) - If aria_log_control is locked with --help, then don't wait 30 seconds but instead return at once without initialzing Aria plugin.
-rw-r--r--mysql-test/main/mysqld--help2.result12
-rw-r--r--mysql-test/main/mysqld--help2.test39
-rw-r--r--sql/mysqld.cc14
-rw-r--r--sql/sql_plugin.cc26
-rw-r--r--storage/maria/ha_maria.cc51
-rw-r--r--storage/maria/ma_control_file.c19
-rw-r--r--storage/maria/ma_control_file.h4
-rw-r--r--storage/maria/ma_init.c5
-rw-r--r--storage/maria/ma_rt_test.c2
-rw-r--r--storage/maria/ma_static.c1
-rw-r--r--storage/maria/ma_test1.c2
-rw-r--r--storage/maria/ma_test2.c2
-rw-r--r--storage/maria/maria_chk.c3
-rw-r--r--storage/maria/maria_def.h2
-rw-r--r--storage/maria/maria_read_log.c2
-rw-r--r--storage/maria/test_ma_backup.c2
-rw-r--r--storage/maria/trnman.c2
-rw-r--r--storage/maria/trnman.h1
-rw-r--r--storage/maria/unittest/ma_control_file-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_first_lsn-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_max_lsn-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multigroup-t.c4
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multithread-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_noflush-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_nologs-t.c4
-rw-r--r--storage/maria/unittest/ma_test_loghandler_pagecache-t.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_purge-t.c2
28 files changed, 163 insertions, 50 deletions
diff --git a/mysql-test/main/mysqld--help2.result b/mysql-test/main/mysqld--help2.result
new file mode 100644
index 00000000000..08dc5de68d0
--- /dev/null
+++ b/mysql-test/main/mysqld--help2.result
@@ -0,0 +1,12 @@
+[ERROR] mysqld: Can't lock aria aria_log_control for exclusive use, error: #. Will retry for 0 seconds
+[ERROR] Plugin 'Aria' init function returned error.
+[ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
+[Warning] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some options may be missing from the help text
+#
+# Check that we don't write any data to wrong or not existing datadir
+#
+[Warning] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some options may be missing from the help text
+#
+# Check with existing directory
+#
+[Warning] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some options may be missing from the help text
diff --git a/mysql-test/main/mysqld--help2.test b/mysql-test/main/mysqld--help2.test
new file mode 100644
index 00000000000..953a2b97e8d
--- /dev/null
+++ b/mysql-test/main/mysqld--help2.test
@@ -0,0 +1,39 @@
+#
+# Check errors from mysqld--help when providing different datadir
+#
+
+# We can't run this test on windows as windows doesn't provide file locking
+# which the first exec requires.
+
+--source include/not_windows.inc
+
+--let $args=--table-cache=5 --max-connections=10 --log-warnings=1 --silent-startup --help --verbose
+
+--exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err
+--replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /control file '.*aria_log_control'/aria_log_control/ /error: \d+/error: #/
+--cat_file $MYSQL_TMP_DIR/mysqld--help2.err
+
+--echo #
+--echo # Check that we don't write any data to wrong or not existing datadir
+--echo #
+
+--exec $MYSQLD_CMD $args --datadir=$MYSQL_TMP_DIR/help > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err
+--replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* //
+--cat_file $MYSQL_TMP_DIR/mysqld--help2.err
+
+--echo #
+--echo # Check with existing directory
+--echo #
+
+--mkdir $MYSQL_TMP_DIR/help
+--exec $MYSQLD_CMD $args --datadir=$MYSQL_TMP_DIR/help > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err
+--replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* //
+--cat_file $MYSQL_TMP_DIR/mysqld--help2.err
+--list_files $MYSQL_TMP_DIR/help
+
+#
+# Cleanup
+#
+--rmdir $MYSQL_TMP_DIR/help
+--remove_file $MYSQL_TMP_DIR/mysqld--help2.txt
+--remove_file $MYSQL_TMP_DIR/mysqld--help2.err
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e2fff60db3b..7cf85b72d71 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1873,7 +1873,7 @@ extern "C" void unireg_abort(int exit_code)
if (opt_help)
usage();
- if (exit_code)
+ else if (exit_code)
sql_print_error("Aborting");
/* Don't write more notes to the log to not hide error message */
disable_log_notes= 1;
@@ -8557,9 +8557,15 @@ static void option_error_reporter(enum loglevel level, const char *format, ...)
va_list args;
va_start(args, format);
- /* Don't print warnings for --loose options during bootstrap */
- if (level == ERROR_LEVEL || !opt_bootstrap ||
- global_system_variables.log_warnings)
+ /*
+ Don't print warnings for --loose options during bootstrap if
+ log_warnings <= 2 (2 is default) as warnings during bootstrap
+ can confuse people when running mysql_install_db and other scripts.
+ Don't print loose warnings at all if log_warnings <= 1
+ */
+ if (level == ERROR_LEVEL ||
+ (global_system_variables.log_warnings >
+ (ulong) (1 + MY_TEST(opt_bootstrap))))
{
vprint_msg_to_log(level, format, args);
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 58619651bf1..c5271173717 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1592,8 +1592,9 @@ int plugin_init(int *argc, char **argv, int flags)
struct st_plugin_int tmp, *plugin_ptr, **reap;
MEM_ROOT tmp_root;
bool reaped_mandatory_plugin= false;
- bool mandatory= true;
+ bool mandatory= true, aria_loaded= 0;
LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
+ LEX_CSTRING Aria= { STRING_WITH_LEN("Aria") };
DBUG_ENTER("plugin_init");
if (initialized)
@@ -1704,7 +1705,22 @@ int plugin_init(int *argc, char **argv, int flags)
global_system_variables.table_plugin =
intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
DBUG_SLOW_ASSERT(plugin_ptr->ref_count == 1);
+ }
+ /* Initialize Aria plugin so that we can load mysql.plugin */
+ plugin_ptr= plugin_find_internal(&Aria, MYSQL_STORAGE_ENGINE_PLUGIN);
+ DBUG_ASSERT(plugin_ptr || !mysql_mandatory_plugins[0]);
+ if (plugin_ptr)
+ {
+ DBUG_ASSERT(plugin_ptr->load_option == PLUGIN_FORCE);
+ if (plugin_initialize(&tmp_root, plugin_ptr, argc, argv, false))
+ {
+ if (!opt_help)
+ goto err_unlock;
+ plugin_ptr->state= PLUGIN_IS_DISABLED;
+ }
+ else
+ aria_loaded= 1;
}
mysql_mutex_unlock(&LOCK_plugin);
@@ -1726,8 +1742,10 @@ int plugin_init(int *argc, char **argv, int flags)
LEX_CSTRING maybe_myisam= { engine_name_buf, 0 };
bool is_sequence;
Table_type frm_type= dd_frm_type(NULL, path, &maybe_myisam, &is_sequence);
- /* if mysql.plugin table is MyISAM - load it right away */
- if (frm_type == TABLE_TYPE_NORMAL && !strcasecmp(maybe_myisam.str, "MyISAM"))
+ /* if mysql.plugin table is MyISAM or Aria - load it right away */
+ if (frm_type == TABLE_TYPE_NORMAL &&
+ (!strcasecmp(maybe_myisam.str, "MyISAM") ||
+ (!strcasecmp(maybe_myisam.str, "Aria") && aria_loaded)))
{
plugin_load(&tmp_root);
flags|= PLUGIN_INIT_SKIP_PLUGIN_TABLE;
@@ -4190,7 +4208,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*/
if (disable_plugin)
{
- if (global_system_variables.log_warnings)
+ if (global_system_variables.log_warnings && !opt_help)
sql_print_information("Plugin '%s' is disabled.",
tmp->name.str);
goto err;
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 14178d146b8..737a737f791 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1146,6 +1146,9 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
test_if_locked|= HA_OPEN_ABORT_IF_CRASHED;
}
+ if (aria_readonly)
+ test_if_locked|= HA_OPEN_IGNORE_MOVED_STATE;
+
if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER,
s3_open_args())))
{
@@ -1157,6 +1160,8 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
}
return (my_errno ? my_errno : -1);
}
+ if (aria_readonly)
+ file->s->options|= HA_OPTION_READ_ONLY_DATA;
file->s->chst_invalidator= query_cache_invalidate_by_MyISAM_filename_ref;
/* Set external_ref, mainly for temporary tables */
@@ -2270,7 +2275,8 @@ bool ha_maria::check_and_repair(THD *thd)
check_opt.flags= T_MEDIUM | T_AUTO_REPAIR;
error= 1;
- if ((file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) ==
+ if (!aria_readonly &&
+ (file->s->state.changed & (STATE_CRASHED_FLAGS | STATE_MOVED)) ==
STATE_MOVED)
{
/* Remove error about crashed table */
@@ -3369,7 +3375,7 @@ static int maria_hton_panic(handlerton *hton, ha_panic_function flag)
/* If no background checkpoints, we need to do one now */
int ret=0;
- if (!checkpoint_interval)
+ if (!checkpoint_interval && !aria_readonly)
ret= ma_checkpoint_execute(CHECKPOINT_FULL, FALSE);
ret|= maria_panic(flag);
@@ -3639,9 +3645,19 @@ bool ha_maria::is_changed() const
static int ha_maria_init(void *p)
{
- int res;
+ int res= 0, tmp;
const char *log_dir= maria_data_root;
+ /*
+ If aria_readonly is set, then we don't run recovery and we don't allow
+ opening of tables that are crashed. Used by mysqld --help
+ */
+ if ((aria_readonly= opt_help != 0))
+ {
+ maria_recover_options= 0;
+ checkpoint_interval= 0;
+ }
+
#ifdef HAVE_PSI_INTERFACE
init_aria_psi_keys();
#endif
@@ -3666,8 +3682,14 @@ static int ha_maria_init(void *p)
maria_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
bzero(maria_log_pagecache, sizeof(*maria_log_pagecache));
maria_tmpdir= &mysql_tmpdir_list; /* For REDO */
- res= maria_upgrade() || maria_init() || ma_control_file_open(TRUE, TRUE) ||
- ((force_start_after_recovery_failures != 0) &&
+
+ if (!aria_readonly)
+ res= maria_upgrade();
+ res= res || maria_init();
+ tmp= ma_control_file_open(!aria_readonly, !aria_readonly, !aria_readonly);
+ res= res || aria_readonly ? tmp == CONTROL_FILE_LOCKED : tmp != 0;
+ res= res ||
+ ((force_start_after_recovery_failures != 0 && !aria_readonly) &&
mark_recovery_start(log_dir)) ||
!init_pagecache(maria_pagecache,
(size_t) pagecache_buffer_size, pagecache_division_limit,
@@ -3676,13 +3698,16 @@ static int ha_maria_init(void *p)
!init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, 0) ||
- translog_init(maria_data_root, log_file_size,
- MYSQL_VERSION_ID, server_id, maria_log_pagecache,
- TRANSLOG_DEFAULT_FLAGS, 0) ||
- maria_recovery_from_log() ||
- ((force_start_after_recovery_failures != 0 ||
- maria_recovery_changed_data || recovery_failures) &&
- mark_recovery_success()) ||
+ (!aria_readonly &&
+ translog_init(maria_data_root, log_file_size,
+ MYSQL_VERSION_ID, server_id, maria_log_pagecache,
+ TRANSLOG_DEFAULT_FLAGS, 0)) ||
+ (!aria_readonly &&
+ (maria_recovery_from_log() ||
+ ((force_start_after_recovery_failures != 0 ||
+ maria_recovery_changed_data || recovery_failures) &&
+ mark_recovery_success()))) ||
+ (aria_readonly && trnman_init(MAX_INTERNAL_TRID-16)) ||
ma_checkpoint_init(checkpoint_interval);
maria_multi_threaded= maria_in_ha_maria= TRUE;
maria_create_trn_hook= maria_create_trn_for_mysql;
@@ -3693,6 +3718,8 @@ static int ha_maria_init(void *p)
maria_hton= 0;
ma_killed= ma_killed_in_mariadb;
+ if (res)
+ maria_panic(HA_PANIC_CLOSE);
return res ? HA_ERR_INITIALIZATION : 0;
}
diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c
index d619a58ff29..0f6b8b7200b 100644
--- a/storage/maria/ma_control_file.c
+++ b/storage/maria/ma_control_file.c
@@ -215,7 +215,7 @@ static CONTROL_FILE_ERROR create_control_file(const char *name,
file.
*/
-static int lock_control_file(const char *name)
+static int lock_control_file(const char *name, my_bool do_retry)
{
/*
On Windows, my_lock() uses locking() which is mandatory locking and so
@@ -228,6 +228,8 @@ static int lock_control_file(const char *name)
*/
#ifndef __WIN__
uint retry= 0;
+ uint retry_count= do_retry ? MARIA_MAX_CONTROL_FILE_LOCK_RETRY : 0;
+
/*
We can't here use the automatic wait in my_lock() as the alarm thread
may not yet exists.
@@ -239,8 +241,8 @@ static int lock_control_file(const char *name)
my_printf_error(HA_ERR_INITIALIZATION,
"Can't lock aria control file '%s' for exclusive use, "
"error: %d. Will retry for %d seconds", 0,
- name, my_errno, MARIA_MAX_CONTROL_FILE_LOCK_RETRY);
- if (retry++ > MARIA_MAX_CONTROL_FILE_LOCK_RETRY)
+ name, my_errno, retry_count);
+ if (++retry > retry_count)
return 1;
sleep(1);
}
@@ -269,7 +271,8 @@ static int lock_control_file(const char *name)
*/
CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
- my_bool print_error)
+ my_bool print_error,
+ my_bool wait_for_lock)
{
uchar buffer[CF_MAX_SIZE];
char name[FN_REFLEN], errmsg_buff[256];
@@ -311,8 +314,9 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
errmsg= "Can't create file";
goto err;
}
- if (lock_control_file(name))
+ if (lock_control_file(name, wait_for_lock))
{
+ error= CONTROL_FILE_LOCKED;
errmsg= lock_failed_errmsg;
goto err;
}
@@ -320,7 +324,6 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
}
/* Otherwise, file exists */
-
if ((control_file_fd= mysql_file_open(key_file_control, name,
open_flags, MYF(MY_WME))) < 0)
{
@@ -328,8 +331,10 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
goto err;
}
- if (lock_control_file(name)) /* lock it before reading content */
+ /* lock it before reading content */
+ if (lock_control_file(name, wait_for_lock))
{
+ error= CONTROL_FILE_LOCKED;
errmsg= lock_failed_errmsg;
goto err;
}
diff --git a/storage/maria/ma_control_file.h b/storage/maria/ma_control_file.h
index 535b0c71e64..232f13f734e 100644
--- a/storage/maria/ma_control_file.h
+++ b/storage/maria/ma_control_file.h
@@ -59,12 +59,14 @@ typedef enum enum_control_file_error {
CONTROL_FILE_MISSING,
CONTROL_FILE_INCONSISTENT_INFORMATION,
CONTROL_FILE_WRONG_BLOCKSIZE,
+ CONTROL_FILE_LOCKED,
CONTROL_FILE_UNKNOWN_ERROR /* any other error */
} CONTROL_FILE_ERROR;
C_MODE_START
CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
- my_bool print_error);
+ my_bool print_error,
+ my_bool wait_for_lock);
int ma_control_file_write_and_force(LSN last_checkpoint_lsn_arg,
uint32 last_logno_arg, TrID max_trid_arg,
uint8 recovery_failures_arg);
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 1e9095c19f0..029ce4b9128 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -87,12 +87,13 @@ void maria_end(void)
maria_inited= maria_multi_threaded= FALSE;
ft_free_stopwords();
ma_checkpoint_end();
- if (translog_status == TRANSLOG_OK)
+ if (translog_status == TRANSLOG_OK && !aria_readonly)
{
translog_soft_sync_end();
translog_sync();
}
- if ((trid= trnman_get_max_trid()) > max_trid_in_control_file)
+ if ((trid= trnman_get_max_trid()) > max_trid_in_control_file &&
+ !aria_readonly)
{
/*
Store max transaction id into control file, in case logs are removed
diff --git a/storage/maria/ma_rt_test.c b/storage/maria/ma_rt_test.c
index 0ba0bda2343..57c4eea4d9c 100644
--- a/storage/maria/ma_rt_test.c
+++ b/storage/maria/ma_rt_test.c
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0,
maria_block_size, 0, MY_WME) == 0) ||
- ma_control_file_open(TRUE, TRUE) ||
+ ma_control_file_open(TRUE, TRUE, TRUE) ||
(init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c
index a903ee23a31..fe9d89de5bf 100644
--- a/storage/maria/ma_static.c
+++ b/storage/maria/ma_static.c
@@ -41,6 +41,7 @@ my_bool maria_recovery_changed_data= 0, maria_recovery_verbose= 0;
my_bool maria_assert_if_crashed_table= 0;
my_bool maria_checkpoint_disabled= 0;
my_bool maria_encrypt_tables= 0;
+my_bool aria_readonly= 0;
mysql_mutex_t THR_LOCK_maria;
#ifdef DONT_USE_RW_LOCKS
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index 0a116c21c24..bbdb08257e1 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -81,7 +81,7 @@ int main(int argc,char *argv[])
if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0,
maria_block_size, 0, MY_WME) == 0) ||
- ma_control_file_open(TRUE, TRUE) ||
+ ma_control_file_open(TRUE, TRUE, TRUE) ||
(init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c
index d739cc4a7f1..956ac2d2f94 100644
--- a/storage/maria/ma_test2.c
+++ b/storage/maria/ma_test2.c
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
if (maria_init() ||
(init_pagecache(maria_pagecache, pagecache_size, 0, 0,
maria_block_size, 0, MY_WME) == 0) ||
- ma_control_file_open(TRUE, TRUE) ||
+ ma_control_file_open(TRUE, TRUE, TRUE) ||
(init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 25ad7c5c86a..5f3eef088f6 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -142,7 +142,8 @@ int main(int argc, char **argv)
maria_block_size= 0; /* Use block size from control file */
if (!opt_ignore_control_file &&
(ma_control_file_open(FALSE, opt_require_control_file ||
- !(check_param.testflag & T_SILENT)) &&
+ !(check_param.testflag & T_SILENT),
+ TRUE) &&
(opt_require_control_file ||
(opt_transaction_logging && (check_param.testflag & T_REP_ANY)))))
{
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 8e7bef9493c..c4a3353f58f 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -954,7 +954,7 @@ extern char *maria_data_root;
extern uchar maria_zero_string[];
extern my_bool maria_inited, maria_in_ha_maria, maria_recovery_changed_data;
extern my_bool maria_recovery_verbose, maria_checkpoint_disabled;
-extern my_bool maria_assert_if_crashed_table;
+extern my_bool maria_assert_if_crashed_table, aria_readonly;
extern ulong maria_checkpoint_min_log_activity;
extern HASH maria_stored_state;
extern int (*maria_create_trn_hook)(MARIA_HA *);
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index 29c3c5a12e2..b0bf9c01b84 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -67,7 +67,7 @@ int main(int argc, char **argv)
goto end;
}
/* we don't want to create a control file, it MUST exist */
- if (ma_control_file_open(FALSE, TRUE))
+ if (ma_control_file_open(FALSE, TRUE, TRUE))
{
fprintf(stderr, "Can't open control file (%d)\n", errno);
goto err;
diff --git a/storage/maria/test_ma_backup.c b/storage/maria/test_ma_backup.c
index ce43109a38b..3ffcd78b9af 100644
--- a/storage/maria/test_ma_backup.c
+++ b/storage/maria/test_ma_backup.c
@@ -47,7 +47,7 @@ int main(int argc __attribute__((unused)), char *argv[])
if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 2000, 0, 0,
maria_block_size, 0, MY_WME) == 0) ||
- ma_control_file_open(TRUE, TRUE) ||
+ ma_control_file_open(TRUE, TRUE, TRUE) ||
(init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index c018205f25e..56f6c52b2f5 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -238,7 +238,7 @@ void trnman_destroy()
static TrID new_trid()
{
DBUG_ENTER("new_trid");
- DBUG_ASSERT(global_trid_generator < 0xffffffffffffLL);
+ DBUG_ASSERT(global_trid_generator < MAX_INTERNAL_TRID);
DBUG_PRINT("info", ("mysql_mutex_assert_owner LOCK_trn_list"));
mysql_mutex_assert_owner(&LOCK_trn_list);
DBUG_RETURN(++global_trid_generator);
diff --git a/storage/maria/trnman.h b/storage/maria/trnman.h
index 37ef8ceeee9..588bcdf6461 100644
--- a/storage/maria/trnman.h
+++ b/storage/maria/trnman.h
@@ -59,6 +59,7 @@ struct st_ma_transaction
#define TRANSACTION_LOGGED_LONG_ID 0x8000000000000000ULL
#define MAX_TRID (~(TrID)0)
+#define MAX_INTERNAL_TRID 0xffffffffffffLL
extern WT_RESOURCE_TYPE ma_rc_dup_unique;
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index a382aaf3fcc..695181c9a6a 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -114,7 +114,7 @@ static CONTROL_FILE_ERROR local_ma_control_file_open(void)
{
CONTROL_FILE_ERROR error;
error_handler_hook= my_ignore_message;
- error= ma_control_file_open(TRUE, TRUE);
+ error= ma_control_file_open(TRUE, TRUE, TRUE);
error_handler_hook= default_error_handler_hook;
return error;
}
diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c
index 112be3c66f1..198ea5b2afb 100644
--- a/storage/maria/unittest/ma_test_loghandler-t.c
+++ b/storage/maria/unittest/ma_test_loghandler-t.c
@@ -197,7 +197,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
index 7a8ee720ded..8806571cabf 100644
--- a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
@@ -66,7 +66,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE,TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
index b76bf30748e..65b926376ae 100644
--- a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c
@@ -64,7 +64,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
index f08fb744813..d2fba562727 100644
--- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
@@ -280,7 +280,7 @@ int main(int argc __attribute__((unused)), char *argv[])
bzero(long_tr_id, 6);
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
@@ -443,7 +443,7 @@ int main(int argc __attribute__((unused)), char *argv[])
end_pagecache(&pagecache, 1);
ma_control_file_end();
- if (ma_control_file_open(TRUE,TRUE))
+ if (ma_control_file_open(TRUE,TRUE,TRUE))
{
fprintf(stderr, "pass2: Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
index 68d1edb9385..cb4d2bc70ba 100644
--- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
@@ -335,7 +335,7 @@ int main(int argc __attribute__((unused)),
thr_setconcurrency(2);
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_noflush-t.c b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
index f6c214cc827..3aafe5db9b4 100644
--- a/storage/maria/unittest/ma_test_loghandler_noflush-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
@@ -65,7 +65,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
index 06096d642f5..913bd4ef5b6 100644
--- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
@@ -66,7 +66,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
@@ -139,7 +139,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
}
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
index 7956d53186f..f09a78e5fa8 100644
--- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
@@ -69,7 +69,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_purge-t.c b/storage/maria/unittest/ma_test_loghandler_purge-t.c
index d28b16209ce..e1eeca2fc9b 100644
--- a/storage/maria/unittest/ma_test_loghandler_purge-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_purge-t.c
@@ -67,7 +67,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
- if (ma_control_file_open(TRUE, TRUE))
+ if (ma_control_file_open(TRUE, TRUE, TRUE))
{
fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1);