Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
2.0.0
-
None
-
None
Description
The compaction daemon is currently using couch_db:enum_docs/4 [1] to get the design documents for a database. This is a problem because couch_db:enum_docs/4 operates on a shard - we will therefore only get a list of all the design documents on that shard, rather than all design documents for the DB.
This means view shards for the DB shard will not get compacted unless the design doc happens to be on that shard.
I tested this out by generating some fragmented views and running the compaction daemon. After completion I found that only one view shard had been compacted [2] and verified that it was the shard that contains the design doc [3].
[1] https://github.com/apache/couchdb-couch/blob/master/src/couch_compaction_daemon.erl#L235
[2] https://gist.github.com/mikewallace1979/abf87e1ece983fad85b3#file-view_shard_sizes-sh-L5
[3] https://gist.github.com/mikewallace1979/abf87e1ece983fad85b3#file-ddoc-sh-L1-L2