summaryrefslogtreecommitdiff
path: root/sql-bench/innotest2a.sh
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-08-15 22:22:56 +0300
committerunknown <heikki@hundin.mysql.fi>2002-08-15 22:22:56 +0300
commitc1b7c246c1f6d204bb011151f914f7563c70a79b (patch)
tree6b92d11fd72f4e43d84c63f22934a74970b76ab6 /sql-bench/innotest2a.sh
parent6fbcad539d7f3c96dca4aa3cfdf4d28ee0d4ced2 (diff)
downloadmariadb-git-c1b7c246c1f6d204bb011151f914f7563c70a79b.tar.gz
Many files:
Add multithreaded stress tests for InnoDB new file sql-bench/innotest1.sh: Add multithreaded stress tests for InnoDB sql-bench/innotest1a.sh: Add multithreaded stress tests for InnoDB sql-bench/innotest1b.sh: Add multithreaded stress tests for InnoDB sql-bench/innotest2.sh: Add multithreaded stress tests for InnoDB sql-bench/innotest2a.sh: Add multithreaded stress tests for InnoDB sql-bench/innotest2b.sh: Add multithreaded stress tests for InnoDB sql-bench/Makefile.am: Add multithreaded stress tests for InnoDB
Diffstat (limited to 'sql-bench/innotest2a.sh')
-rw-r--r--sql-bench/innotest2a.sh93
1 files changed, 93 insertions, 0 deletions
diff --git a/sql-bench/innotest2a.sh b/sql-bench/innotest2a.sh
new file mode 100644
index 00000000000..e0fe2001d24
--- /dev/null
+++ b/sql-bench/innotest2a.sh
@@ -0,0 +1,93 @@
+#!@PERL@
+############################################################################
+# Stress test for MySQL/Innobase combined database
+# (c) 2000 Innobase Oy & MySQL AB
+#
+############################################################################
+
+use DBI;
+use Benchmark;
+
+$opt_loop_count = 100000;
+
+chomp($pwd = `pwd`); $pwd = "." if ($pwd eq '');
+require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
+
+print "Innotest2a: MySQL/InnoDB stress test in Perl for FOREIGN keys\n";
+print "------------------------------------------------------------\n";
+print "This is a randomized stress test for concurrent inserts,\n";
+print "updates, deletes, commits and rollbacks with foreign keys with\n";
+print "the ON DELETE ... clause. The test will generate\n";
+print "also a lot of deadlocks, duplicate key errors, and other SQL errors.\n";
+print "\n";
+print "You should run innotest2, innotest2a, and innotest2b concurrently.\n";
+print "The thing to watch is that the server does not crash or does not\n";
+print "print to the .err log anything. Currently, due to a buglet in MySQL,\n";
+print "warnings about MySQL lock reservations can appear in the .err log.\n";
+print "The test will run very long, even several hours. You can kill\n";
+print "the perl processes running this test at any time and do CHECK\n";
+print "TABLE on tables innotest2a, b, c, d in the 'test' database.\n";
+print "\n";
+print "Some of these stress tests will print a lot of SQL errors\n";
+print "to the standard output. That is not to be worried about.\n";
+print "You can direct the output to a file like this:\n";
+print "perl innotest2 > out2\n\n";
+
+print "Generating random keys\n";
+$random[$opt_loop_count] = 0;
+$rnd_str[$opt_loop_count] = "a";
+
+for ($i = 0; $i < $opt_loop_count; $i++) {
+
+ $random[$i] = ($i * 63857) % $opt_loop_count;
+
+ if (0 == ($random[$i] % 3)) {
+ $rnd_str[$i] = "khD";
+ } else { if (1 == ($random[$i] % 3)) {
+ $rnd_str[$i] = "kHd";
+ } else { if (2 == ($random[$i] % 3)) {
+ $rnd_str[$i] = "khd";
+ }}}
+
+ for ($j = 0; $j < (($i * 764877) % 20); $j++) {
+ $rnd_str[$i] = $rnd_str[$i]."k";
+ }
+}
+
+####
+#### Connect
+####
+
+$dbh = $server->connect()
+|| die $dbh->errstr;
+
+$dbh->do("set autocommit = 0");
+
+for ($i = 0; $i < 5; $i++) {
+ print "loop $i\n";
+
+ for ($j = 0; $j < $opt_loop_count - 10; $j = $j + 1) {
+
+ $dbh->do("update innotest2a set B = '".$rnd_str[$j + 1]."' where A = ".$random[$j + 5])
+ || print $dbh->errstr;
+
+ $dbh->do("delete from innotest2a where A = ".$random[$random[$j]])
+ || print $dbh->errstr;
+
+ if (0 == ($j % 10)) {
+ $dbh->do("commit");
+ }
+
+ if (0 == ($j % 39)) {
+ $dbh->do("rollback");
+ }
+
+ if (0 == ($j % 1000)) {
+ print "round $j\n";
+ }
+ }
+
+ $dbh->do("commit");
+}
+
+$dbh->disconnect; # close connection