summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-03-16 17:57:06 +0000
committerDamien F. Katz <damien@apache.org>2009-03-16 17:57:06 +0000
commit2adbe68f0922aa2f2d0d8d4af35c4d96534730d6 (patch)
tree2d86c43e5f3e3d873ad376e08bc05a23ff4932b9 /src/couchdb
parent4bf7b4e911e2629720b982b4c1a3eb4d964b25b3 (diff)
Fix for sporatic replication error during tests.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@754970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_key_tree.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/couchdb/couch_key_tree.erl b/src/couchdb/couch_key_tree.erl
index df24d4e1..baea9e3f 100644
--- a/src/couchdb/couch_key_tree.erl
+++ b/src/couchdb/couch_key_tree.erl
@@ -86,8 +86,8 @@ merge_at([{Key, Value, SubTree}|Sibs], Place, Insert) ->
{ok, [{Key, Value, Merged} | Sibs], Conflicts};
no ->
case merge_at(Sibs, Place, Insert) of
- {ok, Merged} ->
- [{Key, Value, SubTree} | Merged];
+ {ok, Merged, Conflicts} ->
+ {ok, [{Key, Value, SubTree} | Merged], Conflicts};
no ->
no
end
@@ -316,8 +316,12 @@ test() ->
TwoChild = [{0, {"1","foo", [{"1a", "bar", [{"1aa", "bar", []}]}]}}],
TwoChildSibs = [{0, {"1","foo", [{"1a", "bar", []},
{"1b", "bar", []}]}}],
+ TwoChildSibs2 = [{0, {"1","foo", [{"1a", "bar", []},
+ {"1b", "bar", [{"1bb", "boo", []}]}]}}],
+ Stemmed1b = [{1, {"1a", "bar", []}}],
Stemmed1a = [{1, {"1a", "bar", [{"1aa", "bar", []}]}}],
Stemmed1aa = [{2, {"1aa", "bar", []}}],
+ Stemmed1bb = [{2, {"1bb", "boo", []}}],
{EmptyTree, no_conflicts} = merge(EmptyTree, EmptyTree),
{One, no_conflicts} = merge(EmptyTree, One),
@@ -326,6 +330,10 @@ test() ->
{One, no_conflicts} = merge(One, One),
{TwoChild, no_conflicts} = merge(TwoChild, TwoChild),
{TwoChildSibs, no_conflicts} = merge(TwoChildSibs, TwoChildSibs),
+ {TwoChildSibs, no_conflicts} = merge(TwoChildSibs, Stemmed1b),
+ {TwoChildSibs, no_conflicts} = merge(Stemmed1b, TwoChildSibs),
+ {TwoChildSibs2, no_conflicts} = merge(TwoChildSibs2, Stemmed1bb),
+ {TwoChildSibs2, no_conflicts} = merge(Stemmed1bb, TwoChildSibs2),
{TwoChild, no_conflicts} = merge(TwoChild, Stemmed1aa),
{TwoChild, no_conflicts} = merge(TwoChild, Stemmed1a),
{Stemmed1a, no_conflicts} = merge(Stemmed1a, Stemmed1aa),