Comment 3 for bug 989055

Revision history for this message
Peter (Stig) Edwards (thatsafunnyname) wrote :

I created a bash version of the ruby reproducer, the table has fewer fields.
It reproduces the table marked as crashed error reliably (for me), using MariaDB 5.3.6, I will try it with the latest 5.3 next

#!/bin/sh

HOST=localhost
PORT=3306
USER=root
PASSWORD=
DATABASE=test
MYSQL_CLIENT=/usr/bin/mysql

function run_cmd {
  $MYSQL_CLIENT --host=$HOST --user=$USER --password=$PASSWORD --database=$DATABASE --exec="$1" > /dev/null
}

function dbs_size {
  for i in {1..200}
  do
    run_cmd "SELECT table_schema , data_length , index_length FROM information_schema.TABLES WHERE table_schema='$DATABASE'"
  done
}

function table_run {
    IDX="$1"
  run_cmd "CREATE TABLE table_$IDX (\`id\` int, PRIMARY KEY (\`id\`)) ENGINE=MyISAM CHARSET=latin1"
  run_cmd "alter table table_$IDX disable keys"
  run_cmd "alter table table_$IDX enable keys"
  run_cmd "drop table table_$IDX"
}

function many_table_run {
  for i in {1..20}
  do
    table_run $i &
  done
}

dbs_size &
many_table_run

# produces in mysqld error log:
# 120515 11:31:23 [ERROR] mysqld: Table './test/table_5' is marked as crashed and should be repaired
# 120515 11:31:23 [ERROR] mysqld: Table 'table_5' is marked as crashed and should be repaired