summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-07-17 21:04:01 +0300
committerunknown <monty@hundin.mysql.fi>2001-07-17 21:04:01 +0300
commit9302266bde215864e1b70d0be583c3eaac6be898 (patch)
treef19e7e378a6170f04e3eebee868b77be238b17d7 /tests
parent782750a0ed04f80a40665f787f2debeba0a587a0 (diff)
downloadmariadb-git-9302266bde215864e1b70d0be583c3eaac6be898.tar.gz
Removed wrong warning from thr_lock
Fixed problem with UPDATE and BDB tables Fixed problem with GRANT FILE privilege on database level mysqld --warnings works now Fixed problem with SHOW OPEN TABLES when not using BDB Added some tests for ALTER TABLE to the test scripts Docs/manual.texi: Added link to copyleft license. Updated Changelog configure.in: Fixed typo mysys/thr_lock.c: Removed wrong warning sql/ha_berkeley.cc: Fixed problem with UPDATE sql/sql_acl.cc: Fixed problem with GRANT FILE privilege on database level sql/sql_parse.cc: Fixed that you don't get aborted connection error if you are not using --warning sql/sql_show.cc: Fixed problem with SHOW OPEN TABLES when not using BDB tests/fork2_test.pl: Added test of ALTER TABLE tests/fork_big.pl: Added test of ALTER TABLE
Diffstat (limited to 'tests')
-rwxr-xr-xtests/fork2_test.pl35
-rwxr-xr-xtests/fork_big.pl72
2 files changed, 101 insertions, 6 deletions
diff --git a/tests/fork2_test.pl b/tests/fork2_test.pl
index e8a579d9d81..b5564e99c3f 100755
--- a/tests/fork2_test.pl
+++ b/tests/fork2_test.pl
@@ -6,6 +6,9 @@
# the last 3 does different selects on the tables.
# Er, hmmm..., something like that :^)
# Modified to do crazy-join, à la Nasdaq.
+#
+# This test uses the old obsolete mysql interface. For a test that uses
+# DBI, please take a look at fork_big.pl
$opt_loop_count=10000; # Change this to make test harder/easier
@@ -26,8 +29,8 @@ GetOptions("host=s","db=s","loop-count=i","skip-create","skip-in",
"force") || die "Aborted";
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$Mysql::db_errstr=$opt_force=undef; # Ignore warnings from these
-print "Testing 9 multiple connections to a server with 1 insert/update\n";
-print "and 8 select connections.\n";
+print "Testing 10 multiple connections to a server with 1 insert/update\n";
+print "and 8 select connections and one ALTER TABLE.\n";
@testtables = qw(bench_f21 bench_f22 bench_f23 bench_f24 bench_f25);
@@ -83,6 +86,7 @@ test_2() if (($pid=fork()) == 0); $work{$pid}="simple3";
test_3() if (($pid=fork()) == 0); $work{$pid}="funny3";
test_2() if (($pid=fork()) == 0); $work{$pid}="simple4";
test_3() if (($pid=fork()) == 0); $work{$pid}="funny4";
+alter_test() if (($pid=fork()) == 0); $work{$pid}="alter";
$errors=0;
while (($pid=wait()) != -1)
@@ -205,6 +209,33 @@ sub test_3
exit(0);
}
+#
+# Do an ALTER TABLE every 20 seconds
+#
+sub alter_test
+{
+ my ($dbh,$count,$old_row_count,$row_count,$id,@row,$sth);
+ $dbh = Mysql->Connect($opt_host, $opt_db) || die $Mysql::db_errstr;
+ $id=$count=$row_count=0; $old_row_count= -1;
+ # Execute the test as long as we get more data into the table
+ while ($row_count != $old_row_count)
+ {
+ sleep(10);
+ $sth=$dbh->Query("ALTER TABLE $testtables[$id] modify info varchar(32)") or die "Couldn't execute ALTER TABLE\n";
+ $sth=0;
+ $id=($id+1) % $numtables;
+
+ # Test if insert test has ended
+ $sth=$dbh->query("select count(*) from $testtables[0]") or die "Couldn't execute count(*)\n";
+ @row = $sth->FetchRow();
+ $old_row_count= $row_count;
+ $row_count=$row[0];
+ $count++;
+ }
+ $dbh=0;
+ print "alter: Executed $count ALTER TABLE commands\n";
+ exit(0);
+}
diff --git a/tests/fork_big.pl b/tests/fork_big.pl
index 4009a9da71b..e082225604c 100755
--- a/tests/fork_big.pl
+++ b/tests/fork_big.pl
@@ -23,7 +23,7 @@ GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","s
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
print "Test of multiple connections that test the following things:\n";
-print "insert, select, delete, update, check, repair and flush\n";
+print "insert, select, delete, update, alter, check, repair and flush\n";
@testtables = ( ["bench_f31", ""],
["bench_f32", "row_format=fixed"],
@@ -34,7 +34,8 @@ $abort_table="bench_f39";
$numtables = $#testtables+1;
srand 100; # Make random numbers repeatable
-####
+
+####
#### Start timeing and start test
####
@@ -88,12 +89,14 @@ for ($i=0 ; $i < $opt_threads ; $i ++)
{
test_select() if (($pid=fork()) == 0); $work{$pid}="select_key";
}
+test_join() if (($pid=fork()) == 0); $work{$pid}="test_join";
test_select_count() if (($pid=fork()) == 0); $work{$pid}="select_count";
test_delete() if (($pid=fork()) == 0); $work{$pid}="delete";
test_update() if (($pid=fork()) == 0); $work{$pid}="update";
test_flush() if (($pid=fork()) == 0); $work{$pid}= "flush";
test_check() if (($pid=fork()) == 0); $work{$pid}="check";
test_repair() if (($pid=fork()) == 0); $work{$pid}="repair";
+test_alter() if (($pid=fork()) == 0); $work{$pid}="alter";
#test_database("test2") if (($pid=fork()) == 0); $work{$pid}="check_database";
print "Started " . ($opt_threads*2+4) . " threads\n";
@@ -244,6 +247,44 @@ sub test_select_count
}
#
+# select records
+# Do continously joins between the first and second table
+#
+
+sub test_join
+{
+ my ($dbh, $i, $j, $count, $loop);
+
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ $count_query=make_count_query($numtables);
+ $count=0;
+ $loop=9999;
+
+ $i=0;
+ while (($i++ % 100) || !test_if_abort($dbh))
+ {
+ if ($loop++ >= 100)
+ {
+ $loop=0;
+ $row_counts=simple_query($dbh, $count_query);
+ }
+ for ($j=0 ; $j < $numtables-1 ; $j++)
+ {
+ my ($id)= int rand $row_counts->[$j];
+ my ($t1,$t2)= ($testtables[$j]->[0],$testtables[$j+1]->[0]);
+ simple_query($dbh, "select $t1.id,$t2.info from $t1, $t2 where $t1.id=$t2.id and $t1.id=$id");
+ $count++;
+ }
+ }
+ $dbh->disconnect; $dbh=0;
+ print "Test_join: Executed $count joins\n";
+ exit(0);
+}
+
+#
# Delete 1-5 rows from the first 2 tables.
# Test ends when the number of rows for table 3 didn't change during
# one loop
@@ -457,6 +498,29 @@ sub test_database
exit(0);
}
+#
+# Test ALTER TABLE on the second table
+#
+
+sub test_alter
+{
+ my ($dbh, $row, $i, $type, $table);
+ $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
+ $opt_user, $opt_password,
+ { PrintError => 0}) || die $DBI::errstr;
+
+ for ($i=0 ; !test_if_abort($dbh) ; $i++)
+ {
+ sleep(100);
+ $table=$testtables[1]->[0];
+ $sth=$dbh->prepare("ALTER table $table modify info char(32)") || die "Got error on prepare: $DBI::errstr\n";
+ $sth->execute || die $DBI::errstr;
+ }
+ $dbh->disconnect; $dbh=0;
+ print "test_alter: Executed $i ALTER TABLE\n";
+ exit(0);
+}
+
#
# Help functions
@@ -507,8 +571,8 @@ sub simple_query()
my ($dbh, $query)= @_;
my ($sth,$row);
- $sth=$dbh->prepare($query) || die "Got error on '$query': $DBI::errstr\n";
- $sth->execute || die "Got error on '$query': $dbh->errstr\n";
+ $sth=$dbh->prepare($query) || die "Got error on '$query': " . $dbh->errstr . "\n";
+ $sth->execute || die "Got error on '$query': " . $dbh->errstr . "\n";
$row= $sth->fetchrow_arrayref();
$sth=0;
return $row;