You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/03/09 12:43:50 UTC

[GitHub] jiangphcn commented on a change in pull request #1187: [WIP] Couchdb 3326 clustered purge

jiangphcn commented on a change in pull request #1187: [WIP] Couchdb 3326 clustered purge
URL: https://github.com/apache/couchdb/pull/1187#discussion_r173440032
 
 

 ##########
 File path: src/couch_index/src/couch_index_plugin_couch_db.erl
 ##########
 @@ -0,0 +1,42 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_index_plugin_couch_db).
+
+-export([
+    before_copy_purge_info/1
+]).
+
+-include_lib("couch/include/couch_db.hrl").
+-include_lib("couch_mrview/include/couch_mrview.hrl").
+
+
+before_copy_purge_info(DbName) ->
+    {ok, DDocs} = design_docs(DbName),
+    lists:map(fun(DDoc) ->
+        JsonDDoc = couch_doc:from_json_obj(DDoc),
+        couch_mrview_index:maybe_create_local_purge_doc(DbName, JsonDDoc)
 
 Review comment:
   Understand that we had better not to use `couch_mrview_index` in `couch_index` repository. I also tried with different approach. But didn't find more graceful way. Alternatively, I can try to make it configurable and open to any suggestions.
   
   The difficulty here is that this was called from https://github.com/apache/couchdb/pull/1187/commits/c5eb57ba4929182d46cd23973b37d895441e71c6#diff-6b8890f55c19eb040b25463764ed0a05R64 where there is no context information about `couch_mrview_index`.  This is different calls triggered from `couch_mrview` repository and couch_mrview_index can be passed as `Mod`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services