Commit d7814545 authored by Michael Widenius's avatar Michael Widenius

Fixed Aria recovery progress printing

- When recovery failed, errors would not be printed on
  new lines.
- Print more information if file lengths are changed
- Added logging of table name for entries INCOMPLETE_LOG and
  REDO_REPAIR_TABLE
parent 793e5be7
...@@ -531,8 +531,6 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn, ...@@ -531,8 +531,6 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
if (error && !abort_message_printed) if (error && !abort_message_printed)
{ {
if (!trace_file)
fputc('\n', stderr);
my_message(HA_ERR_INITIALIZATION, my_message(HA_ERR_INITIALIZATION,
"Aria recovery failed. Please run aria_chk -r on all Aria " "Aria recovery failed. Please run aria_chk -r on all Aria "
"tables and delete all aria_log.######## files", MYF(0)); "tables and delete all aria_log.######## files", MYF(0));
...@@ -667,13 +665,16 @@ prototype_redo_exec_hook(INCOMPLETE_LOG) ...@@ -667,13 +665,16 @@ prototype_redo_exec_hook(INCOMPLETE_LOG)
{ {
MARIA_HA *info; MARIA_HA *info;
/* We try to get table first, so that we get the table in in the trace log */
info= get_MARIA_HA_from_REDO_record(rec);
if (skip_DDLs) if (skip_DDLs)
{ {
tprint(tracef, "we skip DDLs\n"); tprint(tracef, "we skip DDLs\n");
return 0; return 0;
} }
if ((info= get_MARIA_HA_from_REDO_record(rec)) == NULL) if (!info)
{ {
/* no such table, don't need to warn */ /* no such table, don't need to warn */
return 0; return 0;
...@@ -1144,6 +1145,9 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE) ...@@ -1144,6 +1145,9 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
my_bool quick_repair; my_bool quick_repair;
DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE"); DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE");
/* We try to get table first, so that we get the table in in the trace log */
info= get_MARIA_HA_from_REDO_record(rec);
if (skip_DDLs) if (skip_DDLs)
{ {
/* /*
...@@ -1153,8 +1157,13 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE) ...@@ -1153,8 +1157,13 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
tprint(tracef, "we skip DDLs\n"); tprint(tracef, "we skip DDLs\n");
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if ((info= get_MARIA_HA_from_REDO_record(rec)) == NULL)
DBUG_RETURN(0); if (!info)
{
/* no such table, don't need to warn */
return 0;
}
if (maria_is_crashed(info)) if (maria_is_crashed(info))
{ {
tprint(tracef, "we skip repairing crashed table\n"); tprint(tracef, "we skip repairing crashed table\n");
...@@ -1443,17 +1452,21 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id) ...@@ -1443,17 +1452,21 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
} }
if (share->state.state.data_file_length != dfile_len) if (share->state.state.data_file_length != dfile_len)
{ {
tprint(tracef, ", has wrong state.data_file_length (fixing it)"); tprint(tracef, ", has wrong state.data_file_length "
"(fixing it from %llu to %llu)",
(ulonglong) share->state.state.data_file_length, (ulonglong) dfile_len);
share->state.state.data_file_length= dfile_len; share->state.state.data_file_length= dfile_len;
} }
if (share->state.state.key_file_length != kfile_len) if (share->state.state.key_file_length != kfile_len)
{ {
tprint(tracef, ", has wrong state.key_file_length (fixing it)"); tprint(tracef, ", has wrong state.key_file_length "
"(fixing it from %llu to %llu)",
(ulonglong) share->state.state.key_file_length, (ulonglong) kfile_len);
share->state.state.key_file_length= kfile_len; share->state.state.key_file_length= kfile_len;
} }
if ((dfile_len % share->block_size) || (kfile_len % share->block_size)) if ((dfile_len % share->block_size) || (kfile_len % share->block_size))
{ {
tprint(tracef, ", has too short last page\n"); tprint(tracef, ", has too short last page");
/* Recovery will fix this, no error */ /* Recovery will fix this, no error */
ALERT_USER(); ALERT_USER();
} }
...@@ -2764,7 +2777,7 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply) ...@@ -2764,7 +2777,7 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
{ {
fprintf(stderr, " 100%%"); fprintf(stderr, " 100%%");
fflush(stderr); fflush(stderr);
procent_printed= 1; procent_printed= 1; /* Will be follwed by time */
} }
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -2914,7 +2927,6 @@ static int run_undo_phase(uint uncommitted) ...@@ -2914,7 +2927,6 @@ static int run_undo_phase(uint uncommitted)
recovery_message_printed= REC_MSG_UNDO; recovery_message_printed= REC_MSG_UNDO;
} }
tprint(tracef, "%u transactions will be rolled back\n", uncommitted); tprint(tracef, "%u transactions will be rolled back\n", uncommitted);
procent_printed= 1;
for( ; ; ) for( ; ; )
{ {
char llbuf[22]; char llbuf[22];
...@@ -2967,7 +2979,6 @@ static int run_undo_phase(uint uncommitted) ...@@ -2967,7 +2979,6 @@ static int run_undo_phase(uint uncommitted)
/* In the future, we want to have this phase *online* */ /* In the future, we want to have this phase *online* */
} }
} }
procent_printed= 0;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -3467,6 +3478,11 @@ static int close_all_tables(void) ...@@ -3467,6 +3478,11 @@ static int close_all_tables(void)
} }
} }
end: end:
if (recovery_message_printed == REC_MSG_FLUSH)
{
fputc('\n', stderr);
fflush(stderr);
}
mysql_mutex_unlock(&THR_LOCK_maria); mysql_mutex_unlock(&THR_LOCK_maria);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -70,14 +70,7 @@ void tprint(FILE *trace_file __attribute__ ((unused)), ...@@ -70,14 +70,7 @@ void tprint(FILE *trace_file __attribute__ ((unused)),
#endif #endif
va_start(args, format); va_start(args, format);
if (trace_file != NULL) if (trace_file != NULL)
{
if (procent_printed)
{
procent_printed= 0;
fputc('\n', trace_file);
}
vfprintf(trace_file, format, args); vfprintf(trace_file, format, args);
}
va_end(args); va_end(args);
} }
...@@ -93,9 +86,10 @@ void eprint(FILE *trace_file __attribute__ ((unused)), ...@@ -93,9 +86,10 @@ void eprint(FILE *trace_file __attribute__ ((unused)),
if (procent_printed) if (procent_printed)
{ {
/* In silent mode, print on another line than the 0% 10% 20% line */
procent_printed= 0; procent_printed= 0;
fputc('\n', trace_file); /* In silent mode, print on another line than the 0% 10% 20% line */
fputc('\n', stderr);
fflush(stderr);
} }
vfprintf(trace_file , format, args); vfprintf(trace_file , format, args);
fputc('\n', trace_file); fputc('\n', trace_file);
......
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