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

 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.
+    before_copy_purge_info/1
+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)
+    end, DDocs).
+%% Internal functions
+design_docs(DbName) ->
 Review comment:
   Ok, understand why it need to be here. Two points though 1) as it is right 
now it doesn't seems that `before_copy_purge_info` write local doc once, but 
rather every time a shard compacts. 2) this is a shard compaction, but we are 
writing into it the local docs for all database views, so each shard's getting 
copy of all those local docs. I haven't finish reading complete PR so not 100% 
sure that's the intent.

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:

With regards,
Apache Git Services

Reply via email to