
若然未報,時辰未到……
大概是我閒時沒多感恩,或許初一十五沒有燒什麼Code或紙札Developer孝敬電腦神,今天就捉弄了我一下以示警戒。
本來正想Upgrade去Wordpress 2.6,主要還是因為要測試一下xLanguage的相容性,當然第一部就係將最新的資料dump過去Testbed平台上。很久沒有做這個動作,幸好之前做轉移的時候都留下一個script,跑一下,OK沒問題。
之後把我修訂過的部份Diff出來,再把Wordpress 2.6的文檔按指示覆蓋上去,再把之前的Diff patch上去,都沒有問題。
Login進去,看看我之前修訂過的部份是否真的能成功Patch上去。但還沒有查Patch的問題,就發現好像有些條目不翼而飛。回頭看一看轉移用的Script……
「大檸樂……」一陣涼風吹過我的一把冷汗,感覺份外清涼……似乎我把方向弄反,把老舊的Testbed轉移到Production Blog Database上。
還記得我的Daily backup server好像Down了一陣子,本來打算捱到回港才修理……循例試一下,希望有奇蹟出現,電腦卻冷冷的回傳一句「ssh: connect to host backup port 22: Connection refused」
查一下MySQL的Log Folder,完來電腦神還沒有完全離棄我。我之前Turn On的Binlog還真的是有效,一句一句的MySQL Statements還是可以讀出來。
稍為花了點時間找對了上次轉移Blog的時間,重播一次之間所有的MySQL記錄。要重播兩個月的SQL Statements還真的要花點時間,把無關痛癢的WassUp log table刪走後還是要一個小時左右才完成這次Replay。
今次教訓再次提醒Backup的重要性,按非正式統計,90%的資料災難都是人為引致的。還是要感謝電腦神留我一線生機,另外就是要快點修復Backup Server才成。
…it’s just a matter of time when you will be punished.
It’s probably because I didn’t have a gratitude, or that I didn’t offer sacrifices to the god of computer on full-moon and new-moon, and I got punished today as a warning.
I was upgrading the Wordpress to 2.6, primarily for testing the compatibility of xLanguage. Of course, the first step is to dump the existing data to the testbed platform. It’s was a very long time when I was doing this last time, but luckily I have left the migration script somewhere. Bang! It’s still working, great!
Then I “diff”ed the part that I customized, and overwrote the existing binaries with 2.6’s as instructed, then patched the “diff”, all green.
I was going back to the Admin panel, was trying to see if the patch still works on 2.6. Before I could get to there, I found that some entries are gone! Now when I was checking the migration script…
“Darn…” I felt an icy wind was breezing over my cold sweating face…Looks like I have managed to reversed the migration direction, I had the production blog database overwritten with an very old testbed data.
I still recalled my Daily backup server was down for a while, original plan is to leave it there until I went back home. And just now, I was pinging it while hoping miracle to happen. No it didn’t happen, the computer returned “ssh: connect to host backup port 22: Connection refused.”
Let’s take a look at the MySQL’s log folder, looks like the God of Computer didn’t abandon me yet. The Binlog that I turned on earlier is still functioning; I can still dump every SQL statements ever executed on the server.
It took me some time to locate the last blog migration from the binlog, then replaying all the MySQL statements in between. Well, it actually took much longer than I expected to replay 2 month worth of statements, even though I had filtered out the WassUp unless transaction, it was still taking it more than 1 hour to replay the remaining statements.
Take home message: it’s important to have backup, and probably multiple backup. According to a non-scientific survey, almost 90% of data disaster was introduced by Human. Thank god for guiding me over the process, and I should fix my backup server ASAP.