Skip to content

Commit 37d6d3b

Browse files
committed
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
1 parent a93ac8d commit 37d6d3b

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

storage/maria/ha_maria.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3606,7 +3606,8 @@ static int ha_maria_init(void *p)
36063606
TRANSLOG_DEFAULT_FLAGS, 0) ||
36073607
maria_recovery_from_log() ||
36083608
((force_start_after_recovery_failures != 0 ||
3609-
maria_recovery_changed_data) && mark_recovery_success()) ||
3609+
maria_recovery_changed_data || recovery_failures) &&
3610+
mark_recovery_success()) ||
36103611
ma_checkpoint_init(checkpoint_interval);
36113612
maria_multi_threaded= maria_in_ha_maria= TRUE;
36123613
maria_create_trn_hook= maria_create_trn_for_mysql;

storage/maria/ma_init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ int maria_init(void)
8181

8282
void maria_end(void)
8383
{
84+
DBUG_ENTER("maria_end");
8485
if (maria_inited)
8586
{
8687
TrID trid;
@@ -111,6 +112,7 @@ void maria_end(void)
111112
mysql_mutex_destroy(&THR_LOCK_maria);
112113
my_hash_free(&maria_stored_state);
113114
}
115+
DBUG_VOID_RETURN;
114116
}
115117

116118
/**

storage/maria/ma_recovery.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,13 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
473473
fflush(stderr);
474474
}
475475

476-
set_if_bigger(max_trid_in_control_file, max_long_trid);
476+
if (max_long_trid > max_trid_in_control_file)
477+
{
478+
if (ma_control_file_write_and_force(last_checkpoint_lsn, last_logno,
479+
max_long_trid, recovery_failures))
480+
goto err;
481+
}
482+
477483
if (take_checkpoints && checkpoint_useful)
478484
{
479485
/* No dirty pages, all tables are closed, no active transactions, save: */

storage/maria/unittest/ma_test_recovery.pl

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ sub main
235235
# It is impossible to do a "cmp" between .good and .after_undo,
236236
# because the UNDO phase generated log
237237
# records whose LSN tagged pages. Another reason is that rolling back
238-
# INSERT only marks the rows free, does not empty them (optimization), so
239-
# traces of the INSERT+rollback remain.
238+
# INSERT only marks the rows free, does not empty them
239+
# (optimization), so traces of the INSERT+rollback remain.
240240

241241
check_table_is_same($table, $checksum);
242242
print MY_LOG "testing idempotency\n";
@@ -298,11 +298,11 @@ sub check_table_is_same
298298

299299
$com= "$maria_exe_path/aria_chk$suffix -dvv $table | grep -v \"Creation time:\" | grep -v \"recover time:\"";
300300
$com.= "| grep -v \"file length\" | grep -v \"LSNs:\" | grep -v \"UUID:\" > $tmp/aria_chk_message.txt 2>&1";
301-
$res= `$com`;
301+
$res= my_exec2($com);
302302
print MY_LOG $res;
303-
$res= `$maria_exe_path/aria_chk$suffix -ss -e --read-only $table`;
303+
$res= my_exec2("$maria_exe_path/aria_chk$suffix -ss -e --read-only $table");
304304
print MY_LOG $res;
305-
$checksum2= `$maria_exe_path/aria_chk$suffix -dss $table`;
305+
$checksum2= my_exec2("$maria_exe_path/aria_chk$suffix -dss $table");
306306
if ("$checksum" ne "$checksum2")
307307
{
308308
print MY_LOG "checksum differs for $table before and after recovery\n";
@@ -311,7 +311,7 @@ sub check_table_is_same
311311

312312
$com= "diff $tmp/aria_chk_message.good.txt $tmp/aria_chk_message.txt ";
313313
$com.= "> $tmp/aria_chk_diff.txt || true";
314-
$res= `$com`;
314+
$res= my_exec2($com);
315315
print MY_LOG $res;
316316

317317
if (-s "$tmp/aria_chk_diff.txt")
@@ -455,6 +455,21 @@ sub my_exec
455455
return $res;
456456
}
457457

458+
sub my_exec2
459+
{
460+
my($command)= @_;
461+
my $res, $err;
462+
$res= `$command`;
463+
if ($? != 0 && $opt_abort_on_error)
464+
{
465+
$err= $?;
466+
print "$command\n";
467+
print "failed with error: $err\n";
468+
exit(1);
469+
}
470+
return $res;
471+
}
472+
458473

459474
####
460475
#### usage

0 commit comments

Comments
 (0)