couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilbert B Garza" <gilbertbga...@gmail.com>
Subject Bulk insert conflicts
Date Fri, 25 Jul 2008 15:39:49 GMT
I just recently filed a bug for couchdb's error reporting on conflicts with
bulk insert:

https://issues.apache.org/jira/browse/COUCHDB-97

For the moment, the error couch is giving is
{"error":"conflict","reason":"Update conflict"}. When PUTing a single
document, this isn't that bad. When bulk inserting thousands of documents,
this isn't helpful in the least.

I would like to propose a solution to this. The current success message for
bulk docs looks like this:

{
  "ok":true,
  "new_revs": [
    {"id": "0", "rev": "3682408536"},
    {"id": "1", "rev": "3206753266"},
    {"id": "2", "rev": "426742535"}
  ]
}

If there are any confllicts, I suggest that it would look something like
this:

{
  "ok":true,
  "conflicts":true,
  "new_revs": [
    {"id": "1", "rev": "12345"},
    {"id": "3", "rev": "23456"},
    {"id": "4", "rev": "34567"}
  ]
  "conflict_revs": [
    {"id": "0", "attempted_rev": "1001", "current_rev": "1002"},
    {"id": "2", "attempted_rev": "5000", "current_rev": "5002"}
  ]
}

This way, not only do you know which documents had conflicts, but the entire
bulk operation does not have to fail.

What do you all think?

-Gilbert

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message