davisp commented on a change in pull request #1370: [5/5] Clustered Purge 
Implementation
URL: https://github.com/apache/couchdb/pull/1370#discussion_r195209591
 
 

 ##########
 File path: src/couch_index/src/couch_index_updater.erl
 ##########
 @@ -208,12 +211,27 @@ update(Idx, Mod, IdxState) ->
 purge_index(Db, Mod, IdxState) ->
     {ok, DbPurgeSeq} = couch_db:get_purge_seq(Db),
     IdxPurgeSeq = Mod:get(purge_seq, IdxState),
-    if
-        DbPurgeSeq == IdxPurgeSeq ->
-            {ok, IdxState};
-        DbPurgeSeq == IdxPurgeSeq + 1 ->
-            {ok, PurgedIdRevs} = couch_db:get_last_purged(Db),
-            Mod:purge(Db, DbPurgeSeq, PurgedIdRevs, IdxState);
-        true ->
-            reset
+    if IdxPurgeSeq == DbPurgeSeq -> {ok, IdxState}; true ->
+        FoldFun = fun({PurgeSeq, _UUId, Id, Revs}, Acc) ->
+            Mod:purge(Db, PurgeSeq, [{Id, Revs}], Acc)
+        end,
 
 Review comment:
   @jiangphcn We could always batch up in an accumulator and only invoke 
Mod:purge/4 occasionally rather than for individual rows.
   
   @kocolosk The only reason its not batching was mulling over simple vs 
complex for questionable benefits. Given that purge is basically a "Break Glass 
in Case of Emergency" feature and shouldn't be part of an application's core 
workflow it seemed not overly useful to concern ourselves with performance.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to