incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pepijn de Vos <>
Subject [proposal] Update Handler Conflict Resolution
Date Fri, 09 Sep 2011 13:37:45 GMT

Today I had a long and complicated discussion involving rnewson, jan____, me and muhqu.

I was falsely assuming Document Update Handlers did atomic updates. Truth is that they don't,
but for most of my use cases could.

What currently happens is that the update handler gets executed with the latest rev of the
requested doc. When the update is completed, it is committed, but when another update has
meanwhile happened, a conflict arises and 409 is returned.

When I use update handlers, I mostly use idempotent functions. This means that it is safe
for the update handler to retry on its own account, and in doing so, avoid a ton of latency
and headaches.

Only, it turns out that programmatic updates are not the sole use for update handlers, so
rnewson argued that it might destroy data.

Proposal 1:
Add an idempotent=true parameter to the handler, allowing it to retry on its own.

Proposal 2:
Add an update() function so the handler can handle conflicts in itself.

I cannot program Erlang. I think I might be able to work out option 1, but not 2. So if option
2 is desired, someone else will have to write it.

View raw message