You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.2 KiB

- Improved portability of the sql-bench Perl scripts by replacing the calls of external programs "uname" and "pwd" with Perl builtin functions "cwd()" and "POSIX::uname()" sql-bench/as3ap.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/bench-count-distinct.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/bench-init.pl.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. - portability fix: don't call external "uname" in various combinations, use POSIX::uname() instead. sql-bench/copy-db.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/crash-me.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. - portability fix: don't call external "uname" in various combinations, use POSIX::uname() instead. sql-bench/innotest1.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest1a.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest1b.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest2.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest2a.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest2b.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/run-all-tests.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-ATIS.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-alter-table.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-big-tables.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-connect.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-create.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-insert.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-select.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-transactions.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-wisconsin.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead.
22 years ago
- Improved portability of the sql-bench Perl scripts by replacing the calls of external programs "uname" and "pwd" with Perl builtin functions "cwd()" and "POSIX::uname()" sql-bench/as3ap.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/bench-count-distinct.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/bench-init.pl.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. - portability fix: don't call external "uname" in various combinations, use POSIX::uname() instead. sql-bench/copy-db.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/crash-me.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. - portability fix: don't call external "uname" in various combinations, use POSIX::uname() instead. sql-bench/innotest1.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest1a.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest1b.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest2.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest2a.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/innotest2b.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/run-all-tests.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-ATIS.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-alter-table.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-big-tables.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-connect.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-create.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-insert.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-select.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-transactions.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead. sql-bench/test-wisconsin.sh: - portability fix: don't call external "pwd" command, use the "cwd()" builtin function instead.
22 years ago
  1. #!/usr/bin/perl
  2. ############################################################################
  3. # Stress test for MySQL/Innobase combined database
  4. # (c) 2000 Innobase Oy & MySQL AB
  5. #
  6. ############################################################################
  7. use Cwd;
  8. use DBI;
  9. use Benchmark;
  10. $opt_loop_count = 100000;
  11. $pwd = cwd(); $pwd = "." if ($pwd eq '');
  12. require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
  13. print "Innotest2b: MySQL/InnoDB stress test in Perl for FOREIGN keys\n";
  14. print "------------------------------------------------------------\n";
  15. print "This is a randomized stress test for concurrent inserts,\n";
  16. print "updates, deletes, commits and rollbacks with foreign keys with\n";
  17. print "the ON DELETE ... clause. The test will generate\n";
  18. print "also a lot of deadlocks, duplicate key errors, and other SQL errors.\n";
  19. print "\n";
  20. print "You should run innotest2, innotest2a, and innotest2b concurrently.\n";
  21. print "The thing to watch is that the server does not crash or does not\n";
  22. print "print to the .err log anything. Currently, due to a buglet in MySQL,\n";
  23. print "warnings about MySQL lock reservations can appear in the .err log.\n";
  24. print "The test will run very long, even several hours. You can kill\n";
  25. print "the perl processes running this test at any time and do CHECK\n";
  26. print "TABLE on tables innotest2a, b, c, d in the 'test' database.\n";
  27. print "\n";
  28. print "Some of these stress tests will print a lot of SQL errors\n";
  29. print "to the standard output. That is not to be worried about.\n";
  30. print "You can direct the output to a file like this:\n";
  31. print "perl innotest2 > out2\n\n";
  32. print "Generating random keys\n";
  33. $random[$opt_loop_count] = 0;
  34. $rnd_str[$opt_loop_count] = "a";
  35. for ($i = 0; $i < $opt_loop_count; $i++) {
  36. $random[$i] = ($i * 98641) % $opt_loop_count;
  37. if (0 == ($random[$i] % 3)) {
  38. $rnd_str[$i] = "khD";
  39. } else { if (1 == ($random[$i] % 3)) {
  40. $rnd_str[$i] = "khd";
  41. } else { if (2 == ($random[$i] % 3)) {
  42. $rnd_str[$i] = "kHd";
  43. }}}
  44. for ($j = 0; $j < (($i * 764877) % 10); $j++) {
  45. $rnd_str[$i] = $rnd_str[$i]."k";
  46. }
  47. }
  48. ####
  49. #### Connect
  50. ####
  51. $dbh = $server->connect();
  52. $dbh->do("set autocommit = 0");
  53. for ($i = 0; $i < 1; $i++) {
  54. print "loop $i\n";
  55. for ($j = 0; $j < $opt_loop_count - 10; $j = $j + 2) {
  56. $dbh->do(
  57. "insert into innotest2b (D, B, C) values (5, '".$rnd_str[$j]."' ,'".$rnd_str[$j]."')")
  58. || print $dbh->errstr;
  59. $dbh->do(
  60. "insert into innotest2a (D, B, C) values (5, '".$rnd_str[$j]."' ,'".$rnd_str[$j]."')")
  61. || print $dbh->errstr;
  62. $dbh->do(
  63. "insert into innotest2c (D, B, C) values (5, '".$rnd_str[$j]."' ,'".$rnd_str[$j]."')")
  64. || print $dbh->errstr;
  65. $dbh->do("delete from innotest2b where A = ".$random[$random[$j]])
  66. || print $dbh->errstr;
  67. $dbh->do("update innotest2b set A = A + 1 where A = ".$random[$j])
  68. || print $dbh->errstr;
  69. if (0 == ($j % 10)) {
  70. $dbh->do("commit");
  71. }
  72. if (0 == ($j % 39)) {
  73. $dbh->do("rollback");
  74. }
  75. if (0 == ($j % 1000)) {
  76. print "round $j\n";
  77. }
  78. }
  79. $dbh->do("commit");
  80. }
  81. $dbh->disconnect; # close connection