Commit cbf60dba authored by Monty's avatar Monty Committed by Sergei Petrunia

Small improvements to aria recovery

I spent 4 hours on work and 12 hours of testing to try to find
the reason for aria crashing in recovery when starting a new test,
in which case the 'data directory' should be a copy of "install.db",
but aria_log.00000001 content was not correct.

The following changes are mostly done to make it a bit easier to find out
more in case of future similar crashes:

- Mark last_checkpoint_lsn volatile (safety).
- Write checkpoint message to aria_recovery.trace
- When compling with DBUG and with HAVE_DBUG_TRANSLOG_SRC,
  use checksum's for Aria log pages. We cannot have it on by default
  for DBUG servers yet as there is bugs when changing CRC between
  restarts.
- Added a message to mtr --verbose when copying the data directory.
- Removed extra linefeed in Aria recovery message (cleanup)
parent 66dde8a5
......@@ -2713,6 +2713,7 @@ sub mysql_server_start($) {
# Copy datadir from installed system db
my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
my $install_db= "$path/install.db";
mtr_verbose("copying $install_db to $datadir");
copytree($install_db, $datadir) if -d $install_db;
mtr_error("Failed to copy system db to '$datadir'") unless -d $datadir;
}
......
......@@ -104,7 +104,7 @@ one should increment the control file version number.
This LSN serves for the two-checkpoint rule, and also to find the
checkpoint record when doing a recovery.
*/
LSN last_checkpoint_lsn= LSN_IMPOSSIBLE;
volatile LSN last_checkpoint_lsn= LSN_IMPOSSIBLE;
uint32 last_logno= FILENO_IMPOSSIBLE;
/**
The maximum transaction id given to a transaction. It is only updated at
......
......@@ -37,7 +37,7 @@ C_MODE_START
LSN of the last checkoint
(if last_checkpoint_lsn == LSN_IMPOSSIBLE then there was never a checkpoint)
*/
extern LSN last_checkpoint_lsn;
extern volatile LSN last_checkpoint_lsn;
/*
Last log number (if last_logno == FILENO_IMPOSSIBLE then there is no log
file yet)
......
......@@ -25,7 +25,11 @@
/* minimum possible transaction log size */
#define TRANSLOG_MIN_FILE_SIZE (8*MB)
/* transaction log default flags (TODO: make it global variable) */
#ifdef HAVE_DBUG_TRANSLOG_CRC
#define TRANSLOG_DEFAULT_FLAGS IF_DBUG(TRANSLOG_PAGE_CRC,0)
#else
#define TRANSLOG_DEFAULT_FLAGS 0
#endif
/*
Transaction log flags.
......
......@@ -133,7 +133,7 @@ static void new_transaction(uint16 sid, TrID long_id, LSN undo_lsn,
static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id);
static int new_page(uint32 fileid, pgcache_page_no_t pageid, LSN rec_lsn,
struct st_dirty_page *dirty_page);
static int close_all_tables(void);
static int close_all_tables(my_bool force_end_newline);
static my_bool close_one_table(const char *name, TRANSLOG_ADDRESS addr);
static void print_redo_phase_progress(TRANSLOG_ADDRESS addr);
static void delete_all_transactions();
......@@ -467,7 +467,7 @@ int maria_apply_log(LSN from_lsn, LSN end_redo_lsn, LSN end_undo_lsn,
we don't use maria_panic() because it would maria_end(), and Recovery does
not want that (we want to keep some modules initialized for runtime).
*/
if (close_all_tables())
if (close_all_tables(0))
{
ma_message_no_user(0, "closing of tables failed");
goto err;
......@@ -495,6 +495,8 @@ int maria_apply_log(LSN from_lsn, LSN end_redo_lsn, LSN end_undo_lsn,
/* No dirty pages, all tables are closed, no active transactions, save: */
if (ma_checkpoint_execute(CHECKPOINT_FULL, FALSE))
goto err;
tprint(tracef, "checkpoint done at " LSN_FMT "\n",
LSN_IN_PARTS(last_checkpoint_lsn));
}
goto end;
......@@ -505,7 +507,7 @@ int maria_apply_log(LSN from_lsn, LSN end_redo_lsn, LSN end_undo_lsn,
delete_all_transactions();
if (!abort_message_printed)
error= 1;
if (close_all_tables())
if (close_all_tables(1))
{
ma_message_no_user(0, "closing of tables failed");
}
......@@ -3472,7 +3474,7 @@ static int new_page(uint32 fileid, pgcache_page_no_t pageid, LSN rec_lsn,
}
static int close_all_tables(void)
static int close_all_tables(my_bool force_end_newline)
{
int error= 0;
uint count= 0;
......@@ -3537,7 +3539,7 @@ static int close_all_tables(void)
}
}
end:
if (recovery_message_printed == REC_MSG_FLUSH)
if (recovery_message_printed == REC_MSG_FLUSH && (force_end_newline || error))
{
fputc('\n', stderr);
fflush(stderr);
......
......@@ -87,7 +87,7 @@ void eprint(FILE *trace_file __attribute__ ((unused)),
if (!trace_file)
trace_file= stderr;
if (procent_printed)
if (procent_printed && trace_file == stderr)
{
procent_printed= 0;
/* In silent mode, print on another line than the 0% 10% 20% line */
......
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