Commit 38da1f98 authored by unknown's avatar unknown

Fix for IO_CACHE.

Portability fixes.


BUILD/compile-alpha-debug:
  Update to newer version
libmysqld/lib_vio.c:
  dbug_assert -> DBUG_ASSERT
mysql-test/r/symlink.result:
  Update for new tests
mysql-test/t/symlink.test:
  Update for new test format
mysys/mf_iocache2.c:
  Fixed bug when reading in old buffer
sql-bench/test-transactions.sh:
  Update with delete tests
sql/mysqld.cc:
  Updates for amiga
sql/sql_string.cc:
  Fix typo
sql/stacktrace.c:
  Portability fix
parent da9b7e0c
/bin/rm -f */.deps/*.P */*.o
make -k clean
/bin/rm -f */.deps/*.P
/bin/rm -f config.cache
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache mysql-*.tar.gz
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS=-O6 CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex
CFLAGS=-O1 CC=gcc CXX=gcc CXXFLAGS="-O1 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex --without-extra-tools
make
......@@ -110,7 +110,7 @@ int vio_read(Vio * vio, gptr buf, int size)
vio->reading = 1;
if (vio->where_in_packet >= vio->end_of_packet)
{
dbug_assert(vio->packets);
DBUG_ASSERT(vio->packets);
vio->where_in_packet = vio->packets + sizeof(char *) + 4;
vio->end_of_packet = vio->where_in_packet +
uint4korr(vio->packets + sizeof(char *));
......
......@@ -21,7 +21,6 @@ insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;
create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="/home/sasha/bk/mysql-4.0/mysql-test/var/tmp" index directory="/home/sasha/bk/mysql-4.0/mysql-test/var/run";
insert into t9 select * from t1;
check table t9;
Table Op Msg_type Msg_text
......@@ -45,18 +44,11 @@ alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
drop table t1;
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
Incorrect table name 'tmp'
drop database if exists test_mysqltest;
create database test_mysqltest;
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
Can't create/write to file '/this-dir-does-not-exist/t9.MYI' (Errcode: 2)
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
Incorrect table name 'not-hard-path'
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/home/sasha/bk/mysql-4.0/mysql-test/var/run";
Can't create/write to file '/home/sasha/bk/mysql-4.0/mysql-test/var/run/t9.MYI' (Errcode: 17)
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="/home/sasha/bk/mysql-4.0/mysql-test/var/tmp";
Can't create/write to file '/home/sasha/bk/mysql-4.0/mysql-test/var/tmp/t9.MYD' (Errcode: 17)
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
alter table t9 rename test_mysqltest.t9;
select count(*) from test_mysqltest.t9;
count(*)
......
-- require r/have_symlink.require
disable_query_log;
show variables like "have_symlink";
enable_query_log;
#
# First create little data to play with
......@@ -33,7 +35,10 @@ drop table t2;
# We use t9 here to not crash with tables generated by the backup test
#
disable_query_log;
eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
enable_query_log;
insert into t9 select * from t1;
check table t9;
optimize table t9;
......@@ -53,7 +58,8 @@ drop table t1;
# Note that we are using the above table t9 here!
#
--error 1103
disable_query_log;
--error 1103,1103
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
# Check that we cannot link over a table from another database.
......@@ -61,17 +67,18 @@ create table t1 (a int not null auto_increment, b char(16) not null, primary key
drop database if exists test_mysqltest;
create database test_mysqltest;
--error 1
--error 1,1
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
--error 1103
--error 1103,1103
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
--error 1
--error 1,1
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run";
--error 1
--error 1,1
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;
# Check moving table t9 from default database to test_mysqltest;
# In this case the symlinks should be removed.
......
......@@ -32,17 +32,16 @@
void my_b_seek(IO_CACHE *info,my_off_t pos)
{
my_off_t offset = (pos - info->pos_in_file);
DBUG_ENTER("my_b_seek");
DBUG_PRINT("enter",("pos: %lu", (ulong) pos));
if (info->type == READ_CACHE)
{
byte* try_pos=info->read_pos + (pos - info->pos_in_file);
if (try_pos >= info->buffer &&
try_pos <= info->read_end)
if ((ulonglong) offset < (ulonglong) (info->read_end - info->buffer))
{
/* The position is in the current buffer; Reuse it */
info->read_pos = try_pos;
/* The read is in the current buffer; Reuse it */
info->read_pos = info->buffer + offset;
DBUG_VOID_RETURN;
}
else
......@@ -53,17 +52,14 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
}
else if (info->type == WRITE_CACHE)
{
byte* try_pos;
/* If write is in current buffer, reuse it */
try_pos = info->write_pos + (pos - info->pos_in_file);
if (try_pos >= info->write_buffer &&
try_pos <= info->write_end)
if ((ulonglong) offset <
(ulonglong) (info->write_end - info->write_buffer))
{
info->write_pos = try_pos;
info->write_pos = info->write_buffer + offset;
DBUG_VOID_RETURN;
}
else
flush_io_cache(info);
flush_io_cache(info);
}
info->pos_in_file=pos;
info->seek_not_done=1;
......
#!@PERL@
#
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
#
# This library is free software; you can redistribute it and/or
......@@ -28,7 +27,7 @@ use warnings;
$opt_groups=27; # Characters are 'A' -> Z
$opt_loop_count=100000; # Change this to make test harder/easier
$opt_loop_count=10000; # Change this to make test harder/easier
$opt_medium_loop_count=100; # Change this to make test harder/easier
chomp($pwd = `pwd`); $pwd = "." if ($pwd eq '');
......@@ -114,86 +113,109 @@ sub test_insert
}
###
### Test update perfomance
### Test rollback performance
###
test_update("bench1","update_commit",0);
test_update("bench2","update_autocommit",1);
print "Test transactions rollback performance\n" if($opt_debug);
##
## Insert rollback test
##
#
# Test is done by inserting 100 rows in a table with lots of rows and
# then doing a rollback on these
#
sub test_update
{
my ($table, $test_name, $auto_commit)= @_;
my ($loop_time,$end_time,$id);
my ($id,$rev_id,$grp,$region,$end,$loop_time,$end_time,$commit_loop,$count);
$dbh->{AutoCommit}= $auto_commit;
$dbh->{AutoCommit} = 0;
$loop_time=new Benchmark;
$end=$opt_loop_count*2;
$count=0;
for ($id=0 ; $id < $opt_loop_count ; $id++)
for ($commit_loop=1, $id=$opt_loop_count ; $id < $end ;
$id++, $commit_loop++)
{
do_query($dbh,"update bench1 set updated=1 where idn=$id");
$rev_id=$end-$id;
$grp=$id/$opt_groups;
$region=chr(65+$id%$opt_groups);
do_query($dbh,"insert into bench1 values ($id,$rev_id,'$region',$grp,0)");
if ($commit_loop >= $opt_medium_loop_count)
{
$dbh->rollback;
$commit_loop=0;
$count++;
}
}
if ($commit_loop > 1)
{
$dbh->rollback;
$count++;
}
$dbh->commit if (!$auto_commit);
$end_time=new Benchmark;
print "Time for $test_name ($opt_loop_count): " .
print "Time for insert_rollback ($count:$opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
###
### Test delete perfomance
###
##
## Update rollback test
##
test_delete("bench1","delete_commit",0);
test_delete("bench2","delete_autocommit",1);
#
# Test is done by updating 100 rows in a table with lots of rows and
# then doing a rollback on these
#
sub test_delete
{
my ($table, $test_name, $auto_commit)= @_;
my ($loop_time,$end_time,$id);
my ($id,$loop_time,$end_time,$commit_loop,$count);
$dbh->{AutoCommit}= $auto_commit;
$dbh->{AutoCommit} = 0;
$loop_time=new Benchmark;
$end=$opt_loop_count*2;
$count=0;
for ($id=0 ; $id < $opt_loop_count ; $id++)
{
do_query($dbh,"delete from $table where idn=$id");
for ($commit_loop=1, $id=0 ; $id < $opt_loop_count ; $id++, $commit_loop++)
{
do_query($dbh,"update bench1 set updated=2 where idn=$id");
if ($commit_loop >= $opt_medium_loop_count)
{
$dbh->rollback;
$commit_loop=0;
$count++;
}
}
if ($commit_loop > 1)
{
$dbh->rollback;
$count++;
}
$dbh->commit if (!$auto_commit);
$end_time=new Benchmark;
print "Time for $test_name ($opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
print "Time for update_rollback ($count:$opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
###
### Test rollback performance
###
print "Test transactions rollback performance\n" if($opt_debug);
##
## Insert rollback test
## Delete rollback test
##
#
# Test is done by inserting 10 rows in a table with lots of rows and
# Test is done by deleting 100 rows in a table with lots of rows and
# then doing a rollback on these
#
{
my ($id,$rev_id,$grp,$region,$end,$loop_time,$end_time,$commit_loop,$count);
my ($id,$loop_time,$end_time,$commit_loop,$count);
$dbh->{AutoCommit} = 0;
$loop_time=new Benchmark;
$end=$opt_loop_count*2;
$count=0;
for ($commit_loop=1, $id=$opt_loop_count ; $id < $end ;
$id++, $commit_loop++)
for ($commit_loop=1, $id=0 ; $id < $opt_loop_count ; $id++, $commit_loop++)
{
$rev_id=$end-$id;
$grp=$id/$opt_groups;
$region=chr(65+$id%$opt_groups);
do_query($dbh,"insert into bench1 values ($id,$rev_id,'$region',$grp,0)");
do_query($dbh,"delete from bench1 where idn=$id");
if ($commit_loop >= $opt_medium_loop_count)
{
$dbh->rollback;
......@@ -207,56 +229,62 @@ print "Test transactions rollback performance\n" if($opt_debug);
$count++;
}
$end_time=new Benchmark;
print "Time for insert_rollback ($count:$opt_loop_count): " .
print "Time for delete_rollback ($count:$opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
###
### Update rollback test
### Test update perfomance
###
if (0)
{
test_update("bench1","update_commit",0);
test_update("bench2","update_autocommit",1);
$dbh->{AutoCommit} = 0;
sub test_update
{
my ($table, $test_name, $auto_commit)= @_;
my ($loop_time,$end_time,$id);
$dbh->{AutoCommit}= $auto_commit;
$loop_time=new Benchmark;
for ($id=0,$rev_id=$opt_medium_loop_count ; $id < $opt_medium_loop_count; $id++,$rev_id--)
for ($id=0 ; $id < $opt_loop_count ; $id++)
{
$grp=$id/$opt_groups;
$region=chr(65+$id%$opt_groups);
do_query($dbh,"update bench1 set region='$region',grp=$grp where idn=$id");
do_query($dbh,"update bench1 set updated=1 where idn=$id");
}
$dbh->rollback;
$dbh->commit if (!$auto_commit);
$end_time=new Benchmark;
print "Time for update rollback (" . ($opt_medium_loop_count) . "): " .
print "Time for $test_name ($opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
### Delete rollback test
$dbh->{AutoCommit} = 0;
###
### Test delete perfomance
###
$loop_time=new Benchmark;
test_delete("bench1","delete_commit",0);
test_delete("bench2","delete_autocommit",1);
for ($id=0,$rev_id=$opt_medium_loop_count; $id < $opt_medium_loop_count; $id++,$rev_id--)
{
$grp=$id/$opt_groups;
$region=chr(65+$id%$opt_groups);
do_query($dbh,"delete from bench1 where idn=$id");
}
sub test_delete
{
my ($table, $test_name, $auto_commit)= @_;
my ($loop_time,$end_time,$id);
$dbh->rollback;
$dbh->{AutoCommit}= $auto_commit;
$loop_time=new Benchmark;
for ($id=0 ; $id < $opt_loop_count ; $id++)
{
do_query($dbh,"delete from $table where idn=$id");
}
$dbh->commit if (!$auto_commit);
$end_time=new Benchmark;
print "Time for delete rollback (" . ($opt_medium_loop_count) . "): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
$dbh->{AutoCommit} = 1;
print "Time for $test_name ($opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
####
#### End of benchmark
####
......
......@@ -686,6 +686,11 @@ pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
}
#endif
#if defined(__amiga__)
#undef sigset
#define sigset signal
#endif
static sig_handler print_signal_warning(int sig)
{
sql_print_error("Warning: Got signal %d from thread %d",
......@@ -1310,7 +1315,11 @@ static void init_signals(void)
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
init_stacktrace();
#if defined(__amiga__)
sa.sa_handler=(void(*)())handle_segfault;
#else
sa.sa_handler=handle_segfault;
#endif
sigaction(SIGSEGV, &sa, NULL);
#ifdef SIGBUS
sigaction(SIGBUS, &sa, NULL);
......
......@@ -779,10 +779,10 @@ int wild_compare(const char *str,const char *str_end,
{
while (str != str_end && *str != cmp)
str++;
if (str++ == str_end)
if (str++ == str_end)
{
DBUG_RETURN(-1)
};
DBUG_RETURN(-1);
}
{
int tmp=wild_compare(str,str_end,wildstr,wildend,escape);
if (tmp <= 0)
......
......@@ -218,7 +218,7 @@ void write_core(int sig)
{
signal(sig, SIG_DFL);
pthread_kill(pthread_self(), sig);
#if defined(P_MYID)
#if defined(P_MYID) && !defined(SCO)
/* On Solaris, the above kill is not enough */
sigsend(P_PID,P_MYID,sig);
#endif
......
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