From d0fb8270dfa785392c2bc3ad4ffd61329586d887 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 8 Dec 2008 20:31:16 +0200 Subject: [PATCH] Fixed problem with crash in Maria _ma_setup_live_state() where history link didn't include needed state mysql-test/mysql-test-run.pl: Remove warnings in log about depricated mysqld options storage/maria/ma_state.c: More DBUG_PRINT storage/maria/trnman.c: Fixed wrong test if commit_trid is visible --- mysql-test/mysql-test-run.pl | 12 ++++++++---- storage/maria/ma_state.c | 4 ++++ storage/maria/trnman.c | 7 ++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7658b73a6aa..5dbef8d0957 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3325,9 +3325,11 @@ socket = $instance->{path_sock} pid-file = $instance->{path_pid} port = $instance->{port} datadir = $instance->{path_datadir} -log = $instance->{path_datadir}/mysqld$server_id.log +general-log-file = $instance->{path_datadir}/mysqld$server_id.log +general-log = 1 log-error = $instance->{path_datadir}/mysqld$server_id.err.log -log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log +slow-query-log-file = $instance->{path_datadir}/mysqld$server_id.slow.log +slow-query-log = 1 language = $path_language character-sets-dir = $path_charsetsdir basedir = $path_my_basedir @@ -4004,9 +4006,11 @@ sub mysqld_arguments ($$$$) { } my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx"; - mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path); + mtr_add_arg($args, "%s--general-log-file=%s.log --general-log", + $prefix, $log_base_path); mtr_add_arg($args, - "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path); + "%s--slow-query-log-file=%s-slow.log --slow-query-log", + $prefix, $log_base_path); # Check if "extra_opt" contains --skip-log-bin my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt); diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c index a4b002dec64..071088c245d 100644 --- a/storage/maria/ma_state.c +++ b/storage/maria/ma_state.c @@ -155,6 +155,8 @@ MARIA_STATE_HISTORY if (!trnman_exists_active_transactions(history->trid, last_trid, trnman_is_locked)) { + DBUG_PRINT("info", ("removing history->trid: %lu next: %lu", + (ulong) history->trid, (ulong) last_trid)); my_free(history, MYF(0)); continue; } @@ -423,6 +425,8 @@ my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit, { /* Previous history can't be seen by anyone, reuse old memory */ history= share->state_history; + DBUG_PRINT("info", ("removing history->trid: %lu new: %lu", + (ulong) history->trid, (ulong) trn->commit_trid)); } history->state.records+= (tables->state_current.records - diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c index 538dc75b663..09c8f9a264f 100644 --- a/storage/maria/trnman.c +++ b/storage/maria/trnman.c @@ -876,7 +876,12 @@ my_bool trnman_exists_active_transactions(TrID min_id, TrID max_id, pthread_mutex_lock(&LOCK_trn_list); for (trn= active_list_min.next; trn != &active_list_max; trn= trn->next) { - if (trn->trid > min_id && trn->trid < max_id) + /* + We use >= for min_id as min_id is a commit_trid and trn->trid + is transaction id. In the case they are the same, then the + trn started after the min_id was committed. + */ + if (trn->trid >= min_id && trn->trid < max_id) { ret= 1; break;