nickva commented on code in PR #6138:
URL: https://github.com/apache/couchdb/pull/6138#discussion_r4163520511
##########
src/nouveau/src/nouveau_index_updater.erl:
##########
@@ -251,53 +238,44 @@ index_definition(#index{} = Index, InitialPurgeSeq) ->
<<"initial_purge_seq">> => InitialPurgeSeq
}.
-purge_index(Db, Index, #purge_acc{} = PurgeAcc0) ->
- Proc = get_os_process(Index#index.def_lang),
- try
- true = proc_prompt(Proc, [<<"add_fun">>, Index#index.def,
<<"nouveau">>]),
- FoldFun = fun({PurgeSeq, _UUID, Id, _Revs}, #purge_acc{} = PurgeAcc1)
->
- PurgeAcc3 =
- case couch_db:get_full_doc_info(Db, Id) of
- not_found ->
- Item = nouveau_api:make_purge(
- Id, PurgeAcc1#purge_acc.index_purge_seq, PurgeSeq
- ),
- PurgeAcc2 = PurgeAcc1#purge_acc{batch = [Item |
PurgeAcc1#purge_acc.batch]},
- PurgeAcc2#purge_acc{index_purge_seq = PurgeSeq};
- FDI ->
- DI = couch_doc:to_doc_info(FDI),
- #doc_info{id = Id, high_seq = Seq, revs =
[#rev_info{rev = Rev} | _]} = DI,
- case lists:member({Id, Rev},
PurgeAcc1#purge_acc.exclude_list) of
- true ->
- PurgeAcc1;
- false ->
- Item = update_or_delete_index(
- Db, PurgeAcc1#purge_acc.index_update_seq,
DI, Proc
- ),
- PurgeAcc1#purge_acc{
- batch = [Item | PurgeAcc1#purge_acc.batch],
- exclude_list = [{Id, Rev} |
PurgeAcc1#purge_acc.exclude_list],
- index_update_seq = Seq
- }
- end
- end,
- update_task(1),
- maybe_flush_batch(PurgeAcc3)
- end,
+purge_index(Db, Index, StartUpdateSeq, #purge_acc{} = PurgeAcc0) ->
+ FoldFun = fun({PurgeSeq, _UUID, Id, _Revs}, #purge_acc{} = PurgeAcc1) ->
+ PurgeAcc2 =
+ case couch_db:get_full_doc_info(Db, Id) of
+ not_found ->
+ queue_purge(Id, PurgeSeq, PurgeAcc1);
+ #full_doc_info{} = FDI ->
+ #doc_info{high_seq = Seq} = couch_doc:to_doc_info(FDI),
Review Comment:
We don't need a doc_info{}. Use `FDI` `update_seq` instead as the sequence.
```
case ... of
#full_doc_info{update_seq = Seq} ->
...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]