nickva commented on code in PR #4718:
URL: https://github.com/apache/couchdb/pull/4718#discussion_r1298530399
##########
src/fabric/src/fabric.erl:
##########
@@ -590,25 +590,38 @@ cleanup_index_files(DbName) ->
cleanup_local_indices_and_purge_checkpoints([]) ->
ok;
cleanup_local_indices_and_purge_checkpoints([_ | _] = Dbs) ->
- AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
- AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
- Sigs = couch_mrview_util:get_signatures(hd(Dbs)),
- ok = cleanup_purges(Sigs, AllPurges, Dbs),
- ok = cleanup_indices(Sigs, AllIndices).
+ MrViewIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ MrViewPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1,
Dbs),
+ MrViewSigs = couch_mrview_util:get_signatures(hd(Dbs)),
+ ok = cleanup_mrview_purges(MrViewSigs, MrViewPurges, Dbs),
+ ok = cleanup_mrview_indices(MrViewSigs, MrViewIndices),
-cleanup_purges(Sigs, AllPurges, Dbs) ->
+ ClouseauSigs = dreyfus_util:active_sigs(hd(Dbs)),
+ ok = cleanup_clouseau_indices(Dbs, ClouseauSigs),
+
+ NouveauSigs = nouveau_util:active_sigs(hd(Dbs)),
+ ok = cleanup_nouveau_indices(Dbs, NouveauSigs).
+
+cleanup_mrview_purges(Sigs, AllPurges, Dbs) ->
Fun = fun(DbPurges, Db) ->
couch_mrview_cleanup:cleanup_purges(Db, Sigs, DbPurges)
end,
lists:zipwith(Fun, AllPurges, Dbs),
ok.
-cleanup_indices(Sigs, AllIndices) ->
+cleanup_mrview_indices(Sigs, AllIndices) ->
Fun = fun(DbIndices) ->
couch_mrview_cleanup:cleanup_indices(Sigs, DbIndices)
end,
lists:foreach(Fun, AllIndices).
+cleanup_clouseau_indices(Dbs, ActiveSigs) ->
+ Fun = fun(Db) -> clouseau_rpc:cleanup(Db, ActiveSigs) end,
+ lists:foreach(Fun, Dbs).
+cleanup_nouveau_indices(Dbs, ActiveSigs) ->
+ Fun = fun(Db) -> nouveau_api:delete_path(nouveau_util:index_name(Db),
ActiveSigs) end,
+ lists:foreach(Fun, Dbs).
Review Comment:
Makes sense. The only worry was that we would throw an exception and prevent
other indexes from getting cleaned up. Thanks for double-checking, I think it's
fine as is, then.
--
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]