發表文章

目前顯示的是 8月, 2006的文章

Atomic commit?

在Study SubVersion 有一個技術名詞讓我感到很困惑, 一直到WANdisco CTO Rahul Bhargava 來訪,才恍然大悟, 我們先看看網路上的翻譯 1. 不可分割的送交 一個送交動作, 不是導致所有更動都送入檔案庫, 就是完全不會送入. 這讓發展人員以邏輯區段建立更動, 並送交更動. 2. 原子提交 至於簡中解釋就不再多說了 3.英文版SubVersion Book 的解釋 Atomic commits A collection of modifications either goes into the repository completely, or not at all. This allows developers to construct and commit changes as logical chunks, and prevents problems that can occur when only a portion of a set of changes is successfully sent to the repository. 如 果初接觸SubVersion, 我相信很多人對段文字很困惑, Rahul 先生用一個簡單的例子來解釋為何要atomic commit, 他說如果你修改10個Folder裏面的10個檔案, 然後用CVS commit 到CVS Server, 可是commit到第5個folder的檔案, 網路突然斷線, 你猜會發生什麼事? 因為CVS並不support atomic commit 所以CVS是一個一個檔案upload 到 Repository 做 diff 比對,然後真正將diff的結果寫入CVS Server的meta data file , 所以網路斷線的結果照成前5個folder的檔案是commit成功, 後面的5個folder的檔案是commit 失敗, 所以造成local 端的工作目錄與Repository是處於out of sync 的狀態, 我這邊沒有實際測試CVS Client端例如WinCVS對於那些commit 失敗的檔案是如何顯示其狀態, 但是可想而知與Repository out of sync 必需要再做一次cvs update. SubVersion 支援Ato