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 2018/03/26 20:56:02 UTC

[couchdb] 31/33: WIP - add test engine suite

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3326-clustered-purge-davisp-refactor
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1120c05bd29d64c81f29f6fc9f84bc79075ed0dd
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Mon Mar 26 15:33:48 2018 -0500

    WIP - add test engine suite
---
 src/couch/src/test_engine_compaction.erl       |  2 +-
 src/couch/src/test_engine_fold_purge_infos.erl |  2 +-
 src/couch/src/test_engine_purge_docs.erl       |  2 +-
 src/couch/src/test_engine_util.erl             | 10 +++++-----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/couch/src/test_engine_compaction.erl b/src/couch/src/test_engine_compaction.erl
index 4656084..727e188 100644
--- a/src/couch/src/test_engine_compaction.erl
+++ b/src/couch/src/test_engine_compaction.erl
@@ -278,4 +278,4 @@ local_docid(I) ->
 
 
 fold_fun({_PSeq, _UUID, Id, Revs}, Acc) ->
-    [{Id, Revs} | Acc].
+    {ok, [{Id, Revs} | Acc]}.
diff --git a/src/couch/src/test_engine_fold_purge_infos.erl b/src/couch/src/test_engine_fold_purge_infos.erl
index 07131e4..74556c2 100644
--- a/src/couch/src/test_engine_fold_purge_infos.erl
+++ b/src/couch/src/test_engine_fold_purge_infos.erl
@@ -125,7 +125,7 @@ cet_id_rev_repeated() ->
 
 
 fold_fun({_PSeq, _UUID, Id, Revs}, Acc) ->
-    [{Id, Revs} | Acc].
+    {ok, [{Id, Revs} | Acc]}.
 
 
 docid(I) ->
diff --git a/src/couch/src/test_engine_purge_docs.erl b/src/couch/src/test_engine_purge_docs.erl
index 268011b..21e2051 100644
--- a/src/couch/src/test_engine_purge_docs.erl
+++ b/src/couch/src/test_engine_purge_docs.erl
@@ -168,4 +168,4 @@ cet_add_two_purge_one() ->
 
 
 fold_fun({_Pseq, _UUID, Id, Revs}, Acc) ->
-    [{Id, Revs} | Acc].
\ No newline at end of file
+    {ok, [{Id, Revs} | Acc]}.
\ No newline at end of file
diff --git a/src/couch/src/test_engine_util.erl b/src/couch/src/test_engine_util.erl
index 7ff8537..c7edcbe 100644
--- a/src/couch/src/test_engine_util.erl
+++ b/src/couch/src/test_engine_util.erl
@@ -234,8 +234,8 @@ gen_write(Engine, St, {purge, {DocId, PrevRevs0, _}}, UpdateSeq) ->
         % Check if this doc has been purged before
         FoldFun = fun({_PSeq, _UUID, Id, _Revs}, _Acc) ->
             case Id of
-                DocId -> true;
-                _ -> false
+                DocId -> {stop, true};
+                _ -> {ok, false}
             end
         end,
         {ok, IsPurgedBefore} = Engine:fold_purge_infos(
@@ -259,8 +259,8 @@ gen_write(Engine, St, {purge, {DocId, PrevRevs0, _}}, UpdateSeq) ->
             % Check if these Revs have been purged before
             FoldFun = fun({_Pseq, _UUID, Id, Revs}, Acc) ->
                 case Id of
-                    DocId -> Acc ++ Revs;
-                    _ -> Acc
+                    DocId -> {ok, Acc ++ Revs};
+                    _ -> {ok, Acc}
                 end
             end,
             {ok, PurgedRevs} = Engine:fold_purge_infos(St, 0, FoldFun, [], []),
@@ -496,7 +496,7 @@ db_changes_as_term(Engine, St) ->
 db_purged_docs_as_term(Engine, St) ->
     StartPSeq = Engine:get_oldest_purge_seq(St) - 1,
     FoldFun = fun({PSeq, UUID, Id, Revs}, Acc) ->
-        [{PSeq, UUID, Id, Revs} | Acc]
+        {ok, [{PSeq, UUID, Id, Revs} | Acc]}
     end,
     {ok, PDocs} = Engine:fold_purge_infos(St, StartPSeq, FoldFun, [], []),
     lists:reverse(PDocs).

-- 
To stop receiving notification emails like this one, please contact
davisp@apache.org.