You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2009/07/29 23:48:53 UTC
svn commit: r799093 - in /couchdb/trunk:
share/www/script/test/attachments.js src/couchdb/couch_db.erl
Author: damien
Date: Wed Jul 29 21:48:53 2009
New Revision: 799093
URL: http://svn.apache.org/viewvc?rev=799093&view=rev
Log:
Fix for COUCHDB-434. Only reassign previous revid inside the updater process.
Modified:
couchdb/trunk/share/www/script/test/attachments.js
couchdb/trunk/src/couchdb/couch_db.erl
Modified: couchdb/trunk/share/www/script/test/attachments.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/attachments.js?rev=799093&r1=799092&r2=799093&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/attachments.js (original)
+++ couchdb/trunk/share/www/script/test/attachments.js Wed Jul 29 21:48:53 2009
@@ -170,7 +170,18 @@
docs.push(doc)
}
- db.bulkSave(docs);
+ var saved = db.bulkSave(docs);
+ // now delete the docs, and while we are looping over them, remove the
+ // '_rev' field so we can re-create after deletion.
+ var to_up = [];
+ for (i=0;i<saved.length;i++) {
+ to_up.push({'_id': saved[i]['id'], '_rev': saved[i]['rev'], '_deleted': true});
+ delete docs[i]._rev;
+ }
+ // delete them.
+ var saved2 = db.bulkSave(to_up);
+ // re-create them
+ var saved3 = db.bulkSave(docs);
var before = db.info().disk_size;
Modified: couchdb/trunk/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.erl?rev=799093&r1=799092&r2=799093&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db.erl Wed Jul 29 21:48:53 2009
@@ -316,13 +316,7 @@
[] ->
% new doc, and we have existing revs.
% reuse existing deleted doc
- if OldFullDocInfo#full_doc_info.deleted ->
- % existing docs are deletions
- #doc_info{revs=[#rev_info{rev={Pos, DelRevId}}|_]} =
- couch_doc:to_doc_info(OldFullDocInfo),
- Doc2 = Doc#doc{revs={Pos, [DelRevId]}},
- {validate_doc_update(Db, Doc2, fun() -> nil end), Doc2};
- AllowConflict ->
+ if OldFullDocInfo#full_doc_info.deleted orelse AllowConflict ->
{validate_doc_update(Db, Doc, fun() -> nil end), Doc};
true ->
{conflict, Doc}