couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [12/50] [abbrv] git commit: updated refs/heads/1843-feature-bigcouch to cba2e81
Date Sat, 29 Jun 2013 15:17:53 GMT
Bubble missing_stub errors

If we try and replicate a doc with attachment stubs to a node that
doesn't have a previous revision of that doc then we should return a
missing_stub error instead of dying with a function_clause error.

BugzId: 15562


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/96bf7d55
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/96bf7d55
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/96bf7d55

Branch: refs/heads/1843-feature-bigcouch
Commit: 96bf7d55f8ccbb3ecc3cecd27391be7537adf319
Parents: ed80224
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Tue Nov 13 17:25:35 2012 -0600
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Wed Mar 20 06:02:51 2013 -0500

----------------------------------------------------------------------
 src/couch/src/couch_db.erl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/96bf7d55/src/couch/src/couch_db.erl
----------------------------------------------------------------------
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index 67c8a49..f5953a1 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -708,7 +708,13 @@ prep_and_validate_replicated_updates(Db, [Bucket|RestBuckets], [OldInfo|RestOldI
 
                     case couch_doc:has_stubs(Doc) of
                     true ->
-                        DiskDoc = LoadPrevRevFun(),
+                        DiskDoc = case LoadPrevRevFun() of
+                            #doc{} = DiskDoc0 ->
+                                DiskDoc0;
+                            _ ->
+                                % Force a missing_stub exception
+                                couch_doc:merge_stubs(Doc, #doc{})
+                        end,
                         Doc2 = couch_doc:merge_stubs(Doc, DiskDoc),
                         GetDiskDocFun = fun() -> DiskDoc end;
                     false ->


Mime
View raw message