Commit 8eba777c authored by Monty's avatar Monty

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.
parent 324e42fb
[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
#
# 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
...@@ -1873,7 +1873,7 @@ extern "C" void unireg_abort(int exit_code) ...@@ -1873,7 +1873,7 @@ extern "C" void unireg_abort(int exit_code)
if (opt_help) if (opt_help)
usage(); usage();
if (exit_code) else if (exit_code)
sql_print_error("Aborting"); sql_print_error("Aborting");
/* Don't write more notes to the log to not hide error message */ /* Don't write more notes to the log to not hide error message */
disable_log_notes= 1; disable_log_notes= 1;
...@@ -8557,9 +8557,15 @@ static void option_error_reporter(enum loglevel level, const char *format, ...) ...@@ -8557,9 +8557,15 @@ static void option_error_reporter(enum loglevel level, const char *format, ...)
va_list args; va_list args;
va_start(args, format); va_start(args, format);
/* Don't print warnings for --loose options during bootstrap */ /*
if (level == ERROR_LEVEL || !opt_bootstrap || Don't print warnings for --loose options during bootstrap if
global_system_variables.log_warnings) 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); vprint_msg_to_log(level, format, args);
} }
......
...@@ -1592,8 +1592,9 @@ int plugin_init(int *argc, char **argv, int flags) ...@@ -1592,8 +1592,9 @@ int plugin_init(int *argc, char **argv, int flags)
struct st_plugin_int tmp, *plugin_ptr, **reap; struct st_plugin_int tmp, *plugin_ptr, **reap;
MEM_ROOT tmp_root; MEM_ROOT tmp_root;
bool reaped_mandatory_plugin= false; bool reaped_mandatory_plugin= false;
bool mandatory= true; bool mandatory= true, aria_loaded= 0;
LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") }; LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
LEX_CSTRING Aria= { STRING_WITH_LEN("Aria") };
DBUG_ENTER("plugin_init"); DBUG_ENTER("plugin_init");
if (initialized) if (initialized)
...@@ -1704,7 +1705,22 @@ int plugin_init(int *argc, char **argv, int flags) ...@@ -1704,7 +1705,22 @@ int plugin_init(int *argc, char **argv, int flags)
global_system_variables.table_plugin = global_system_variables.table_plugin =
intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr)); intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
DBUG_SLOW_ASSERT(plugin_ptr->ref_count == 1); 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); mysql_mutex_unlock(&LOCK_plugin);
...@@ -1726,8 +1742,10 @@ int plugin_init(int *argc, char **argv, int flags) ...@@ -1726,8 +1742,10 @@ int plugin_init(int *argc, char **argv, int flags)
LEX_CSTRING maybe_myisam= { engine_name_buf, 0 }; LEX_CSTRING maybe_myisam= { engine_name_buf, 0 };
bool is_sequence; bool is_sequence;
Table_type frm_type= dd_frm_type(NULL, path, &maybe_myisam, &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 mysql.plugin table is MyISAM or Aria - load it right away */
if (frm_type == TABLE_TYPE_NORMAL && !strcasecmp(maybe_myisam.str, "MyISAM")) if (frm_type == TABLE_TYPE_NORMAL &&
(!strcasecmp(maybe_myisam.str, "MyISAM") ||
(!strcasecmp(maybe_myisam.str, "Aria") && aria_loaded)))
{ {
plugin_load(&tmp_root); plugin_load(&tmp_root);
flags|= PLUGIN_INIT_SKIP_PLUGIN_TABLE; flags|= PLUGIN_INIT_SKIP_PLUGIN_TABLE;
...@@ -4190,7 +4208,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, ...@@ -4190,7 +4208,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*/ */
if (disable_plugin) if (disable_plugin)
{ {
if (global_system_variables.log_warnings) if (global_system_variables.log_warnings && !opt_help)
sql_print_information("Plugin '%s' is disabled.", sql_print_information("Plugin '%s' is disabled.",
tmp->name.str); tmp->name.str);
goto err; goto err;
......
...@@ -1146,6 +1146,9 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) ...@@ -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; 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, if (!(file= maria_open(name, mode, test_if_locked | HA_OPEN_FROM_SQL_LAYER,
s3_open_args()))) s3_open_args())))
{ {
...@@ -1157,6 +1160,8 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) ...@@ -1157,6 +1160,8 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
} }
return (my_errno ? my_errno : -1); 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; file->s->chst_invalidator= query_cache_invalidate_by_MyISAM_filename_ref;
/* Set external_ref, mainly for temporary tables */ /* Set external_ref, mainly for temporary tables */
...@@ -2270,7 +2275,8 @@ bool ha_maria::check_and_repair(THD *thd) ...@@ -2270,7 +2275,8 @@ bool ha_maria::check_and_repair(THD *thd)
check_opt.flags= T_MEDIUM | T_AUTO_REPAIR; check_opt.flags= T_MEDIUM | T_AUTO_REPAIR;
error= 1; 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) STATE_MOVED)
{ {
/* Remove error about crashed table */ /* Remove error about crashed table */
...@@ -3369,7 +3375,7 @@ static int maria_hton_panic(handlerton *hton, ha_panic_function flag) ...@@ -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 */ /* If no background checkpoints, we need to do one now */
int ret=0; int ret=0;
if (!checkpoint_interval) if (!checkpoint_interval && !aria_readonly)
ret= ma_checkpoint_execute(CHECKPOINT_FULL, FALSE); ret= ma_checkpoint_execute(CHECKPOINT_FULL, FALSE);
ret|= maria_panic(flag); ret|= maria_panic(flag);
...@@ -3639,9 +3645,19 @@ bool ha_maria::is_changed() const ...@@ -3639,9 +3645,19 @@ bool ha_maria::is_changed() const
static int ha_maria_init(void *p) static int ha_maria_init(void *p)
{ {
int res; int res= 0, tmp;
const char *log_dir= maria_data_root; 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 #ifdef HAVE_PSI_INTERFACE
init_aria_psi_keys(); init_aria_psi_keys();
#endif #endif
...@@ -3666,8 +3682,14 @@ static int ha_maria_init(void *p) ...@@ -3666,8 +3682,14 @@ static int ha_maria_init(void *p)
maria_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES; maria_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
bzero(maria_log_pagecache, sizeof(*maria_log_pagecache)); bzero(maria_log_pagecache, sizeof(*maria_log_pagecache));
maria_tmpdir= &mysql_tmpdir_list; /* For REDO */ 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)) || mark_recovery_start(log_dir)) ||
!init_pagecache(maria_pagecache, !init_pagecache(maria_pagecache,
(size_t) pagecache_buffer_size, pagecache_division_limit, (size_t) pagecache_buffer_size, pagecache_division_limit,
...@@ -3676,13 +3698,16 @@ static int ha_maria_init(void *p) ...@@ -3676,13 +3698,16 @@ static int ha_maria_init(void *p)
!init_pagecache(maria_log_pagecache, !init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0, TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, 0) || TRANSLOG_PAGE_SIZE, 0, 0) ||
translog_init(maria_data_root, log_file_size, (!aria_readonly &&
MYSQL_VERSION_ID, server_id, maria_log_pagecache, translog_init(maria_data_root, log_file_size,
TRANSLOG_DEFAULT_FLAGS, 0) || MYSQL_VERSION_ID, server_id, maria_log_pagecache,
maria_recovery_from_log() || TRANSLOG_DEFAULT_FLAGS, 0)) ||
((force_start_after_recovery_failures != 0 || (!aria_readonly &&
maria_recovery_changed_data || recovery_failures) && (maria_recovery_from_log() ||
mark_recovery_success()) || ((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); ma_checkpoint_init(checkpoint_interval);
maria_multi_threaded= maria_in_ha_maria= TRUE; maria_multi_threaded= maria_in_ha_maria= TRUE;
maria_create_trn_hook= maria_create_trn_for_mysql; maria_create_trn_hook= maria_create_trn_for_mysql;
...@@ -3693,6 +3718,8 @@ static int ha_maria_init(void *p) ...@@ -3693,6 +3718,8 @@ static int ha_maria_init(void *p)
maria_hton= 0; maria_hton= 0;
ma_killed= ma_killed_in_mariadb; ma_killed= ma_killed_in_mariadb;
if (res)
maria_panic(HA_PANIC_CLOSE);
return res ? HA_ERR_INITIALIZATION : 0; return res ? HA_ERR_INITIALIZATION : 0;
} }
......
...@@ -215,7 +215,7 @@ static CONTROL_FILE_ERROR create_control_file(const char *name, ...@@ -215,7 +215,7 @@ static CONTROL_FILE_ERROR create_control_file(const char *name,
file. 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 On Windows, my_lock() uses locking() which is mandatory locking and so
...@@ -228,6 +228,8 @@ static int lock_control_file(const char *name) ...@@ -228,6 +228,8 @@ static int lock_control_file(const char *name)
*/ */
#ifndef __WIN__ #ifndef __WIN__
uint retry= 0; 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 We can't here use the automatic wait in my_lock() as the alarm thread
may not yet exists. may not yet exists.
...@@ -239,8 +241,8 @@ static int lock_control_file(const char *name) ...@@ -239,8 +241,8 @@ static int lock_control_file(const char *name)
my_printf_error(HA_ERR_INITIALIZATION, my_printf_error(HA_ERR_INITIALIZATION,
"Can't lock aria control file '%s' for exclusive use, " "Can't lock aria control file '%s' for exclusive use, "
"error: %d. Will retry for %d seconds", 0, "error: %d. Will retry for %d seconds", 0,
name, my_errno, MARIA_MAX_CONTROL_FILE_LOCK_RETRY); name, my_errno, retry_count);
if (retry++ > MARIA_MAX_CONTROL_FILE_LOCK_RETRY) if (++retry > retry_count)
return 1; return 1;
sleep(1); sleep(1);
} }
...@@ -269,7 +271,8 @@ static int lock_control_file(const char *name) ...@@ -269,7 +271,8 @@ static int lock_control_file(const char *name)
*/ */
CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, 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]; uchar buffer[CF_MAX_SIZE];
char name[FN_REFLEN], errmsg_buff[256]; char name[FN_REFLEN], errmsg_buff[256];
...@@ -311,8 +314,9 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, ...@@ -311,8 +314,9 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
errmsg= "Can't create file"; errmsg= "Can't create file";
goto err; goto err;
} }
if (lock_control_file(name)) if (lock_control_file(name, wait_for_lock))
{ {
error= CONTROL_FILE_LOCKED;
errmsg= lock_failed_errmsg; errmsg= lock_failed_errmsg;
goto err; goto err;
} }
...@@ -320,7 +324,6 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, ...@@ -320,7 +324,6 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
} }
/* Otherwise, file exists */ /* Otherwise, file exists */
if ((control_file_fd= mysql_file_open(key_file_control, name, if ((control_file_fd= mysql_file_open(key_file_control, name,
open_flags, MYF(MY_WME))) < 0) open_flags, MYF(MY_WME))) < 0)
{ {
...@@ -328,8 +331,10 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, ...@@ -328,8 +331,10 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
goto err; 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; errmsg= lock_failed_errmsg;
goto err; goto err;
} }
......
...@@ -59,12 +59,14 @@ typedef enum enum_control_file_error { ...@@ -59,12 +59,14 @@ typedef enum enum_control_file_error {
CONTROL_FILE_MISSING, CONTROL_FILE_MISSING,
CONTROL_FILE_INCONSISTENT_INFORMATION, CONTROL_FILE_INCONSISTENT_INFORMATION,
CONTROL_FILE_WRONG_BLOCKSIZE, CONTROL_FILE_WRONG_BLOCKSIZE,
CONTROL_FILE_LOCKED,
CONTROL_FILE_UNKNOWN_ERROR /* any other error */ CONTROL_FILE_UNKNOWN_ERROR /* any other error */
} CONTROL_FILE_ERROR; } CONTROL_FILE_ERROR;
C_MODE_START C_MODE_START
CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, 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, int ma_control_file_write_and_force(LSN last_checkpoint_lsn_arg,
uint32 last_logno_arg, TrID max_trid_arg, uint32 last_logno_arg, TrID max_trid_arg,
uint8 recovery_failures_arg); uint8 recovery_failures_arg);
......
...@@ -87,12 +87,13 @@ void maria_end(void) ...@@ -87,12 +87,13 @@ void maria_end(void)
maria_inited= maria_multi_threaded= FALSE; maria_inited= maria_multi_threaded= FALSE;
ft_free_stopwords(); ft_free_stopwords();
ma_checkpoint_end(); ma_checkpoint_end();
if (translog_status == TRANSLOG_OK) if (translog_status == TRANSLOG_OK && !aria_readonly)
{ {
translog_soft_sync_end(); translog_soft_sync_end();
translog_sync(); 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 Store max transaction id into control file, in case logs are removed
......
...@@ -101,7 +101,7 @@ int main(int argc, char *argv[]) ...@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
if (maria_init() || if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0, (init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0,
maria_block_size, 0, MY_WME) == 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, (init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0, TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
......
...@@ -41,6 +41,7 @@ my_bool maria_recovery_changed_data= 0, maria_recovery_verbose= 0; ...@@ -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_assert_if_crashed_table= 0;
my_bool maria_checkpoint_disabled= 0; my_bool maria_checkpoint_disabled= 0;
my_bool maria_encrypt_tables= 0; my_bool maria_encrypt_tables= 0;
my_bool aria_readonly= 0;
mysql_mutex_t THR_LOCK_maria; mysql_mutex_t THR_LOCK_maria;
#ifdef DONT_USE_RW_LOCKS #ifdef DONT_USE_RW_LOCKS
......
...@@ -81,7 +81,7 @@ int main(int argc,char *argv[]) ...@@ -81,7 +81,7 @@ int main(int argc,char *argv[])
if (maria_init() || if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0, (init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0,
maria_block_size, 0, MY_WME) == 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, (init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0, TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
......
...@@ -89,7 +89,7 @@ int main(int argc, char *argv[]) ...@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
if (maria_init() || if (maria_init() ||
(init_pagecache(maria_pagecache, pagecache_size, 0, 0, (init_pagecache(maria_pagecache, pagecache_size, 0, 0,
maria_block_size, 0, MY_WME) == 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, (init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0, TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
......
...@@ -142,7 +142,8 @@ int main(int argc, char **argv) ...@@ -142,7 +142,8 @@ int main(int argc, char **argv)
maria_block_size= 0; /* Use block size from control file */ maria_block_size= 0; /* Use block size from control file */
if (!opt_ignore_control_file && if (!opt_ignore_control_file &&
(ma_control_file_open(FALSE, opt_require_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_require_control_file ||
(opt_transaction_logging && (check_param.testflag & T_REP_ANY))))) (opt_transaction_logging && (check_param.testflag & T_REP_ANY)))))
{ {
......
...@@ -954,7 +954,7 @@ extern char *maria_data_root; ...@@ -954,7 +954,7 @@ extern char *maria_data_root;
extern uchar maria_zero_string[]; extern uchar maria_zero_string[];
extern my_bool maria_inited, maria_in_ha_maria, maria_recovery_changed_data; 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_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 ulong maria_checkpoint_min_log_activity;
extern HASH maria_stored_state; extern HASH maria_stored_state;
extern int (*maria_create_trn_hook)(MARIA_HA *); extern int (*maria_create_trn_hook)(MARIA_HA *);
......
...@@ -67,7 +67,7 @@ int main(int argc, char **argv) ...@@ -67,7 +67,7 @@ int main(int argc, char **argv)
goto end; goto end;
} }
/* we don't want to create a control file, it MUST exist */ /* 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); fprintf(stderr, "Can't open control file (%d)\n", errno);
goto err; goto err;
......
...@@ -47,7 +47,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -47,7 +47,7 @@ int main(int argc __attribute__((unused)), char *argv[])
if (maria_init() || if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 2000, 0, 0, (init_pagecache(maria_pagecache, maria_block_size * 2000, 0, 0,
maria_block_size, 0, MY_WME) == 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, (init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0, TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) || TRANSLOG_PAGE_SIZE, 0, MY_WME) == 0) ||
......
...@@ -238,7 +238,7 @@ void trnman_destroy() ...@@ -238,7 +238,7 @@ void trnman_destroy()
static TrID new_trid() static TrID new_trid()
{ {
DBUG_ENTER("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")); DBUG_PRINT("info", ("mysql_mutex_assert_owner LOCK_trn_list"));
mysql_mutex_assert_owner(&LOCK_trn_list); mysql_mutex_assert_owner(&LOCK_trn_list);
DBUG_RETURN(++global_trid_generator); DBUG_RETURN(++global_trid_generator);
......
...@@ -59,6 +59,7 @@ struct st_ma_transaction ...@@ -59,6 +59,7 @@ struct st_ma_transaction
#define TRANSACTION_LOGGED_LONG_ID 0x8000000000000000ULL #define TRANSACTION_LOGGED_LONG_ID 0x8000000000000000ULL
#define MAX_TRID (~(TrID)0) #define MAX_TRID (~(TrID)0)
#define MAX_INTERNAL_TRID 0xffffffffffffLL
extern WT_RESOURCE_TYPE ma_rc_dup_unique; extern WT_RESOURCE_TYPE ma_rc_dup_unique;
......
...@@ -114,7 +114,7 @@ static CONTROL_FILE_ERROR local_ma_control_file_open(void) ...@@ -114,7 +114,7 @@ static CONTROL_FILE_ERROR local_ma_control_file_open(void)
{ {
CONTROL_FILE_ERROR error; CONTROL_FILE_ERROR error;
error_handler_hook= my_ignore_message; 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; error_handler_hook= default_error_handler_hook;
return error; return error;
} }
......
...@@ -197,7 +197,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -197,7 +197,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -66,7 +66,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -66,7 +66,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -64,7 +64,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -64,7 +64,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -280,7 +280,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -280,7 +280,7 @@ int main(int argc __attribute__((unused)), char *argv[])
bzero(long_tr_id, 6); 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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
...@@ -443,7 +443,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -443,7 +443,7 @@ int main(int argc __attribute__((unused)), char *argv[])
end_pagecache(&pagecache, 1); end_pagecache(&pagecache, 1);
ma_control_file_end(); 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); fprintf(stderr, "pass2: Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -335,7 +335,7 @@ int main(int argc __attribute__((unused)), ...@@ -335,7 +335,7 @@ int main(int argc __attribute__((unused)),
thr_setconcurrency(2); thr_setconcurrency(2);
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -65,7 +65,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -65,7 +65,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -66,7 +66,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -66,7 +66,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
...@@ -139,7 +139,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -69,7 +69,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -69,7 +69,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
...@@ -67,7 +67,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -67,7 +67,7 @@ int main(int argc __attribute__((unused)), char *argv[])
} }
#endif #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); fprintf(stderr, "Can't init control file (%d)\n", errno);
exit(1); exit(1);
......
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