summaryrefslogtreecommitdiff
path: root/tests/big_record.pl
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-05-13 10:54:07 +0300
committerunknown <monty@mashka.mysql.fi>2003-05-13 10:54:07 +0300
commit10c790eff016ff0fc779baeb7ebf94940d3544e7 (patch)
tree911f869319dc53526bc2bb909aa87944db9d2696 /tests/big_record.pl
parent504fd4d43990e507b685eb336ee672c637ecf4cb (diff)
downloadmariadb-git-10c790eff016ff0fc779baeb7ebf94940d3544e7.tar.gz
Safety fix to enable RAID in max binaries
Better fix for format('nan') Fix for HAVING COUNT(DISTINCT...) myisam/mi_check.c: Better error message myisam/mi_dynrec.c: Simple code cleanup myisam/myisamchk.c: Better error messages mysql-test/r/func_misc.result: Added back test for format('nan') mysql-test/r/having.result: New test mysql-test/t/func_misc.test: Added back test for format('nan') mysql-test/t/having.test: Added test for count(distinct) in having mysys/raid.cc: Safety fix to enable RAID in max binaries scripts/mysql_install_db.sh: Create data directories even if --in-rpm is used (for MaxOSX) sql/item_strfunc.cc: Better fix for format('nan') sql/mysqld.cc: Give stacktrace on assert() sql/sql_yacc.yy: Fix for HAVING COUNT(DISTINCT...) tests/big_record.pl: Extend test to abuse packed MyISAM tables tests/table_types.pl: Fixed wrong merge
Diffstat (limited to 'tests/big_record.pl')
-rwxr-xr-xtests/big_record.pl41
1 files changed, 34 insertions, 7 deletions
diff --git a/tests/big_record.pl b/tests/big_record.pl
index 08547b50823..fbe94e3540f 100755
--- a/tests/big_record.pl
+++ b/tests/big_record.pl
@@ -11,12 +11,13 @@ use Getopt::Long;
$opt_host="";
$opt_user=$opt_password="";
$opt_db="test";
-$opt_rows=200; # Test of blobs up to ($rows-1)*100000+1 bytes
+$opt_rows=20; # Test of blobs up to ($rows-1)*100000+1 bytes
$opt_compress=0;
$opt_table="test_big_record";
+$opt_loop_count=100000; # Change this to make test harder/easier
GetOptions("host=s","db=s","user=s", "password=s", "table=s", "rows=i",
- "compress") || die "Aborted";
+ "compress", "loop-count=i") || die "Aborted";
print "Connection to database $test_db\n";
@@ -42,12 +43,12 @@ $|=1; # Flush output to stdout to be able to monitor process
for ($i=0 ; $i < $opt_rows ; $i++)
{
$tmp= chr(65+($i % 16)) x ($i*100000+1);
- print $i," ",length($tmp),"\n";
$tmp= $dbh->quote($tmp);
$dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
+ print ".";
}
-print "Reading records\n";
+print "\nReading records\n";
$sth=$dbh->prepare("select * from $opt_table", { "mysql_use_result" => 1}) or die $dbh->errstr;
@@ -56,14 +57,40 @@ $sth->execute() or die $sth->errstr;
$i=0;
while (($row = $sth->fetchrow_arrayref))
{
- print $row->[0]," ",length($row->[1]),"\n";
die "Record $i had wrong data in blob" if ($row->[1] ne (chr(65+($i % 16)) x ($i*100000+1)));
$i++;
}
die "Didn't get all rows from server" if ($i != $opt_rows);
-$dbh->do("drop table $opt_table") or die $DBI::errstr;
+#
+# Test by insert/updating/deleting random rows for a while
+#
-print "Test ok\n";
+print "Testing insert/update/delete\n";
+
+$max_row_id= $rows;
+for ($i= 0 ; $i < $opt_loop_count ; $i++)
+{
+ $length= int(rand 65535);
+ $tmp= chr(65+($i % 16)) x $length;
+ $tmp= $dbh->quote($tmp);
+ $dbh->do("insert into $opt_table (test) values ($tmp)") or die $DBI::errstr;
+ $max_row_id++;
+ $length=int(rand 65535);
+ $tmp= chr(65+($i % 16)) x $length;
+ $tmp= $dbh->quote($tmp);
+ $id= int(rand $max_row_id);
+ $dbh->do("update $opt_table set test= $tmp where auto= $id") or die $DBI::errstr;
+ if (($i % 2) == 1)
+ {
+ $id= int(rand $max_row_id);
+ $dbh->do("delete from $opt_table where auto= $id") or die $DBI::errstr;
+ }
+ print "." if ($i % ($opt_loop_count/100) == 1);
+}
+
+# $dbh->do("drop table $opt_table") or die $DBI::errstr;
+
+print "\nTest ok\n";
exit 0;