Commit 032ef1fa authored by Michael Widenius's avatar Michael Widenius

Merge with trunk

parents 46db8aac 90151609
...@@ -9,6 +9,7 @@ package My::Test; ...@@ -9,6 +9,7 @@ package My::Test;
use strict; use strict;
use warnings; use warnings;
use Carp; use Carp;
use Storable();
sub new { sub new {
...@@ -30,18 +31,6 @@ sub key { ...@@ -30,18 +31,6 @@ sub key {
} }
sub _encode {
my ($value)= @_;
$value =~ s/([|\\\x{0a}\x{0d}])/sprintf('\%02X', ord($1))/eg;
return $value;
}
sub _decode {
my ($value)= @_;
$value =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/ge;
return $value;
}
sub is_failed { sub is_failed {
my ($self)= @_; my ($self)= @_;
my $result= $self->{result}; my $result= $self->{result};
...@@ -58,66 +47,22 @@ sub write_test { ...@@ -58,66 +47,22 @@ sub write_test {
# Give the test a unique key before serializing it # Give the test a unique key before serializing it
$test->{key}= "$test" unless defined $test->{key}; $test->{key}= "$test" unless defined $test->{key};
print $sock $header, "\n"; my $serialized= Storable::freeze($test);
while ((my ($key, $value)) = each(%$test)) { $serialized =~ s/([\x0d\x0a\\])/sprintf("\\%02x", ord($1))/eg;
print $sock $key, "= "; print $sock $header, "\n", $serialized, "\n";
if (ref $value eq "ARRAY") {
print $sock "[", _encode(join(", ", @$value)), "]";
} else {
print $sock _encode($value);
}
print $sock "\n";
}
print $sock "\n";
} }
sub read_test { sub read_test {
my ($sock)= @_; my ($sock)= @_;
my $test= My::Test->new(); my $serialized= <$sock>;
# Read the : separated key value pairs until a chomp($serialized);
# single newline on it's own line $serialized =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/eg;
my $line; my $test= Storable::thaw($serialized);
while (defined($line= <$sock>)) { die "wrong class (hack attempt?)"
# List is terminated by newline on it's own unless ref($test) eq 'My::Test';
if ($line eq "\n") {
# Correctly terminated reply
# print "Got newline\n";
last;
}
chomp($line);
# Split key/value on the first "="
my ($key, $value)= split("= ", $line, 2);
if ($value =~ /^\[(.*)\]/){
my @values= split(", ", _decode($1));
push(@{$test->{$key}}, @values);
}
else
{
$test->{$key}= _decode($value);
}
}
return $test; return $test;
} }
sub print_test {
my ($self)= @_;
print "[", $self->{name}, "]", "\n";
while ((my ($key, $value)) = each(%$self)) {
print " ", $key, "= ";
if (ref $value eq "ARRAY") {
print "[", join(", ", @$value), "]";
} else {
print $value;
}
print "\n";
}
print "\n";
}
1; 1;
...@@ -799,15 +799,6 @@ sub collect_one_test_case { ...@@ -799,15 +799,6 @@ sub collect_one_test_case {
push(@{$tinfo->{'master_opt'}}, @$suite_opts); push(@{$tinfo->{'master_opt'}}, @$suite_opts);
push(@{$tinfo->{'slave_opt'}}, @$suite_opts); push(@{$tinfo->{'slave_opt'}}, @$suite_opts);
#-----------------------------------------------------------------------
# Check for test specific config file
#-----------------------------------------------------------------------
my $test_cnf_file= "$testdir/$tname.cnf";
if ( -f $test_cnf_file) {
# Specifies the configuration file to use for this test
$tinfo->{'template_path'}= $test_cnf_file;
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Check for test specific config file # Check for test specific config file
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
......
This diff is collapsed.
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# Test of update statement that uses many tables. # Test of update statement that uses many tables.
# #
# This is a big test.
--source include/big_test.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2; DROP TABLE IF EXISTS t1,t2;
--enable_warnings --enable_warnings
......
...@@ -333,6 +333,8 @@ struct st_translog_descriptor ...@@ -333,6 +333,8 @@ struct st_translog_descriptor
my_bool is_everything_flushed; my_bool is_everything_flushed;
/* True when flush pass is in progress */ /* True when flush pass is in progress */
my_bool flush_in_progress; my_bool flush_in_progress;
/* The flush number (used to distinguish two flushes goes one by one) */
volatile int flush_no;
/* Next flush pass variables */ /* Next flush pass variables */
TRANSLOG_ADDRESS next_pass_max_lsn; TRANSLOG_ADDRESS next_pass_max_lsn;
pthread_t max_lsn_requester; pthread_t max_lsn_requester;
...@@ -3484,6 +3486,8 @@ my_bool translog_init_with_table(const char *directory, ...@@ -3484,6 +3486,8 @@ my_bool translog_init_with_table(const char *directory,
id_to_share= NULL; id_to_share= NULL;
log_descriptor.directory_fd= -1; log_descriptor.directory_fd= -1;
log_descriptor.is_everything_flushed= 1; log_descriptor.is_everything_flushed= 1;
log_descriptor.flush_in_progress= 0;
log_descriptor.flush_no= 0;
log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE; log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE;
(*init_table_func)(); (*init_table_func)();
...@@ -7548,6 +7552,7 @@ void translog_flush_wait_for_end(LSN lsn) ...@@ -7548,6 +7552,7 @@ void translog_flush_wait_for_end(LSN lsn)
void translog_flush_set_new_goal_and_wait(TRANSLOG_ADDRESS lsn) void translog_flush_set_new_goal_and_wait(TRANSLOG_ADDRESS lsn)
{ {
int flush_no= log_descriptor.flush_no;
DBUG_ENTER("translog_flush_set_new_goal_and_wait"); DBUG_ENTER("translog_flush_set_new_goal_and_wait");
DBUG_PRINT("enter", ("LSN: (%lu,0x%lx)", LSN_IN_PARTS(lsn))); DBUG_PRINT("enter", ("LSN: (%lu,0x%lx)", LSN_IN_PARTS(lsn)));
safe_mutex_assert_owner(&log_descriptor.log_flush_lock); safe_mutex_assert_owner(&log_descriptor.log_flush_lock);
...@@ -7556,7 +7561,7 @@ void translog_flush_set_new_goal_and_wait(TRANSLOG_ADDRESS lsn) ...@@ -7556,7 +7561,7 @@ void translog_flush_set_new_goal_and_wait(TRANSLOG_ADDRESS lsn)
log_descriptor.next_pass_max_lsn= lsn; log_descriptor.next_pass_max_lsn= lsn;
log_descriptor.max_lsn_requester= pthread_self(); log_descriptor.max_lsn_requester= pthread_self();
} }
while (log_descriptor.flush_in_progress) while (flush_no == log_descriptor.flush_no)
{ {
pthread_cond_wait(&log_descriptor.log_flush_cond, pthread_cond_wait(&log_descriptor.log_flush_cond,
&log_descriptor.log_flush_lock); &log_descriptor.log_flush_lock);
...@@ -7735,6 +7740,7 @@ my_bool translog_flush(TRANSLOG_ADDRESS lsn) ...@@ -7735,6 +7740,7 @@ my_bool translog_flush(TRANSLOG_ADDRESS lsn)
if (sent_to_disk != LSN_IMPOSSIBLE) if (sent_to_disk != LSN_IMPOSSIBLE)
log_descriptor.flushed= sent_to_disk; log_descriptor.flushed= sent_to_disk;
log_descriptor.flush_in_progress= 0; log_descriptor.flush_in_progress= 0;
log_descriptor.flush_no++;
DBUG_PRINT("info", ("flush_in_progress is dropped")); DBUG_PRINT("info", ("flush_in_progress is dropped"));
pthread_mutex_unlock(&log_descriptor.log_flush_lock);\ pthread_mutex_unlock(&log_descriptor.log_flush_lock);\
pthread_cond_broadcast(&log_descriptor.log_flush_cond); pthread_cond_broadcast(&log_descriptor.log_flush_cond);
......
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