今天为了测试mysql5.5.8 GAmysql5.1GA 版性能区别,用sysbench分别向其插入1000万行的数据,向mysql5.1中插入的时候约半个小时都没有结束,感觉不对头啊,

show full processlist; 之后发现插入操作已经被挂起,于是强行停止吧,查看了下error文件,发现原来是磁盘空间不够了,悲催啊。。。

这里谴责一下,磁盘空间不够了 ,不报错,而是挂起状态,这样不好,应该有个时间限制吧。。。。

Mysql5.1中数据只插入了113万,由于经验不足,直接把sbtest表给drop掉了,之后才知道原来innodb不会为磁盘释放空间的。。。     

磁盘空间都百分之百了,必须释放了。

 

下面找几个解决的办法:

1. Optimize table  table_name

   Optimize table 有回收空间的作用,只可惜这次我是直接把表drop掉了,以后要注意,操作的步骤可以是这样的:

Delete from table_name;

Optimize table table_name;

Drop table;

这样可以先optimize table ,然后再drop table ,就可以回收空间了。

 

 

 

  删除所有ibdata文件和所有ib_logfiles,当然还是要备份之前的数据,以免丢失重要数据

  重启服务器,重新创建:

  下面是重建时的提示信息。

 

               The first specified data file /home/zhaoleina/data5.5.8/ibdata1 did not exist:

 

InnoDB: a new database to be created!

110117 10:56:36  InnoDB: Setting file /home/zhaoleina/data5.5.8/ibdata1 size to 10 MB

InnoDB: Database physically writes the file full: wait...

110117 10:56:37  InnoDB: Log file /home/zhaoleina/data5.5.8/ib_logfile0 did not exist: new to be created

InnoDB: Setting log file /home/zhaoleina/data5.5.8/ib_logfile0 size to 5 MB

InnoDB: Database physically writes the file full: wait...

110117 10:56:37  InnoDB: Log file /home/zhaoleina/data5.5.8/ib_logfile1 did not exist: new to be created

InnoDB: Setting log file /home/zhaoleina/data5.5.8/ib_logfile1 size to 5 MB

InnoDB: Database physically writes the file full: wait...

InnoDB: Doublewrite buffer not found: creating new

InnoDB: Doublewrite buffer created

InnoDB: 127 rollback segment(s) active.

InnoDB: Creating foreign key constraint system tables

InnoDB: Foreign key constraint system tables created

1. 删除innodb的表空间文件,再重新创建