Commit 37d6d3b6 authored by Monty's avatar Monty

Max transid was not stored directly after Aria recovery

This caused ma_test_recovery.pl to fail

Other things:
- Fixed bug where "ma_test_recovert.pl --abort-on-error" didn't abort
  on error
parent a93ac8d9
...@@ -3606,7 +3606,8 @@ static int ha_maria_init(void *p) ...@@ -3606,7 +3606,8 @@ static int ha_maria_init(void *p)
TRANSLOG_DEFAULT_FLAGS, 0) || TRANSLOG_DEFAULT_FLAGS, 0) ||
maria_recovery_from_log() || maria_recovery_from_log() ||
((force_start_after_recovery_failures != 0 || ((force_start_after_recovery_failures != 0 ||
maria_recovery_changed_data) && mark_recovery_success()) || maria_recovery_changed_data || recovery_failures) &&
mark_recovery_success()) ||
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;
......
...@@ -81,6 +81,7 @@ int maria_init(void) ...@@ -81,6 +81,7 @@ int maria_init(void)
void maria_end(void) void maria_end(void)
{ {
DBUG_ENTER("maria_end");
if (maria_inited) if (maria_inited)
{ {
TrID trid; TrID trid;
...@@ -111,6 +112,7 @@ void maria_end(void) ...@@ -111,6 +112,7 @@ void maria_end(void)
mysql_mutex_destroy(&THR_LOCK_maria); mysql_mutex_destroy(&THR_LOCK_maria);
my_hash_free(&maria_stored_state); my_hash_free(&maria_stored_state);
} }
DBUG_VOID_RETURN;
} }
/** /**
......
...@@ -473,7 +473,13 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn, ...@@ -473,7 +473,13 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
fflush(stderr); fflush(stderr);
} }
set_if_bigger(max_trid_in_control_file, max_long_trid); if (max_long_trid > max_trid_in_control_file)
{
if (ma_control_file_write_and_force(last_checkpoint_lsn, last_logno,
max_long_trid, recovery_failures))
goto err;
}
if (take_checkpoints && checkpoint_useful) if (take_checkpoints && checkpoint_useful)
{ {
/* No dirty pages, all tables are closed, no active transactions, save: */ /* No dirty pages, all tables are closed, no active transactions, save: */
......
...@@ -235,8 +235,8 @@ sub main ...@@ -235,8 +235,8 @@ sub main
# It is impossible to do a "cmp" between .good and .after_undo, # It is impossible to do a "cmp" between .good and .after_undo,
# because the UNDO phase generated log # because the UNDO phase generated log
# records whose LSN tagged pages. Another reason is that rolling back # records whose LSN tagged pages. Another reason is that rolling back
# INSERT only marks the rows free, does not empty them (optimization), so # INSERT only marks the rows free, does not empty them
# traces of the INSERT+rollback remain. # (optimization), so traces of the INSERT+rollback remain.
check_table_is_same($table, $checksum); check_table_is_same($table, $checksum);
print MY_LOG "testing idempotency\n"; print MY_LOG "testing idempotency\n";
...@@ -298,11 +298,11 @@ sub check_table_is_same ...@@ -298,11 +298,11 @@ sub check_table_is_same
$com= "$maria_exe_path/aria_chk$suffix -dvv $table | grep -v \"Creation time:\" | grep -v \"recover time:\""; $com= "$maria_exe_path/aria_chk$suffix -dvv $table | grep -v \"Creation time:\" | grep -v \"recover time:\"";
$com.= "| grep -v \"file length\" | grep -v \"LSNs:\" | grep -v \"UUID:\" > $tmp/aria_chk_message.txt 2>&1"; $com.= "| grep -v \"file length\" | grep -v \"LSNs:\" | grep -v \"UUID:\" > $tmp/aria_chk_message.txt 2>&1";
$res= `$com`; $res= my_exec2($com);
print MY_LOG $res; print MY_LOG $res;
$res= `$maria_exe_path/aria_chk$suffix -ss -e --read-only $table`; $res= my_exec2("$maria_exe_path/aria_chk$suffix -ss -e --read-only $table");
print MY_LOG $res; print MY_LOG $res;
$checksum2= `$maria_exe_path/aria_chk$suffix -dss $table`; $checksum2= my_exec2("$maria_exe_path/aria_chk$suffix -dss $table");
if ("$checksum" ne "$checksum2") if ("$checksum" ne "$checksum2")
{ {
print MY_LOG "checksum differs for $table before and after recovery\n"; print MY_LOG "checksum differs for $table before and after recovery\n";
...@@ -311,7 +311,7 @@ sub check_table_is_same ...@@ -311,7 +311,7 @@ sub check_table_is_same
$com= "diff $tmp/aria_chk_message.good.txt $tmp/aria_chk_message.txt "; $com= "diff $tmp/aria_chk_message.good.txt $tmp/aria_chk_message.txt ";
$com.= "> $tmp/aria_chk_diff.txt || true"; $com.= "> $tmp/aria_chk_diff.txt || true";
$res= `$com`; $res= my_exec2($com);
print MY_LOG $res; print MY_LOG $res;
if (-s "$tmp/aria_chk_diff.txt") if (-s "$tmp/aria_chk_diff.txt")
...@@ -455,6 +455,21 @@ sub my_exec ...@@ -455,6 +455,21 @@ sub my_exec
return $res; return $res;
} }
sub my_exec2
{
my($command)= @_;
my $res, $err;
$res= `$command`;
if ($? != 0 && $opt_abort_on_error)
{
$err= $?;
print "$command\n";
print "failed with error: $err\n";
exit(1);
}
return $res;
}
#### ####
#### usage #### usage
......
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