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 2019/05/07 17:14:42 UTC
[couchdb] branch fix-epoch-mismatch-error updated: fixup! Fix epoch
mismatch errors
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch fix-epoch-mismatch-error
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/fix-epoch-mismatch-error by this push:
new 7534860 fixup! Fix epoch mismatch errors
7534860 is described below
commit 753486057811ea3780096b8da5b62a7abfa93801
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Tue May 7 12:14:26 2019 -0500
fixup! Fix epoch mismatch errors
---
src/couch/src/couch_db.erl | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index 4a2d8ef..52c3fbb 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -1614,7 +1614,7 @@ start_seq([{_, NewSeq}, {OrigNode, _} | _], OrigNode, Seq) when Seq > NewSeq ->
NewSeq;
start_seq([_ | Rest], OrigNode, Seq) ->
start_seq(Rest, OrigNode, Seq);
-start_seq([], OrigNode, Seq) ->
+start_seq([], _OrigNode, _Seq) ->
throw(epoch_mismatch).
@@ -1993,7 +1993,8 @@ calculate_start_seq_test_() ->
t_calculate_start_seq_uuid_mismatch(),
t_calculate_start_seq_is_owner(),
t_calculate_start_seq_not_owner(),
- t_calculate_start_seq_raw()
+ t_calculate_start_seq_raw(),
+ t_calculate_start_seq_epoch_mismatch()
]
}.
@@ -2038,6 +2039,14 @@ t_calculate_start_seq_raw() ->
?assertEqual(13, Seq)
end).
+t_calculate_start_seq_epoch_mismatch() ->
+ ?_test(begin
+ Db = test_util:fake_db([]),
+ SeqIn = {replace, not_this_node, get_uuid(Db), 42},
+ Seq = calculate_start_seq(Db, node1, SeqIn),
+ ?assertEqual(0, Seq)
+ end).
+
is_owner_test() ->
?assertNot(is_owner(foo, 1, [])),
?assertNot(is_owner(foo, 1, [{foo, 1}])),