On Thu, Apr 02, 2009 at 11:09:24PM -0700, Scott Shumaker wrote: > How about something like the following? > > During an 'transactional bulk write': > > - For each document in the transaction, > > - Attempt to create a new rev of the document, specially flagged so > it doesn't show up in views, document fetches, or replications (return > the last version of this documents instead). > - This rev SHOULD be examined when checking for conflicts with > subsequent writes (so no new writes to the document can happen while > the transaction is in progress - they return with a conflict error).
In that case, is this new magic rev not just the same as a lock? Implementing a per-document lock within one database is simple enough, and indeed it could be done in a sharded environment too. However it would be extremely difficult to implement if you allow multi-master replication too. You would also need procedures to recover locks due to transactions which have stalled or silently aborted (remembering that HTTP is a stateless protocol) Regards, Brian.
