diff options
-rw-r--r-- | storage/maria/ma_loghandler.c | 1 | ||||
-rwxr-xr-x | storage/maria/ma_test_force_start.pl | 3 | ||||
-rw-r--r-- | storage/maria/trnman.c | 21 |
3 files changed, 15 insertions, 10 deletions
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 93b7d5e84c9..582095221d3 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -6147,6 +6147,7 @@ my_bool translog_write_record(LSN *lsn, LSN dummy_lsn; LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 1]; uchar log_data[6]; + DBUG_ASSERT(trn->undo_lsn == LSN_IMPOSSIBLE); int6store(log_data, trn->trid); log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data; log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); diff --git a/storage/maria/ma_test_force_start.pl b/storage/maria/ma_test_force_start.pl index 3aa6da5f5dc..7ab8190a738 100755 --- a/storage/maria/ma_test_force_start.pl +++ b/storage/maria/ma_test_force_start.pl @@ -42,7 +42,8 @@ my $sql_name= "./var/tmp/create_table.sql"; my $error_log_name= "./var/log/master.err"; my @cmd_output; my $whatever; # garbage data -my $base_server_cmd= "perl mysql-test-run.pl --mysqld=--maria-force-start-after-recovery-failures=$force_after maria-recover ";
+$ENV{MTR_VERSION} = 1; # MTR2 does not have --start-and-exit +my $base_server_cmd= "perl mysql-test-run.pl --mysqld=--maria-force-start-after-recovery-failures=$force_after --suite=maria maria.maria-recover ";
if ($^O =~ /^mswin/i) { print <<EOF; diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c index 06b3b828d50..43fac68806f 100644 --- a/storage/maria/trnman.c +++ b/storage/maria/trnman.c @@ -712,11 +712,6 @@ my_bool trnman_collect_transactions(LEX_STRING *str_act, LEX_STRING *str_com, ptr+= TRANSID_SIZE; for (trn= active_list_min.next; trn != &active_list_max; trn= trn->next) { - /* - trns with a short trid of 0 are not even initialized, we can ignore - them. trns with undo_lsn==0 have done no writes, we can ignore them - too. XID not needed now. - */ uint sid; LSN rec_lsn, undo_lsn, first_undo_lsn; pthread_mutex_lock(&trn->state_lock); @@ -732,16 +727,24 @@ my_bool trnman_collect_transactions(LEX_STRING *str_act, LEX_STRING *str_com, */ continue; } - /* needed for low-water mark calculation */ + /* needed for low-water mark calculation */ if (((rec_lsn= lsn_read_non_atomic(trn->rec_lsn)) > 0) && (cmp_translog_addr(rec_lsn, minimum_rec_lsn) < 0)) minimum_rec_lsn= rec_lsn; /* - trn may have logged REDOs but not yet UNDO, that's why we read rec_lsn - before deciding to ignore if undo_lsn==0. + If trn has not logged LOGREC_LONG_TRANSACTION_ID, this trn will be + discovered when seeing that log record which is for sure located after + checkpoint_start_log_horizon. */ - if ((undo_lsn= trn->undo_lsn) == 0) /* trn can be forgotten */ + if ((LSN_WITH_FLAGS_TO_FLAGS(trn->first_undo_lsn) & + TRANSACTION_LOGGED_LONG_ID) == 0) continue; + /* + On the other hand, if undo_lsn is LSN_IMPOSSIBLE, trn may later log + records; so we must include trn in the checkpoint now, because we cannot + count on LOGREC_LONG_TRANSACTION_ID (as we are already past it). + */ + undo_lsn= trn->undo_lsn; stored_transactions++; int2store(ptr, sid); ptr+= 2; |