views:

54

answers:

1

Hey SO,

reading the couchdb book, I came across the statement,

"Writes are serialized, allowing only one write operation at any point in time, for any single database"

what does this mean? how does it control write conflict without locks? This is probably a question better suited to the couchdb mailing list, but I wanted a more computer science explanation of it than a 'product' explanation.

thank you

+1  A: 

Once a write is performed, the revision number for that document is changed. If a write comes in with an older revision number, it is kicked back with an error telling the application/user to review their changes against the most recent document in question before resubmitting their new version.

Now, when you're dealing with multiple nodes, there is some conflict management that will need to occur on the CouchDB document, refer to this chapter for an explanation of that process: http://books.couchdb.org/relax/reference/conflict-management

Dominic Barnes
Just to add little. CouchDB uses MVCC (Multi Version Concurrency Control) so a single item on multiple nodes can be changes and then synced in a peer-to-peer fashion during replication. They refer to this model as "Eventual Consistency" meaning consistency between nodes, a single node is always consistent.
mikeal