From 3c07d04580fe5f28ff8bdabd1249b8123d7da76b Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 20 Feb 2012 14:03:44 +0200 Subject: [PATCH] Fixed lp:902654 "MariaDB consistently crashes in collect_tables on Aria checkpoint execution" This happend when you have more than 1024 open Aria tables during checkpoint. mysql-test/mysql-test-run.pl: Fixed that variable names are consistent between external and internal server. mysql-test/suite/maria/suite.pm: Test for aria-block-size instead of 'aria' as 'aria' is not set for embedded server. This should be ok for aria tests, as aria is never disabled for these. storage/maria/ma_checkpoint.c: Fixed bug when there are more than 1024 open Aria tables during checkpoint. --- mysql-test/mysql-test-run.pl | 14 ++++++++++---- mysql-test/suite/maria/suite.pm | 2 +- storage/maria/ma_checkpoint.c | 7 +++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index dc03a6bf5b5..9ccfe5df054 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1758,8 +1758,11 @@ sub collect_mysqld_features { # Put variables into hash if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ ) { - # print "$1=\"$2\"\n"; - $mysqld_variables{$1}= $2; + my $name= $1; + my $value=$2; + $name =~ s/_/-/g; + # print "$name=\"$value\"\n"; + $mysqld_variables{$name}= $value; } else { @@ -1813,8 +1816,11 @@ sub collect_mysqld_features_from_running_server () # Put variables into hash if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ ) { - # print "$1=\"$2\"\n"; - $mysqld_variables{$1}= $2; + my $name= $1; + my $value=$2; + $name =~ s/_/-/g; + # print "$name=\"$value\"\n"; + $mysqld_variables{$name}= $value; } } diff --git a/mysql-test/suite/maria/suite.pm b/mysql-test/suite/maria/suite.pm index e6efcdca829..3176782404b 100644 --- a/mysql-test/suite/maria/suite.pm +++ b/mysql-test/suite/maria/suite.pm @@ -2,7 +2,7 @@ package My::Suite::Maria; @ISA = qw(My::Suite); -return "Need Aria engine" unless $::mysqld_variables{'aria'} eq "ON"; +return "Need Aria engine" unless $::mysqld_variables{'aria-block-size'} > 0; bless { }; diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index 6576c365a47..002f2999e6c 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -908,6 +908,9 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon) */ } translog_unlock(); + if (state_copy == state_copies) + break; /* Nothing to do */ + /** We are going to flush these states. Before, all records describing how to undo such state must be @@ -932,13 +935,13 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon) if (translog_flush(state_copies_horizon)) goto err; /* now we have cached states and they are WAL-safe*/ - state_copies_end= state_copy; + state_copies_end= state_copy-1; state_copy= state_copies; } /* locate our state among these cached ones */ for ( ; state_copy->index != i; state_copy++) - DBUG_ASSERT(state_copy < state_copies_end); + DBUG_ASSERT(state_copy <= state_copies_end); /* OS file descriptors are ints which we stored in 4 bytes */ compile_time_assert(sizeof(int) <= 4);