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 2014/02/05 00:06:29 UTC
[16/50] couch commit: updated refs/heads/import to c3116d7
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-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/dd166930
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/dd166930
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/dd166930
Branch: refs/heads/import
Commit: dd166930c048cc666407f3216ebcdd1262b2a449
Parents: 4cc61f1
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Nov 13 17:25:35 2012 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 17:03:23 2014 -0600
----------------------------------------------------------------------
src/couch_db.erl | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/dd166930/src/couch_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_db.erl b/src/couch_db.erl
index 67c8a49..f5953a1 100644
--- a/src/couch_db.erl
+++ b/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 ->