This is an automated email from the ASF dual-hosted git repository. davisp pushed a commit to branch COUCHDB-3326-clustered-purge-davisp-refactor-2 in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit f0b7ddb8cd9270b7493ba51244aced810e263d36 Author: Paul J. Davis <paul.joseph.da...@gmail.com> AuthorDate: Thu Apr 26 13:57:52 2018 -0500 Update tests for new PSE test suite --- src/couch/src/test_engine_compaction.erl | 181 +++++++++---------------- src/couch/src/test_engine_fold_purge_infos.erl | 74 +++++----- src/couch/src/test_engine_get_set_props.erl | 1 - src/couch/src/test_engine_purge_docs.erl | 4 +- src/couch/src/test_engine_util.erl | 9 +- 5 files changed, 113 insertions(+), 156 deletions(-) diff --git a/src/couch/src/test_engine_compaction.erl b/src/couch/src/test_engine_compaction.erl index e49167a..26714a1 100644 --- a/src/couch/src/test_engine_compaction.erl +++ b/src/couch/src/test_engine_compaction.erl @@ -104,7 +104,7 @@ cet_compact_with_everything() -> {<<"foo">>, [FooRev#rev_info.rev]} ], - {ok, PIdRevs4} = couch_db_enigne:fold_purge_infos( + {ok, PIdRevs4} = couch_db_engine:fold_purge_infos( Db4, 0, fun fold_fun/2, [], []), ?assertEqual(PurgedIdRevs, PIdRevs4), @@ -177,180 +177,131 @@ cet_recompact_updates() -> cet_purge_during_compact() -> - {ok, Engine, Path, St1} = test_engine_util:init_engine(dbpath), + {ok, Db1} = test_engine_util:create_db(), - Actions1 = [ - {create, {<<"foo">>, []}}, - {create, {<<"bar">>, []}}, - {conflict, {<<"bar">>, [{<<"vsn">>, 2}]}}, - {create, {<<"baz">>, []}} + Actions1 = lists:map(fun(Seq) -> + {create, {docid(Seq), {[{<<"int">>, Seq}]}}} + end, lists:seq(1, 1000)), + Actions2 = [ + {create, {<<"foo">>, {[]}}}, + {create, {<<"bar">>, {[]}}}, + {create, {<<"baz">>, {[]}}} ], + {ok, Db2} = test_engine_util:apply_batch(Db1, Actions1 ++ Actions2), + Actions3 = [ + {conflict, {<<"bar">>, {[{<<"vsn">>, 2}]}}} + ], + {ok, Db3} = test_engine_util:apply_actions(Db2, Actions3), - {ok, St2} = test_engine_util:apply_actions(Engine, St1, Actions1), - {ok, St3, DbName, _, Term} = test_engine_util:compact(Engine, St2, Path), + {ok, Pid} = couch_db:start_compact(Db3), + catch erlang:suspend_process(Pid), - [BarFDI, BazFDI] = Engine:open_docs(St3, [<<"bar">>, <<"baz">>]), + [BarFDI, BazFDI] = couch_db_engine:open_docs(Db3, [<<"bar">>, <<"baz">>]), BarRev = test_engine_util:prev_rev(BarFDI), BazRev = test_engine_util:prev_rev(BazFDI), - Actions2 = [ + Actions4 = [ {purge, {<<"bar">>, BarRev#rev_info.rev}}, {purge, {<<"baz">>, BazRev#rev_info.rev}} ], - {ok, St4} = test_engine_util:apply_actions(Engine, St3, Actions2), - Db1 = test_engine_util:db_as_term(Engine, St4), - {ok, St5, NewPid} = Engine:finish_compaction(St4, DbName, [], Term), + {ok, Db4} = test_engine_util:apply_actions(Db3, Actions4), + Term1 = test_engine_util:db_as_term(Db4), - ?assertEqual(true, is_pid(NewPid)), - Ref = erlang:monitor(process, NewPid), + catch erlang:resume_process(Pid), + test_engine_util:compact(Db4), - NewTerm = receive - {'$gen_cast', {compact_done, Engine, Term0}} -> - Term0; - {'DOWN', Ref, _, _, Reason} -> - erlang:error({compactor_died, Reason}) - after 10000 -> - erlang:error(compactor_timed_out) - end, + {ok, Db5} = couch_db:reopen(Db4), + Term2 = test_engine_util:db_as_term(Db5), - {ok, St6, undefined} = Engine:finish_compaction(St5, DbName, [], NewTerm), - Db2 = test_engine_util:db_as_term(Engine, St6), - Diff = test_engine_util:term_diff(Db1, Db2), + Diff = test_engine_util:term_diff(Term1, Term2), ?assertEqual(nodiff, Diff). cet_multiple_purge_during_compact() -> - {ok, Engine, Path, St1} = test_engine_util:init_engine(dbpath), - - Actions1 = [ - {create, {<<"foo">>, []}}, - {create, {<<"bar">>, []}}, - {conflict, {<<"bar">>, [{<<"vsn">>, 2}]}}, - {create, {<<"baz">>, []}} - ], - - {ok, St2} = test_engine_util:apply_actions(Engine, St1, Actions1), - {ok, St3, DbName, _, Term} = test_engine_util:compact(Engine, St2, Path), + {ok, Db1} = test_engine_util:create_db(), - [BarFDI, BazFDI] = Engine:open_docs(St3, [<<"bar">>, <<"baz">>]), - BarRev = test_engine_util:prev_rev(BarFDI), + Actions1 = lists:map(fun(Seq) -> + {create, {docid(Seq), {[{<<"int">>, Seq}]}}} + end, lists:seq(1, 1000)), Actions2 = [ - {purge, {<<"bar">>, BarRev#rev_info.rev}} + {create, {<<"foo">>, {[]}}}, + {create, {<<"bar">>, {[]}}}, + {create, {<<"baz">>, {[]}}} ], - {ok, St4} = test_engine_util:apply_actions(Engine, St3, Actions2), + {ok, Db2} = test_engine_util:apply_batch(Db1, Actions1 ++ Actions2), - BazRev = test_engine_util:prev_rev(BazFDI), Actions3 = [ - {purge, {<<"baz">>, BazRev#rev_info.rev}} + {conflict, {<<"bar">>, {[{<<"vsn">>, 2}]}}} ], - {ok, St5} = test_engine_util:apply_actions(Engine, St4, Actions3), - - Db1 = test_engine_util:db_as_term(Engine, St5), - {ok, St6, NewPid} = Engine:finish_compaction(St5, DbName, [], Term), - - ?assertEqual(true, is_pid(NewPid)), - Ref = erlang:monitor(process, NewPid), - - NewTerm = receive - {'$gen_cast', {compact_done, Engine, Term0}} -> - Term0; - {'DOWN', Ref, _, _, Reason} -> - erlang:error({compactor_died, Reason}) - after 10000 -> - erlang:error(compactor_timed_out) - end, - - {ok, St7, undefined} = Engine:finish_compaction(St6, DbName, [], NewTerm), - Db2 = test_engine_util:db_as_term(Engine, St7), - Diff = test_engine_util:term_diff(Db1, Db2), - ?assertEqual(nodiff, Diff). + {ok, Db3} = test_engine_util:apply_actions(Db2, Actions3), -cet_recompact_purge() -> - {ok, Engine, Path, St1} = test_engine_util:init_engine(dbpath), + {ok, Pid} = couch_db:start_compact(Db3), + catch erlang:suspend_process(Pid), - Actions1 = [ - {create, {<<"foo">>, []}}, - {create, {<<"bar">>, []}}, - {conflict, {<<"bar">>, [{<<"vsn">>, 2}]}}, - {create, {<<"baz">>, []}} + [BarFDI, BazFDI] = couch_db_engine:open_docs(Db3, [<<"bar">>, <<"baz">>]), + BarRev = test_engine_util:prev_rev(BarFDI), + Actions4 = [ + {purge, {<<"bar">>, BarRev#rev_info.rev}} ], + {ok, Db4} = test_engine_util:apply_actions(Db3, Actions4), - {ok, St2} = test_engine_util:apply_actions(Engine, St1, Actions1), - {ok, St3, DbName, _, Term} = test_engine_util:compact(Engine, St2, Path), - - [BarFDI, BazFDI] = Engine:open_docs(St3, [<<"bar">>, <<"baz">>]), - BarRev = test_engine_util:prev_rev(BarFDI), BazRev = test_engine_util:prev_rev(BazFDI), - Actions2 = [ - {purge, {<<"bar">>, BarRev#rev_info.rev}}, + Actions5 = [ {purge, {<<"baz">>, BazRev#rev_info.rev}} ], - {ok, St4} = test_engine_util:apply_actions(Engine, St3, Actions2), - Db1 = test_engine_util:db_as_term(Engine, St4), - {ok, St5, NewPid} = Engine:finish_compaction(St4, DbName, [], Term), + {ok, Db5} = test_engine_util:apply_actions(Db4, Actions5), + Term1 = test_engine_util:db_as_term(Db5), - ?assertEqual(true, is_pid(NewPid)), - Ref = erlang:monitor(process, NewPid), + catch erlang:resume_process(Pid), + test_engine_util:compact(Db5), - NewTerm = receive - {'$gen_cast', {compact_done, Engine, Term0}} -> - Term0; - {'DOWN', Ref, _, _, Reason} -> - erlang:error({compactor_died, Reason}) - after 10000 -> - erlang:error(compactor_timed_out) - end, + {ok, Db6} = couch_db:reopen(Db5), + Term2 = test_engine_util:db_as_term(Db6), - {ok, St6, undefined} = Engine:finish_compaction(St5, DbName, [], NewTerm), - Db2 = test_engine_util:db_as_term(Engine, St6), - Diff = test_engine_util:term_diff(Db1, Db2), + Diff = test_engine_util:term_diff(Term1, Term2), ?assertEqual(nodiff, Diff). -% temporary ignoring this test as it times out -ignore_cet_compact_purged_docs_limit() -> - {ok, Engine, Path, St1} = test_engine_util:init_engine(dbpath), - % create NumDocs docs +cet_compact_purged_docs_limit() -> + {ok, Db1} = test_engine_util:create_db(), NumDocs = 1200, {RActions, RIds} = lists:foldl(fun(Id, {CActions, CIds}) -> Id1 = docid(Id), - Action = {create, {Id1, [{<<"int">>, Id}]}}, + Action = {create, {Id1, {[{<<"int">>, Id}]}}}, {[Action| CActions], [Id1| CIds]} end, {[], []}, lists:seq(1, NumDocs)), Ids = lists:reverse(RIds), - {ok, St2} = test_engine_util:apply_actions(Engine, St1, - lists:reverse(RActions)), + {ok, Db2} = test_engine_util:apply_batch(Db1, lists:reverse(RActions)), - % purge NumDocs docs - FDIs = Engine:open_docs(St2, Ids), - RevActions2 = lists:foldl(fun(FDI, CActions) -> + FDIs = couch_db_engine:open_docs(Db2, Ids), + RActions2 = lists:foldl(fun(FDI, CActions) -> Id = FDI#full_doc_info.id, PrevRev = test_engine_util:prev_rev(FDI), Rev = PrevRev#rev_info.rev, [{purge, {Id, Rev}}| CActions] end, [], FDIs), - {ok, St3} = test_engine_util:apply_actions(Engine, St2, - lists:reverse(RevActions2)), + {ok, Db3} = test_engine_util:apply_batch(Db2, lists:reverse(RActions2)), % check that before compaction all NumDocs of purge_requests % are in purge_tree, % even if NumDocs=1200 is greater than purged_docs_limit=1000 - {ok, PurgedIdRevs} = Engine:fold_purge_infos(St3, 0, fun fold_fun/2, [], []), - ?assertEqual(1, Engine:get_oldest_purge_seq(St3)), + {ok, PurgedIdRevs} = couch_db_engine:fold_purge_infos( + Db3, 0, fun fold_fun/2, [], []), + ?assertEqual(1, couch_db_engine:get_oldest_purge_seq(Db3)), ?assertEqual(NumDocs, length(PurgedIdRevs)), % compact db - {ok, St4, DbName, _, Term} = test_engine_util:compact(Engine, St3, Path), - {ok, St5, undefined} = Engine:finish_compaction(St4, DbName, [], Term), + test_engine_util:compact(Db3), + {ok, Db4} = couch_db:reopen(Db3), % check that after compaction only purged_docs_limit purge_requests % are in purge_tree - PurgedDocsLimit = Engine:get_purge_infos_limit(St5), - OldestPSeq = Engine:get_oldest_purge_seq(St5), - {ok, PurgedIdRevs2} = Engine:fold_purge_infos( - St5, OldestPSeq - 1, fun fold_fun/2, [], []), + PurgedDocsLimit = couch_db_engine:get_purge_infos_limit(Db4), + OldestPSeq = couch_db_engine:get_oldest_purge_seq(Db4), + {ok, PurgedIdRevs2} = couch_db_engine:fold_purge_infos( + Db4, OldestPSeq - 1, fun fold_fun/2, [], []), ExpectedOldestPSeq = NumDocs - PurgedDocsLimit + 1, ?assertEqual(ExpectedOldestPSeq, OldestPSeq), ?assertEqual(PurgedDocsLimit, length(PurgedIdRevs2)). diff --git a/src/couch/src/test_engine_fold_purge_infos.erl b/src/couch/src/test_engine_fold_purge_infos.erl index 74556c2..71d0889 100644 --- a/src/couch/src/test_engine_fold_purge_infos.erl +++ b/src/couch/src/test_engine_fold_purge_infos.erl @@ -22,23 +22,24 @@ cet_empty_purged_docs() -> - {ok, Engine, St} = test_engine_util:init_engine(), - ?assertEqual({ok, []}, Engine:fold_purge_infos(St, 0, fun fold_fun/2, [], [])). + {ok, Db} = test_engine_util:create_db(), + ?assertEqual({ok, []}, couch_db_engine:fold_purge_infos( + Db, 0, fun fold_fun/2, [], [])). cet_all_purged_docs() -> - {ok, Engine, St1} = test_engine_util:init_engine(), + {ok, Db1} = test_engine_util:create_db(), {RActions, RIds} = lists:foldl(fun(Id, {CActions, CIds}) -> Id1 = docid(Id), - Action = {create, {Id1, [{<<"int">>, Id}]}}, + Action = {create, {Id1, {[{<<"int">>, Id}]}}}, {[Action| CActions], [Id1| CIds]} end, {[], []}, lists:seq(1, ?NUM_DOCS)), Actions = lists:reverse(RActions), Ids = lists:reverse(RIds), - {ok, St2} = test_engine_util:apply_actions(Engine, St1, Actions), + {ok, Db2} = test_engine_util:apply_batch(Db1, Actions), - FDIs = Engine:open_docs(St2, Ids), + FDIs = couch_db_engine:open_docs(Db2, Ids), {RevActions2, RevIdRevs} = lists:foldl(fun(FDI, {CActions, CIdRevs}) -> Id = FDI#full_doc_info.id, PrevRev = test_engine_util:prev_rev(FDI), @@ -48,24 +49,25 @@ cet_all_purged_docs() -> end, {[], []}, FDIs), {Actions2, IdsRevs} = {lists:reverse(RevActions2), lists:reverse(RevIdRevs)}, - {ok, St3} = test_engine_util:apply_actions(Engine, St2, Actions2), - {ok, PurgedIdRevs} = Engine:fold_purge_infos(St3, 0, fun fold_fun/2, [], []), + {ok, Db3} = test_engine_util:apply_batch(Db2, Actions2), + {ok, PurgedIdRevs} = couch_db_engine:fold_purge_infos( + Db3, 0, fun fold_fun/2, [], []), ?assertEqual(IdsRevs, lists:reverse(PurgedIdRevs)). cet_start_seq() -> - {ok, Engine, St1} = test_engine_util:init_engine(), + {ok, Db1} = test_engine_util:create_db(), Actions1 = [ - {create, {docid(1), [{<<"int">>, 1}]}}, - {create, {docid(2), [{<<"int">>, 2}]}}, - {create, {docid(3), [{<<"int">>, 3}]}}, - {create, {docid(4), [{<<"int">>, 4}]}}, - {create, {docid(5), [{<<"int">>, 5}]}} + {create, {docid(1), {[{<<"int">>, 1}]}}}, + {create, {docid(2), {[{<<"int">>, 2}]}}}, + {create, {docid(3), {[{<<"int">>, 3}]}}}, + {create, {docid(4), {[{<<"int">>, 4}]}}}, + {create, {docid(5), {[{<<"int">>, 5}]}}} ], Ids = [docid(1), docid(2), docid(3), docid(4), docid(5)], - {ok, St2} = test_engine_util:apply_actions(Engine, St1, Actions1), + {ok, Db2} = test_engine_util:apply_actions(Db1, Actions1), - FDIs = Engine:open_docs(St2, Ids), + FDIs = couch_db_engine:open_docs(Db2, Ids), {RActions2, RIdRevs} = lists:foldl(fun(FDI, {CActions, CIdRevs}) -> Id = FDI#full_doc_info.id, PrevRev = test_engine_util:prev_rev(FDI), @@ -73,55 +75,59 @@ cet_start_seq() -> Action = {purge, {Id, Rev}}, {[Action| CActions], [{Id, [Rev]}| CIdRevs]} end, {[], []}, FDIs), - {ok, St3} = test_engine_util:apply_actions(Engine, St2, lists:reverse(RActions2)), + {ok, Db3} = test_engine_util:apply_actions(Db2, lists:reverse(RActions2)), StartSeq = 3, StartSeqIdRevs = lists:nthtail(StartSeq, lists:reverse(RIdRevs)), - {ok, PurgedIdRevs} = Engine:fold_purge_infos(St3, StartSeq, fun fold_fun/2, [], []), + {ok, PurgedIdRevs} = couch_db_engine:fold_purge_infos( + Db3, StartSeq, fun fold_fun/2, [], []), ?assertEqual(StartSeqIdRevs, lists:reverse(PurgedIdRevs)). cet_id_rev_repeated() -> - {ok, Engine, St1} = test_engine_util:init_engine(), + {ok, Db1} = test_engine_util:create_db(), Actions1 = [ - {create, {<<"foo">>, [{<<"vsn">>, 1}]}}, - {conflict, {<<"foo">>, [{<<"vsn">>, 2}]}} + {create, {<<"foo">>, {[{<<"vsn">>, 1}]}}}, + {conflict, {<<"foo">>, {[{<<"vsn">>, 2}]}}} ], - {ok, St2} = test_engine_util:apply_actions(Engine, St1, Actions1), + {ok, Db2} = test_engine_util:apply_actions(Db1, Actions1), - [FDI1] = Engine:open_docs(St2, [<<"foo">>]), + [FDI1] = couch_db_engine:open_docs(Db2, [<<"foo">>]), PrevRev1 = test_engine_util:prev_rev(FDI1), Rev1 = PrevRev1#rev_info.rev, Actions2 = [ {purge, {<<"foo">>, Rev1}} ], - {ok, St3} = test_engine_util:apply_actions(Engine, St2, Actions2), + {ok, Db3} = test_engine_util:apply_actions(Db2, Actions2), PurgedIdRevs0 = [{<<"foo">>, [Rev1]}], - {ok, PurgedIdRevs1} = Engine:fold_purge_infos(St3, 0, fun fold_fun/2, [], []), + {ok, PurgedIdRevs1} = couch_db_engine:fold_purge_infos( + Db3, 0, fun fold_fun/2, [], []), ?assertEqual(PurgedIdRevs0, PurgedIdRevs1), - ?assertEqual(1, Engine:get_purge_seq(St3)), + ?assertEqual(1, couch_db_engine:get_purge_seq(Db3)), % purge the same Id,Rev when the doc still exists - {ok, St4} = test_engine_util:apply_actions(Engine, St3, Actions2), - {ok, PurgedIdRevs2} = Engine:fold_purge_infos(St4, 0, fun fold_fun/2, [], []), + {ok, Db4} = test_engine_util:apply_actions(Db3, Actions2), + {ok, PurgedIdRevs2} = couch_db_engine:fold_purge_infos( + Db4, 0, fun fold_fun/2, [], []), ?assertEqual(PurgedIdRevs0, PurgedIdRevs2), - ?assertEqual(1, Engine:get_purge_seq(St4)), + ?assertEqual(1, couch_db_engine:get_purge_seq(Db4)), - [FDI2] = Engine:open_docs(St4, [<<"foo">>]), + [FDI2] = couch_db_engine:open_docs(Db4, [<<"foo">>]), PrevRev2 = test_engine_util:prev_rev(FDI2), Rev2 = PrevRev2#rev_info.rev, Actions3 = [ {purge, {<<"foo">>, Rev2}} ], - {ok, St5} = test_engine_util:apply_actions(Engine, St4, Actions3), + {ok, Db5} = test_engine_util:apply_actions(Db4, Actions3), PurgedIdRevs00 = [{<<"foo">>, [Rev1]}, {<<"foo">>, [Rev2]}], % purge the same Id,Rev when the doc was completely purged - {ok, St6} = test_engine_util:apply_actions(Engine, St5, Actions3), - {ok, PurgedIdRevs3} = Engine:fold_purge_infos(St6, 0, fun fold_fun/2, [], []), + {ok, Db6} = test_engine_util:apply_actions(Db5, Actions3), + {ok, PurgedIdRevs3} = couch_db_engine:fold_purge_infos( + Db6, 0, fun fold_fun/2, [], []), ?assertEqual(PurgedIdRevs00, lists:reverse(PurgedIdRevs3)), - ?assertEqual(2, Engine:get_purge_seq(St6)). + ?assertEqual(2, couch_db_engine:get_purge_seq(Db6)). fold_fun({_PSeq, _UUID, Id, Revs}, Acc) -> diff --git a/src/couch/src/test_engine_get_set_props.erl b/src/couch/src/test_engine_get_set_props.erl index 5cbca7f..07a3932 100644 --- a/src/couch/src/test_engine_get_set_props.erl +++ b/src/couch/src/test_engine_get_set_props.erl @@ -31,7 +31,6 @@ cet_default_props() -> ?assertEqual(0, couch_db_engine:get_purge_seq(Db)), ?assertEqual(true, is_integer(couch_db_engine:get_purge_infos_limit(Db))), ?assertEqual(true, couch_db_engine:get_purge_infos_limit(Db) > 0), - ?assertEqual([], couch_db_engine:get_last_purged(Db)), ?assertEqual([], couch_db_engine:get_security(Db)), ?assertEqual(1000, couch_db_engine:get_revs_limit(Db)), ?assertMatch(<<_:32/binary>>, couch_db_engine:get_uuid(Db)), diff --git a/src/couch/src/test_engine_purge_docs.erl b/src/couch/src/test_engine_purge_docs.erl index a7fd901..f70cf58 100644 --- a/src/couch/src/test_engine_purge_docs.erl +++ b/src/couch/src/test_engine_purge_docs.erl @@ -82,7 +82,7 @@ cet_purge_conflicts() -> ?assertEqual(1, couch_db_engine:get_doc_count(Db3)), ?assertEqual(0, couch_db_engine:get_del_doc_count(Db3)), - ?assertEqual(4, couch_db_engine:get_update_seq(Db3)), + ?assertEqual(3, couch_db_engine:get_update_seq(Db3)), ?assertEqual(1, couch_db_engine:get_purge_seq(Db3)), ?assertEqual([{<<"foo">>, [Rev1]}], PIdRevs3), @@ -99,7 +99,7 @@ cet_purge_conflicts() -> ?assertEqual(0, couch_db_engine:get_doc_count(Db4)), ?assertEqual(0, couch_db_engine:get_del_doc_count(Db4)), - ?assertEqual(5, couch_db_engine:get_update_seq(Db4)), + ?assertEqual(4, couch_db_engine:get_update_seq(Db4)), ?assertEqual(2, couch_db_engine:get_purge_seq(Db4)), ?assertEqual([{<<"foo">>, [Rev2]}, {<<"foo">>, [Rev1]}], PIdRevs4). diff --git a/src/couch/src/test_engine_util.erl b/src/couch/src/test_engine_util.erl index 9eb6dd0..b9c41c8 100644 --- a/src/couch/src/test_engine_util.erl +++ b/src/couch/src/test_engine_util.erl @@ -180,7 +180,7 @@ apply_batch(Db, Actions) -> {ok, Db2} = couch_db:reopen(Db1), if PurgeInfos == [] -> ok; true -> - {ok, _, _} = couch_db:purge_docs(Db2, PurgeInfos) + {ok, _} = couch_db:purge_docs(Db2, PurgeInfos) end, couch_db:reopen(Db2). @@ -222,7 +222,7 @@ gen_write(Db, {create, {DocId, Body, Atts}}) -> gen_write(_Db, {purge, {DocId, PrevRevs0, _}}) -> PrevRevs = if is_list(PrevRevs0) -> PrevRevs0; true -> [PrevRevs0] end, - {purge, {DocId, PrevRevs}}; + {purge, {couch_uuids:random(), DocId, PrevRevs}}; gen_write(Db, {Action, {DocId, Body, Atts}}) -> #full_doc_info{} = PrevFDI = couch_db:get_full_doc_info(Db, DocId), @@ -369,11 +369,12 @@ db_changes_as_term(Db) -> db_purged_docs_as_term(Db) -> - PSeq = couch_db_engine:get_oldest_purge_seq(Db) - 1, + InitPSeq = couch_db_engine:get_oldest_purge_seq(Db) - 1, FoldFun = fun({PSeq, UUID, Id, Revs}, Acc) -> {ok, [{PSeq, UUID, Id, Revs} | Acc]} end, - {ok, PDocs} = couch_db_engine:fold_purge_infos(Db, PSeq, FoldFun, [], []), + {ok, PDocs} = couch_db_engine:fold_purge_infos( + Db, InitPSeq, FoldFun, [], []), lists:reverse(PDocs). -- To stop receiving notification emails like this one, please contact dav...@apache.org.