今天為了測試mysql5.5.8 GA與mysql5.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
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: 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