· 7 years ago · Oct 29, 2018, 04:50 AM
1CREATE DATABASE IF NOT EXISTS testing;
2CREATE TABLE `testing`.`persons` (
3 `id` int(11) NOT NULL AUTO_INCREMENT,
4 `lastname` varchar(255) NOT NULL,
5 `firstname` varchar(255) DEFAULT NULL,
6 `age` int(11) DEFAULT NULL,
7 PRIMARY KEY (`id`)
8) ENGINE=MyISAM DEFAULT CHARSET=latin1;
9
10<?php
11while(1){
12 $cid = mysql_connect('127.0.0.1:3306','root','pass') or die(mysql_error());
13 $firstname=md5(uniqid(rand(), TRUE));
14 $age=rand (12,127);
15 mysql_query("INSERT INTO testing.persons SET
16 firstname='".mysql_real_escape_string($firstname)."',
17 age='".$age."'
18 ",$cid) or die(mysql_error($cid));
19 usleep(5);
20}
21
22php filltable.php
23
24mysql> select count(*) from testing.persons;
25+----------+
26| count(*) |
27+----------+
28| 10647 |
29+----------+
301 row in set (0.00 sec)
31
32killall -s SIGKILL /usr/sbin/mysqld
33
34mysql> check table testing.persons quick;
35 +-----------------+-------+----------+-------------------------------------------------------+
36 | Table | Op | Msg_type | Msg_text |
37 +-----------------+-------+----------+-------------------------------------------------------+
38 | testing.persons | check | warning | 1 client is using or hasn't closed the table properly |
39 | testing.persons | check | warning | Size of datafile is: 1877424 Should be: 1877376 |
40 | testing.persons | check | status | OK |
41 +-----------------+-------+----------+-------------------------------------------------------+
42 3 rows in set (0.01 sec)
43
44mysql> check table testing.persons quick;
45 +-----------------+-------+----------+-------------------------------------------------------+
46 | Table | Op | Msg_type | Msg_text |
47 +-----------------+-------+----------+-------------------------------------------------------+
48 | testing.persons | check | warning | Size of datafile is: 1877424 Should be: 1877376 |
49 | testing.persons | check | status | OK |
50 +-----------------+-------+----------+-------------------------------------------------------+
51 2 rows in set (0.00 sec)
52
53mysql> insert into testing.persons set firstname='somename', age='111';
54 Query OK, 1 row affected, 1 warning (0.01 sec)
55
56mysql> check table testing.persons quick;
57 +-----------------+-------+----------+-------------------------------------------------------+
58 | Table | Op | Msg_type | Msg_text |
59 +-----------------+-------+----------+-------------------------------------------------------+
60 | testing.persons | check | warning | Size of datafile is: 1877424 Should be: 1877400 |
61 | testing.persons | check | status | OK |
62 +-----------------+-------+----------+-------------------------------------------------------+
63 2 rows in set (0.00 sec)
64
65mysql> insert into testing.persons set firstname='somename', age='222';
66 Query OK, 1 row affected, 1 warning (0.00 sec)
67
68mysql> check table testing.persons quick;
69 +-----------------+-------+----------+----------+
70 | Table | Op | Msg_type | Msg_text |
71 +-----------------+-------+----------+----------+
72 | testing.persons | check | status | OK |
73 +-----------------+-------+----------+----------+
74 1 row in set (0.00 sec)
75
76mysql> check table testing.persons;
77 +-----------------+-------+----------+-------------------------------------------------------+
78 | Table | Op | Msg_type | Msg_text |
79 +-----------------+-------+----------+-------------------------------------------------------+
80 | testing.persons | check | warning | 1 client is using or hasn't closed the table properly |
81 | testing.persons | check | warning | Size of datafile is: 1145136 Should be: 1145088 |
82 | testing.persons | check | error | Record-count is not ok; is 23857 Should be: 23856 |
83 | testing.persons | check | warning | Found 23857 key parts. Should be: 23856 |
84 | testing.persons | check | error | Corrupt |
85 +-----------------+-------+----------+-------------------------------------------------------+
86 5 rows in set (0.01 sec)
87
88mysql> check table testing.persons;
89 +-----------------+-------+----------+-------------------------------------------------------+
90 | Table | Op | Msg_type | Msg_text |
91 +-----------------+-------+----------+-------------------------------------------------------+
92 | testing.persons | check | warning | Table is marked as crashed |
93 | testing.persons | check | warning | 1 client is using or hasn't closed the table properly |
94 | testing.persons | check | warning | Size of datafile is: 1145136 Should be: 1145088 |
95 | testing.persons | check | error | Record-count is not ok; is 23857 Should be: 23856 |
96 | testing.persons | check | warning | Found 23857 key parts. Should be: 23856 |
97 | testing.persons | check | error | Corrupt |
98 +-----------------+-------+----------+-------------------------------------------------------+
99 6 rows in set (0.01 sec)
100
101--myisam-recover-options=QUICK
102
103myisamchk